Comments (28)
I'm checking this now.
from cylon-i2c.
It seems nothing is being read from the i2c port on the arduino, either you have it incorrectly wired to the arduino, or it is not returning anything, damaged?...
I'll post a small fix to prevent this error from showing but when the read data from the arduino does not exist, give it another try after that, see if maybe the arduino is taking longer than expected to initialize the i2c device.
from cylon-i2c.
Thank you for your attention !
I have arduino duemilanove, A4 (SDA) A5 (SCL) this is the wiring, this correct?
from cylon-i2c.
That is correct, do you have any other way to check if the sensor is working correctly, it seems the firmata library is not being able to read anything back from the arduino, let me give the code another read, also could you pls paste here the code you are trying to run.
from cylon-i2c.
I've added some error handling to this branch, give that branch a try see what we get.
https://github.com/hybridgroup/cylon-i2c/tree/fix-hmc6352
You can give it a try see if the error sends anything useful, you can use something like this for testing:
var Cylon = require('cylon');
Cylon.robot({
connection: { name: 'uno', adaptor: 'firmata', port: '/dev/ttyACM0' },
device: { name: 'mpu6050', driver: 'mpu6050' },
work: function(my) {
every((1).seconds(), function() {
my.mpu6050.getMotionAndTemp(function(err, data) {
if (err) {
Cylon.Logger.error('Err ===>', err);
} else {
Cylon.Logger.info('Data ===>', data);
}
});
});
}
}).start();
Also share your code so we can check if you have any other type of error.
from cylon-i2c.
@MarceloTomaz Just noticed you mentioned tyou have an arduino duemilanove, have you tried other examples like the blink LED or the servo one? some arduino boards have issues with the firmata protocol try this:
- Upload the firmata protocol to the arduino using our gort.io CLI tool.
- Try the Blink LED example.
- Make sure you have the correct serial port on the example, you can check it out in the arduino IDE.
var Cylon = require('cylon');
Cylon.robot({
connection: { name: 'arduino', adaptor: 'firmata', port: 'COM0' },
device: {name: 'led', driver: 'led', pin: 13},
work: function(my) {
every((1).second(), function() {
my.led.toggle();
});
}
}).start();
from cylon-i2c.
CONSIDERATIONS
- I am using the example provided in the test site --- http://cylonjs.com/documentation/drivers/mpu6050/
- Using the Arduino Firmata example - StandardFirmata
- Serial port OK
- Example Blink OK
- When using the GORT to send Firmata get error: OS not yet supported.
- My OS WINDOWS 7 64
- Tests with Arduino and Arduino Pro Mini duemilanove
doubts -
- What is the value of resistor to pull up?
- The test in duemilanove and Pro mini connection is used with MPU6050:
Dc: 3.3v-5v
GND: Ground
SCL: A5
SDA: A4
AD0: Ground
INT: Digital 2
It would take some other connection? - Which version of Firmata to climb on arduino?
Thank you again!
from cylon-i2c.
I do not have the sensor so it is difficult for me to test this, You do not need the pull-up resistors, at least on the Arduino UNO, it already has them internally, not sure about the duemilanove, you could investigate.
Standard firmata from the Arduino IDE examples should do the job, if the blink example I provided above works then firmata is good to go and the problem is likely with the sensor connections.
Just for the sake of it, could you please paste here the exact example you are trying to run.
As far as I know you only need 4 wires from the sensor to the arduino:
VCC -> 3.3V
GND -> GND
SCL -> A5
SDA -> A4
The int
pin serves to tell the arduino when data is available to be read, or the buffer is ready, but only when the sensor is in buffer mode, should not be the case so you can probably not connect this.
Same thing with AD0 this serves the purpose of selecting a different address, try leaving it free, not connected. The driver tries to read from the default address, so this might be causing the sensor to setup in a different address, which makes cylon not able to find it in the I2C bus.
My suggestion first of all disconnect AD0 and run the example, if still does not work connect it to Grd and run, if does not work connect to 3.3v and run again check if that fixes it.
from cylon-i2c.
@edgarsilva, would you like to test, how to send a simple message to the arduino?
I tested the codes that suggested above and below the test code I've been running.
var Cylon = require('cylon');
Cylon.robot({
connection: { name: 'arduino', adaptor: 'firmata', port: 'COM3' },
device: { name: 'mpu6050', driver: 'mpu6050' },
work: function(my) {
every((1).seconds(), function() {
my.mpu6050.getMotionAndTemp(function(data) {
Logger.info(data);
});
});
}
}).start();
TNKS !
from cylon-i2c.
There is a mistake in that code, cylon no longer registers a Logger, but it seems you are not getting to that point yet, the code should look like this:
var Cylon = require('cylon');
Cylon.robot({
connection: { name: 'arduino', adaptor: 'firmata', port: 'COM3' },
device: { name: 'mpu6050', driver: 'mpu6050' },
work: function(my) {
every((1).seconds(), function() {
my.mpu6050.getMotionAndTemp(function(data) {
Cylon.Logger.info(data); // This should be referenced through cylon
});
});
}
}).start();
- Did you do any changes to the sensor wires and setup?
- Did you try the branch I provided yesterday? Give it a try with the example code I provided above, just update the serialport for the correct one.
from cylon-i2c.
@MarceloTomaz Hey any progress here? Anything else I can help you with?
from cylon-i2c.
Hello, I did some testing, but no success.
I decided to use the SERIALPORT library for reading data from the arduino, I uploaded the example MPU6050_DMP6 for arduino and so could receive using NodeJS, thus ruling out a hardware failure.
My experience with NodeJS is minimal, so I think I will install the entire environment for Cylon.js on a computer with linux, talvem think something may be blocking the windows.
I have a new doubt, what would extrutura folders within "node_module"? believe #npm may be importing the wrong way.
Thank you!
from cylon-i2c.
In your project, where your code javascript code that will run on node.js resides, every time you install a npm module is installed inside the node_modules folder.
So if you install cylon you should have ./node_modules/cylon
and cylon will have another node_modules folder inside with its dependencies.
so if you install everything you need to run cylon on the arduino you should have:
./node_modules
cylon/
cylon-firmata/
cylon-gpio/
cylon-i2c
and also any other dependency you might be using on your code.
from cylon-i2c.
My question about that is inside the module cylon-Firmata, it repeats root dependence as the extrutura?
Attached image for my directory structure.
from cylon-i2c.
I did test with servo motor and also got error, but did not save log
from cylon-i2c.
@MarceloTomaz The stricture is find as you have it, cylon-firmata does have a dependency for cylon, and the way npm works it has to be included in the dependency tree like that, it does not get it from the root of the project.
if you have issues with other hardware there's probably some other issue with arduino duemilanove and firmata, and not with your sensor, do you have any other arduino or microcontroler? Raspberry Pi? Beaglebone black? arduino Uno?
I don't have a duemilanove, but I know firmata has issues with the mega and I think also with the leonardo, I'll test my arduino Uno with a servo and another i2c device just to make sure there is no other bug with the libraries. but it sounds like it might be a problem with firmata and duemilanove.
from cylon-i2c.
I think this issue was addressed by the most recent release of cylon-i2c. Can you please give this a try?
from cylon-i2c.
Ok deadprogram, I will test and return the results.
from cylon-i2c.
I also have an MPU6050, so I can solder it up and check it out. Do note that this is a 3.3v device, you might need a level shifter.
from cylon-i2c.
Hello!
I did the test, but with no success MPU6050.
The example blink this works, below the return.
|======================================================================|
C:\Users\marcelo.tomaz\Documents\NODEJS\cylon>node cylon_test.js
I, [2014-10-04T15:45:07.310Z] INFO -- : Initializing connections.
I, [2014-10-04T15:45:07.312Z] INFO -- : Initializing connection 'arduino'.
D, [2014-10-04T15:45:07.313Z] DEBUG -- : Loading adaptor 'firmata'.
D, [2014-10-04T15:45:07.412Z] DEBUG -- : Registering Firmata adaptor for Robot 25785
D, [2014-10-04T15:45:07.416Z] DEBUG -- : Registering i2c BlinkM driver for Robot 25785
D, [2014-10-04T15:45:07.419Z] DEBUG -- : Registering i2c HMC6352 driver for Robot 25785
D, [2014-10-04T15:45:07.420Z] DEBUG -- : Registering i2c MPL115A2 driver for Robot 25785
D, [2014-10-04T15:45:07.421Z] DEBUG -- : Registering i2c BMP180 driver for Robot 25785
D, [2014-10-04T15:45:07.422Z] DEBUG -- : Registering i2c MPU6050 driver for Robot 25785
D, [2014-10-04T15:45:07.423Z] DEBUG -- : Registering i2c LCD driver for Robot 25785
D, [2014-10-04T15:45:07.424Z] DEBUG -- : Registering i2c LSM9DS0G driver for Robot 25785
D, [2014-10-04T15:45:07.425Z] DEBUG -- : Registering i2c LSM9DS0XM driver for Robot 25785
I, [2014-10-04T15:45:07.426Z] INFO -- : Initializing devices.
I, [2014-10-04T15:45:07.427Z] INFO -- : Initializing device 'mpu6050'.
D, [2014-10-04T15:45:07.428Z] DEBUG -- : Loading driver 'mpu6050'.
I, [2014-10-04T15:45:07.431Z] INFO -- : Starting connections.
I, [2014-10-04T15:45:07.434Z] INFO -- : Connecting to 'arduino' on port com3.
I, [2014-10-04T15:45:10.661Z] INFO -- : Starting devices.
I, [2014-10-04T15:45:10.662Z] INFO -- : Starting device 'mpu6050'.
I, [2014-10-04T15:45:10.666Z] INFO -- : Working.
null
null
null
null
null
null
null
I, [2014-10-04T15:45:29.052Z] INFO -- : Halting device 'mpu6050'.
I, [2014-10-04T15:45:29.053Z] INFO -- : Disconnecting from 'arduino' on port com3.
|====================================================================|
Is there any documentation for more functions MPU6050 as "getMotionAndTemp"?
from cylon-i2c.
from cylon-i2c.
@deadprogram , based on image, this correct?
from cylon-i2c.
@MarceloTomaz where did you get your MPU6050 from? Looks like it might take 5V in instead of 3.3V.
from cylon-i2c.
@MarceloTomaz did you ever get this to work? have you seen any issues or tried the latest release?
from cylon-i2c.
Hi,
The example code here http://cylonjs.com/documentation/drivers/mpu6050/ seems to have a bug.
Should be
every((1).seconds(), function() {
my.motionsensor.getMotionAndTemp(function(err, data) {
console.log(data);
});
});
Note the err
param
My environment:
- Windows 7 64bit
- Arduino Uno
- GY-521 - MPU 6050 breakout board
This fixed my issue.
I think @edgarsilva Aug 5th tweak adding extra error handling broke the example in to doco
Thanks
from cylon-i2c.
@edgarsilva have fixed the documentation and sent a pull request
from cylon-i2c.
@janaka seems to be correct, checking the PR now.
from cylon-i2c.
Any news on this, seems the problem was solved but never logged here, I'm closing the issue.
from cylon-i2c.
Related Issues (11)
- i2c connection problem with hmc 6352 compass module HOT 25
- Any advice on edison + LSM9DS0 HOT 16
- got driver for DS1337 real time clock HOT 3
- Device agnostic driver HOT 3
- Bosch BME280 HOT 1
- Is my screen incompatible ? HOT 3
- BMP180 not working HOT 12
- How to register just created new driver
- I2C lcd backlight flickering on Arduino Yún
- i2c blocking with multiple devices
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cylon-i2c.