Hi again, after the summer! It’s been a busy start for the new academic year, but now I thought I’d show you a little problem I had playing with the Arduino
Remember the 8mm scanner I built? It worked fine when I got it running in the spring, but just before the summer break it stopped working.
I checked the code and the connections, and I couldn’t find any problems. As you may remember, it has two servos – one for rotating the film gate, and another for rotating the film takeupo spool. It worked if I only had one servo connected, but not with both at the same time. This led me to believe I had the servos broken somehow. I borrowed a couple of servos from Tero Karvinen, and tested with them, and the result was the same; only one servo allowed at a time.
This is where I went wrong. I assumed it must be a problem with the code, because I did a couple of fine tuning operations with the code, before it stopped working. I found I had no backups of the code before the changes, so I spent much time reading the code and trying to remember the values I had before the problems.
I then started a fresh file, pasting in only required parts of the code, trying to build the complexity up bit by bit. This worked to the point that I added another servo, at which point it fell flat again. I was tearing my remaining hair out in desperation.
This video shows what happened, first the proper operation, then the failure:
It only occurred to me after school had started that maybe it isn’t a problem with my Arduino at all. It may be that the two servos draw too much current from Arduino and it cannot function. It is exactly for these purposes that Arduino has a power plug.
You can supply Arduino with adjustable voltage between 5 to 12 volts. Anything over 12 will fry it, so it’s not a very good idea. I walked to Clas Ohlson and bought a 6 watt, adjustable power source. It gives 1200 milliamps at 5V, which is more than enough for my purposes. I got back to the office, plugged it in, and hey presto – it worked again. Silly me for assuming it is a code issue, when it wasn’t code or even hardware. It was pushing Arduino out of its envelope.
The reason for all this happening is twofold:
- I was given a new power source for the computer I use at the University. Its rating is actually a little less than the one I had before.
- I had plugged in two new USB devices into the system, thus drawing more current from the USB hub.
The sound you hear in the latter part of the video, the 3 tone USB unplug tone, was actually the key to moving forward. As soon as you hear that, the Arduino programming environment loses communication with the unit, and the unit stops working properly. If you check the environment for the USBs, the unit is nowhere in the list. I tried many ways of checking the USB ports’ existence, and that was yet another waste of time. It was just a question of Arduino getting stressed and retreating into a melancholy brick state.
So, the bonuses and upsides from all this are threefold. First, I learned once again that connecting stuff to the computer can bring about unexpected results elsewhere. Second, I understand Arduino’s operation that much better again. And third, this got me into building a portable power source for it.
A 9 volt battery is a good choice for powering the Arduino, so I got myself a plug that has the plus lead in the center of the plug, and the minus on the outside. I also added a switch just for good measure, and of course, it’s 3D printed.
Next up – a two way tiltable platform for a web cam, for example. Stay tuned.