I am not an electrician. I am a psychologist. But the beauty of the Maker-Culture is also that the invitation to play around with electronics is getting much broader than it used to be – even i can design a circuit, program and let complex machines interact. Wait…
But i tend to not take things too seriously – power needs for instance. So i wired together a complex machine (the TweetConverter, will be covered later) with a Raspberry, that is connected to two Arduinos and controls two water-pumps and a thermal printer. Look at the beauty of my wiring:
This machine will be used during a conference that will take place in Berlin on October 1st and 2nd – three days from now. And yesterday evening i decided to do a full test for the first time – all the components had been developed and tested separately, also the connections between them, but i never did a full run of all systems in parallel.
So i did it and then something strange happens. Everytime the thermal printer printed something, the loudness sensor (which is designed to measure when a ballon bursts) sent a signal to the Raspberry although he shouldn’t. I checked everything to find out what was going wrong, it took me hours but i still had no clue. The more i cut the machine down into pieces again to track the error, the more it became clear: even if i powered the pump completely separated from the other stuff with it’s own power-supply, all GPIO-connections cut etc. the phenomenon stayed: Whenever the pump was activated the sensor “thought” it sensed something. The only way to make it disappear was to connect the pump into a different power-outlet at another corner of the room! Electricity! I knew that connecting components like motors can have some issues because they are emitting peaks through the wire when started or stopped. So i first began to separate my circuit, namely the Relay-Board. A very good guideline can be found here. But the problem remained. And btw. i stumbled into even more delicate problems (but i knew them already) when ground was not connected properly through all the devices – this also could lead to very strange behavior…
The only way to solve the problem was to get rid of the Interrupt-Handling of my GPIO switch that was waiting for a signal from the noise sensor (connected to the Arduino). Instead of using “GPIO.wait_for_edge” which provides you with an elegant way to avoid the trigger to bounce i switched back to the more basic listening to the GPIO in a while-loop. Obviously the IRQ-Handling of the GPIO on the raspberry tends to overreact a little bit.
Another problem that i had to solve was power-requirements. My project needed 12v (for the pump) and 5v for the rest. And i had a huge power-supply lying around which could actually provide both voltages – beautiful! But then problems occured. The printer did some strange printing. Sometimes the Raspberry rebooted without a cause. After hours of trying to find the problem i looked at the bottom of the power-supply and saw that it indeed could provide 12v and 5v, but only 0.5 ampere for 12v and 1 amp for 5 volt! The Raspberry alone required roughly 1 amp when a few things are connected (i had two LED-rings on it for instance). The printer required 1.5 amp while printing. So i completely rewired the power-circuit, used another power-supply for the 5v circuit (whith 4 amps!) and suddenly a lot of strange problems disappeared like magic.
My learning from this: mind the basics! Connect ground properly. Check power-consumption/requirements and use a power-supply that can handle them. Be prepared for electrical inferences and use thicker wires, shielded if possible for components like motors, pumps etc.
And if your installation shows a very strange behavior – instead of reading your code over and over again – perhaps you just missed to connect one ground cable (or did it twice).