MPU6050 Accelerometer

451 views
Skip to first unread message

Son Huynh

unread,
Mar 23, 2017, 12:41:53 PM3/23/17
to Node-RED
Hi,

I'm pretty new to Node-Red and new to programming in general. How would I go about getting accelerometer data from an Invensense MPU6050 and graph it the 3 axis? I've tried searching for stuff on the npm website and node-red website but coming up short on finding a premade node. Thank you in advance!

Colin Law

unread,
Mar 23, 2017, 12:52:20 PM3/23/17
to node...@googlegroups.com
Googling for
Invensense MPU6050 node red
yields a number of hits that look as if they might get you started.

Colin
> --
> http://nodered.org
>
> Join us on Slack to continue the conversation: http://nodered.org/slack
> ---
> You received this message because you are subscribed to the Google Groups
> "Node-RED" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to node-red+u...@googlegroups.com.
> To post to this group, send email to node...@googlegroups.com.
> Visit this group at https://groups.google.com/group/node-red.
> To view this discussion on the web, visit
> https://groups.google.com/d/msgid/node-red/4899aa0b-dbdf-4ce2-bb56-2484698a8f5e%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Son Huynh

unread,
Mar 23, 2017, 1:17:53 PM3/23/17
to Node-RED
Thanks Colin,

I've actually read through all the posts using that search before. The closest I've come to something is from this page:

I've also found this before:

But I do not understand what I2C is and it's also missing a node called nodebot.

When i started this, i thought creating a graphic display would be as easy as reading from the GPIO pins and displaying the data onto the graph or a gauge.

There are actually three sensors I'm working on. Temperaure (which is done), accelerometer, and current.

Son Huynh

unread,
Mar 23, 2017, 1:24:27 PM3/23/17
to Node-RED
Sorry I forgot to include, I found the page for the Johnny-five thing but I'm not really sure what to do with it.


On Thursday, March 23, 2017 at 11:41:53 AM UTC-5, Son Huynh wrote:

Julian Knight

unread,
Mar 23, 2017, 1:28:45 PM3/23/17
to Node-RED
https://learn.sparkfun.com/tutorials/i2c

It is a type of serial communications for microcontroller systems and only requires 2 pins for multiple sensors.

Jonny5 is a robot control interface that relies on having Firmata installed on a microcontroller such as an Arduino - I think - a long time since I looked at it to be honest as it didn't meet my requirements.


I can't be bothered with the faff of GPIO on the Pi so I always use a separate microcontroller. But plenty of people do use it just fine.

Colin Law

unread,
Mar 23, 2017, 1:33:12 PM3/23/17
to node...@googlegroups.com
According to [1] the device can communicate over an I2C or SPI bus,
but have you really got a naked device or is it already mounted on a
board of some sort with supporting logic? If so then the interface may
be different.

[1] https://www.invensense.com/products/motion-tracking/6-axis/mpu-6050/

Colin
> --
> http://nodered.org
>
> Join us on Slack to continue the conversation: http://nodered.org/slack
> ---
> You received this message because you are subscribed to the Google Groups
> "Node-RED" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to node-red+u...@googlegroups.com.
> To post to this group, send email to node...@googlegroups.com.
> Visit this group at https://groups.google.com/group/node-red.
> To view this discussion on the web, visit
> https://groups.google.com/d/msgid/node-red/050beb3d-13a1-4f40-8976-b7512dd0f208%40googlegroups.com.

Son Huynh

unread,
Mar 23, 2017, 2:09:44 PM3/23/17
to Node-RED
At the moment my connections are straight from the sensor to the RPI itself. Only difference is that I'm using the breadboard and a Sparkfun wedge.



On Thursday, March 23, 2017 at 11:41:53 AM UTC-5, Son Huynh wrote:

Colin Law

unread,
Mar 23, 2017, 5:22:35 PM3/23/17
to node...@googlegroups.com
In that case you will have to learn about I2C I think.

Colin

--
http://nodered.org
 
Join us on Slack to continue the conversation: http://nodered.org/slack
---
You received this message because you are subscribed to the Google Groups "Node-RED" group.
To unsubscribe from this group and stop receiving emails from it, send an email to node-red+unsubscribe@googlegroups.com.

To post to this group, send email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.

Son Huynh

unread,
Mar 23, 2017, 7:31:44 PM3/23/17
to Node-RED
thank you guys for your help, will this be the same way for me to detect current? I have it going through an ADC.


On Thursday, March 23, 2017 at 11:41:53 AM UTC-5, Son Huynh wrote:

Colin Law

unread,
Mar 24, 2017, 4:11:01 AM3/24/17
to node...@googlegroups.com
It depends on what ADC you are using.

Colin
> --
> http://nodered.org
>
> Join us on Slack to continue the conversation: http://nodered.org/slack
> ---
> You received this message because you are subscribed to the Google Groups
> "Node-RED" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to node-red+u...@googlegroups.com.
> To post to this group, send email to node...@googlegroups.com.
> Visit this group at https://groups.google.com/group/node-red.
> To view this discussion on the web, visit
> https://groups.google.com/d/msgid/node-red/16aa6af2-862e-4752-93de-48e63acde23a%40googlegroups.com.

Son Huynh

unread,
Mar 24, 2017, 8:58:37 PM3/24/17
to Node-RED
I'm trying to use the I2C tool Julian suggested, but I'm not really understanding what 's asking because I've tried using the address 68 and I'm getting the same error

Colin Law

unread,
Mar 25, 2017, 4:18:42 AM3/25/17
to node...@googlegroups.com
What same error?

Colin

To unsubscribe from this group and stop receiving emails from it, send an email to node-red+unsubscribe@googlegroups.com.

To post to this group, send email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.

Son Huynh

unread,
Mar 25, 2017, 12:05:30 PM3/25/17
to Node-RED
Oh sorry,

In the three pictures from the previous reply. "Type error: Failed to set address." I don't understand the address or the command the I2C node is looking for. I've tried 68,104, 150, 1101000, 1101001. There is also a second screen asking the default address, which I don't understand why would it ask for the address AND default address. When I used sudo i2c detect -y 1, the picture showed address 68 for the MPU6050. Please Ignore the 80 and 503 payload. That is the current sensor and temperature payload.
What same error?

Colin

Colin Law

unread,
Mar 25, 2017, 1:38:30 PM3/25/17
to node...@googlegroups.com
The note at the bottom of the window says that you must start the address with #.

Colin

To unsubscribe from this group and stop receiving emails from it, send an email to node-red+unsubscribe@googlegroups.com.

To post to this group, send email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.

Son Huynh

unread,
Mar 25, 2017, 4:08:07 PM3/25/17
to Node-RED
it doesn't let me type in #
Reply all
Reply to author
Forward
0 new messages