One note regarding the error message “cannot open /dev/ttyAMA0cannot open /dev/ttyAMA0”. Maybe this is originating from some other plugin. Do you a plugin using serial line comms, like pimatic-homeduino?
-
I2C Problem with Johnny-five and raspi-io
"It always takes longer than you expect, even when you take into account Hofstadter's Law.", Hofstadter's Law
-
oh yes… i use the Arduino nano with USB…
(as a note: i have update the plugin but the same error and pimatic crashes… and i have copy your plugin in my configuration)
I use the Arduino to switch relays over 433Mhz.
My othe plugins are:"plugin": "cron" "plugin": "mobile-frontend" "plugin": "ping" "plugin": "sunrise" "plugin": "shell-execute" "plugin": "openweather" "plugin": "homeduino" "plugin": "links "plugin": "fritz" "plugin": "sysinfo" "plugin": "pushbullet" "plugin": "johnny-five" "plugin": "amazing-dash-button" "plugin": "iframe"
You told that you use the j5 over your arduino. should i test that? is it a advantage to use the MCP23017 with the j5 over the arduino?
-
@Masterplayer said in I2C Problem with Johnny-five and raspi-io:
johnny-five
Can you please send me the current plugin config you have for johnny-five?
"It always takes longer than you expect, even when you take into account Hofstadter's Law.", Hofstadter's Law
-
here my plugin-config:
}, { "boards": [ { "id": "1", "boardType": "raspi-io" }, { "id": "2", "port": "1", "controller": "MCP23017", "boardType": "expander" }, { "id": "3", "port": "1", "address": "0x21", "controller": "MCP23017", "boardType": "expander" } ], "plugin": "johnny-five", "active": true },
i also have install the raspi-io as a normal user (user:pi). was that right?
-
@Masterplayer said:
I use the Arduino to switch relays over 433Mhz.
My test setup is similar as I have connected an arduino for pimatic-homeduino, too. Which serialDevice setting do you have for homeduino?
You told that you use the j5 over your arduino. should i test that? is it a advantage to use the MCP23017 with the j5 over the arduino?
No, I don’t think there is an advantage with that.
i also have install the raspi-io as a normal user (user:pi). was that right?
No, that’s not required. However, please make sure you have wiringPi installed.
"It always takes longer than you expect, even when you take into account Hofstadter's Law.", Hofstadter's Law
-
my plugin-config for homeduino is:
{ "plugin": "homeduino", "driver": "serialport", "driverOptions": { "serialDevice": "/dev/ttyUSB0", "baudrate": 115200 }, "receiverPin": 0, "transmitterPin": 4, "active": true },
wiringPi is installed. i have updated wiringPi but always the same issue and crash…
and the mcp23017 are online:
pi@raspberrypi:~/pimatic-app $ sudo i2cdetect -y 1 0 1 2 3 4 5 6 7 8 9 a b c d e f 00: -- -- -- -- -- -- -- -- -- -- -- -- -- 10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 20: 20 21 -- -- -- -- -- -- -- -- -- -- -- -- -- -- 30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 70: -- -- -- -- -- -- -- -- pi@raspberrypi:~/pimatic-app $
-
@Masterplayer I have published another update today ( pimatic-johnny-five@0.9.9) which improves error handling for expander boards and provides other minor improvements. Please give it a try.
From there, I think it makes sense to check the log for error messages in more detail and also have a look at debug output for pimatic-johnny-five. Debug output can be enabled by adding setting the plugin configuration"debug"
totrue
."It always takes longer than you expect, even when you take into account Hofstadter's Law.", Hofstadter's Law
-
@mwittig thanks a lot for your efforts!
I had 2 errors at the install of the update!
serialport@4.0.7 install /home/pi/pimatic-app/node_modules/pimatic-johnny-five/node_modules/johnny-five/node_modules/serialport
node-pre-gyp install --fallback-to-build
node-pre-gyp ERR! Tried to download(404): https://github.com/EmergingTechnologyAdvisors/node-serialport/releases/download/4.0.7/serialport-v4.0.7-node-v46-linux-arm.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for serialport@4.0.7 and node@4.4.5 (node-v46 ABI) (falling back to source compile with node-gyp)
make: Entering directory '/home/pi/pimatic-app/node_modules/pimatic-johnny-five/node_modules/johnny-five/node_modules/serialport/build’
CXX(target) Release/obj.target/serialport/src/serialport.o
CXX(target) Release/obj.target/serialport/src/serialport_unix.o
CXX(target) Release/obj.target/serialport/src/serialport_poller.o
SOLINK_MODULE(target) Release/obj.target/serialport.node
COPY Release/serialport.node
make: Leaving directory '/home/pi/pimatic-app/node_modules/pimatic-johnny-five/node_modules/johnny-five/node_modules/serialport/build’
pimatic-johnny-five@0.9.9 node_modules/pimatic-johnny-five
├── oled-font-5x7@1.0.0
├── pimatic-plugin-commons@0.9.3
├── oled-js@4.0.2
├── etherport-client@0.1.2 (debug@2.6.0)
├── etherport@0.1.4 (es6-shim@0.35.2)
├── particle-io@0.14.0 (es6-shim@0.35.2, array-includes@3.0.2)
└── johnny-five@0.10.6 (lodash.debounce@4.0.8, lodash.clonedeep@4.5.0, ease-component@1.0.0, browser-serialport@2.1.0, color-convert@1.2.2, temporal@0.5.0, nanotimer@0.3.10, firmata@0.15.0, chalk@1.1.3, es6-shim@0.35.2, serialport@4.0.7)i have tested it and i´m sorry to say it but the same issue and pimatic crash.
I have set the debug of j5 to true and this is what the log say:
20:20:44.351 [pimatic] info: Loading plugin: “pimatic-johnny-five” (0.9.9)
20:20:44.357 [pimatic] debug: debug is true in plugin config, showing debug output for pimatic-johnny-five.
20:20:45.472 [pimatic] info: Loading plugin: “pimatic-amazing-dash-button” (0.9.11)
20:20:45.570 [pimatic] info: Loading plugin: “pimatic-iframe” (0.2.0)
20:20:45.619 [pimatic-cron] info: the time is: Tue Jan 17 2017 20:20:45 GMT+0100 (CET)
20:20:45.947 [pimatic-sunrise] info: Your location is set to lat: 52.834815, long: 8.311706
1484680847469 Device(s) RaspberryPi-IO
20:20:47.477 [pimatic-johnny-five] debug: [BoardManager] Created board 1
20:20:47.492 [pimatic-johnny-five] debug: [BoardManager] Created board 2
20:20:47.497 [pimatic-johnny-five] debug: [BoardManager] Created board 3
20:20:47.509 [pimatic-johnny-five] debug: Registering device class JohnnyFiveOledDisplay
20:20:47.524 [pimatic-johnny-five] debug: Registering device class JohnnyFiveSwitch
20:20:47.534 [pimatic-johnny-five] debug: Registering device class JohnnyFiveContactSensor
20:20:47.544 [pimatic-johnny-five] debug: Registering device class JohnnyFivePresenceSensor
20:20:47.554 [pimatic-johnny-five] debug: Registering device class JohnnyFiveButton
20:20:47.574 [pimatic-johnny-five] debug: Registering device class JohnnyFiveRelay
20:20:47.588 [pimatic-johnny-five] debug: Registering device class JohnnyFivePwmOutput
20:20:47.597 [pimatic-johnny-five] debug: Registering device class JohnnyFiveTemperature
20:20:47.606 [pimatic-johnny-five] debug: Registering device class JohnnyFiveTemperatureHumidity
20:20:47.616 [pimatic-johnny-five] debug: Registering device class JohnnyFiveTemperaturePressure
1484680848340 Connected RaspberryPi-IO
20:20:48.342 [pimatic-johnny-five] debug: [Board#1] Message received: RaspberryPi-IO
20:20:48.351 [pimatic-johnny-five] debug: [Board#1] Board Ready
20:20:48.407 [pimatic-johnny-five] debug: [ExpanderBoard#2] Board Ready
20:20:48.436 [pimatic-johnny-five] debug: [ExpanderBoard#3] Board Ready
20:20:48.581 [pimatic] error: A uncaught exception occured: Error: Error: No such file or directory, cannot open /dev/ttyAMA0
20:20:48.581 [pimatic] error:> at Error (native)
20:20:48.581 [pimatic] error:> This is most probably a bug in pimatic or in a module, please report it!
20:20:48.584 [pimatic] info: exiting…Thanks
-
@Masterplayer said in I2C Problem with Johnny-five and raspi-io:
node-pre-gyp ERR! Pre-built binaries not found for serialport@4.0.7 and node@4.4.5 (node-v46 ABI) (falling back to source compile with node-gyp)
node-pre-gyp ERR! Pre-built binaries not found for serialport@4.0.7 and node@4.4.5 (node-v46 ABI) (falling back to source compile with node-gyp)I am getting the same error during install, but as said it fallbacks to building the binaries and the installations succeeds,
I have set the debug of j5 to true and this is what the log say:
The debug output is indicating the the boards have initialized successfully. Do you already have johnny five as part of your config? If yes, can you please remove them for a test? If no, I am a bit lost here, as there is not much happening after board initialization if no device involved.
"It always takes longer than you expect, even when you take into account Hofstadter's Law.", Hofstadter's Law
-
Can you please also let me know:
-
Do you use /dev/ttyAMA0 for something elese? If yes, can you please briefly describe what it is?
-
If it not used, can you please check whether or not the device exists, e.g.
ls -lHA /dev/ttyAMA0
"It always takes longer than you expect, even when you take into account Hofstadter's Law.", Hofstadter's Law
-
-
@mwittig said in I2C Problem with Johnny-five and raspi-io:
Do you use /dev/ttyAMA0 for something elese? If yes, can you please briefly describe what it is?
no not that i know. i´m only running pimatic and an lighttpd webserver on my pi. I have deleted the websever and check what you said and that is the output:
pi@raspberrypi:~ $ ls -la /dev/ttyAMA0
ls: Zugriff auf /dev/ttyAMA0 nicht möglich: Datei oder Verzeichnis nicht gefunden
pi@raspberrypi:~ $you asked:
Do you already have johnny five as part of your config?
What do you mean?
Every time i write the boards in the config to the j5 plugin pimatic crashes. -
@Masterplayer said in I2C Problem with Johnny-five and raspi-io:
pi@raspberrypi:~ $ ls -la /dev/ttyAMA0
ls: Zugriff auf /dev/ttyAMA0 nicht möglich: Datei oder Verzeichnis nicht gefundenCan you please do a
sudo ls -lHA /dev/ttyAMA0
? This is to check whether your system has the device in place and to check the access rightw.Meanwhile, I have digged a little deeper and found out that
raspi-io
actually is trying to open/dev/ttyAMA0
and throws an exception on failure. I have been able to reproduce the error by removing the device on my system. I think this a bug in raspi-io and I have created an issue for that (see below). I think the work-around for you is to make sure/dev/ttyAMA0
is in place on your system and it can be opened by user root. I am assuming you run pimatic as root. Please let me know otherwise.Thank you very much for your patience and commitment on the matter. This error wasn’t obvious to me at all. Please keep posted.
"It always takes longer than you expect, even when you take into account Hofstadter's Law.", Hofstadter's Law
-
@mwittig i must say thank you to you for spending so much time in my problem!
so, i have news but first, no, i don´t use pimatic as root, should i? what advantage have i in case of running it as root?
i test it as user pi with ls -lHA /dev/ttyAMA0 and also as root but always the same error.Then i also digged deeper and found (for me) a solution in the web.
On a other forum (i have forget which…) there was a discussion with the same problem of the /dev/ttyAMA0 and there was the Solution approach to change the:
enable_uart=0 into enable_uart=1
at boot/config.txt
For me now it works!
pi@raspberrypi:/ $ ls -lHA /dev/ttyAMA0
crw-rw---- 1 root dialout 204, 64 Jan 18 20:29 /dev/ttyAMA0
pi@raspberrypi:/ $Can you test this @mwittig?
Thank you!
P.S. now i have a little other problem. The suply for the MCP are 3,3V from the Pi. I will use them as Input to check the lights of my house (Whether they are on or off). So i return 3.3V on the pins, over the relays. At a device i take i J5 Presence Sensor but i don´t get a high or low signal only flicker. At low i have 0,26V at the Pins and high 3,36V. But nothing change at the device… must i work with pull-down?
Thanks
-
@Masterplayer said in I2C Problem with Johnny-five and raspi-io:
Thanks for the feedback. It’s great it is working for now even non-privileged. Note, the maintainer raspi-io believes it can only be used as root, but I think he is wrong with this. Unfortunately, he decided he won’t fix the reported issue, so, I’ll document it as a known issue as part of pimatic-johnny-five.
P.S. now i have a little other problem. The suply for the MCP are 3,3V from the Pi. I will use them as Input to check the lights of my house (Whether they are on or off). So i return 3.3V on the pins, over the relays. At a device i take i J5 Presence Sensor but i don´t get a high or low signal only flicker. At low i have 0,26V at the Pins and high 3,36V. But nothing change at the device… must i work with pull-down?
As far as I know the MCP has no internal pull-down resistors, but provides pull-ups. My suggestion is to use an external pull-down resistor of 10k as follows:
Resistor connected to ground. Vcc = 3,3V
"It always takes longer than you expect, even when you take into account Hofstadter's Law.", Hofstadter's Law
-
@mwittig said in I2C Problem with Johnny-five and raspi-io:
As far as I know the MCP has no internal pull-down resistors, but provides pull-ups. My suggestion is to use an external pull-down resistor of 10k as follows:
Thank you , i will test it and report then.
For Info:
I have check the raspi-io as root and as pi. It makes no difference between the rights. So I use it now as user: pi and it works fine! You only have to do what i post above.