Pages

Sunday, November 15, 2015

Arduino & Raspberry Pi fighting


This has been my focus over the last couple of weeks (after my day job of course and the other courses I'm teaching!!!)

The top left is of course a Raspberry Pi2
To the right is an Arduino Uno clone
To the right of it is a relay board with 2 x 5VDC relays triggered from the Uno
And just above the relay board is my 12V > 5VDC power supply.

The bottom board and breadboard is a Raspi B model with a Gertduino board plugged in above it (you see 2 blue LED's lit). This is my prototyping setup for the Raspi > Uno Communications.

The Arduino powers on the left hand relay (you can just make out the Red LED) which powers on the Raspberry Pi (Raspi).
As well, the Uno monitors my battery voltage on Analogue A0 pin (batteries are not pictured).
The Raspberry Pi polls the Arduino for the Battery Voltage & if the battery voltage drops to 10.5VDC, the Raspberry Pi goes into shutdown (via a python script).
The Arduino continues to monitor the battery voltage and if it drops down to 10VDC, it shuts off the relay which powers the Raspberry Pi down safely.
Once the power is restored, the Arduino powers up and then powers up the Raspberry Pi safely.

The problem I've been struggling with though, is when the Raspberry Pi polls the Uno via the USB Cable (shown unplugged from the Uno in the picture above) the Uno resets every time which changes it's Digital output pins, which shuts down the Raspi......
Thanks to the great folks on the Arduino Forum (UKHeliBob & Robin2) I learned that when the Raspi talks to the Uno via the USB cable it includes resetting the Uno which resets the Digital pins......
What I needed to do was to talk via the 3 wire Serial (Tx, Rx, GND) between the Raspi & Uno and now no problems!!!!
You can see there is a purple and grey wire, as well as a Green/White pair  running from the Uno to the Raspi. The Green/White pair have a set of resistors to drop the Uno 5VDC down to the Raspi 3.3VDC for the Serial comms. the other wires are the ground connections (1 redundant)

So it is a bit more work, to use the USB cable to program and then switch over to the 3 wire serial for comms, but really to see it working properly is not problem at all!!!

No comments:

Post a Comment