during the work on trashbot v1 and rofi, i noticed that robots get seizures when powered up (see the second video in this post for examples). this is obviously because the arduino’s outputs are not in a defined state for a brief time and the servos also get power already leading to outputs sometimes firing until the arduino has loaded its bootloader and executes the user’s code.

some discussions on the arduino forum and on google+ revealed that it might be helpful to add a relay.

so i ordered some JQX-118F relays from www.pollin.de that cost 1.95€ and switch by 5 volts.

here’s my first experiment, simply switching switching one led off and the other on. relays usually switch from one contact to another, meaning that even if the relay coil isn’t powered, there is a default state for both switches (one is on, one is off):

next i wanted to document how actually the servo moves into undefined positions when powered up, so that we see that this is a real problem to solve (yeah, i know that the 2s / 7.4v lipo may be too strong for the mg996r servo, will add a ubec soon):

okay, so finally, we add the two together and use one arduino output to control the relay coil, the relay coil then will switch the power to the servos. i will to this for the whole power rail feeding all the servos of the robot so that i only need one relay and one digital out of the arduino nano. let’s see how it works:

i will add the relay now to trashbot v2’s circuit and see whether there will be any more problems afterwards. i’m not sure whether i need something more (apart from the missing ubec to reduce the voltage for the servos) like diodes (coil loosing power gives it back to the arduino? or not strong enough?) or pull up/down resistors (have to teach myself what that’s all about next). but for now, i’m happy to see it working.