There are so many exciting toys to play with and I want to try them all. But in the end I settled for Charlieplexing and Servo. Really wanted to understand whats going on in charliplexing and to get experience with PWM.
For charlieplexing I just wanted to do a simple board with 6 LED so I can easily grasp the concepts and programming part but then the classic, and so dangerous, feature creep happened. Some how I ended up making a binary wrist watch... so of to Kokopelli and start coding.
I used Neils hello.array.44.cad as a starting point. But re-arranging the LED was not as simple as I first thought it to be. After some hard work and a lot of cross referencing (thanks Francisco) I got it all placed out. I added a battery and a switch for it so I can cut the power connection when programming it. I also added a Button to be able to set the time.
Kokopelli have no pads for the battery or the switch I was using, but since this is a one time use (I hope) i did not take the time to custom make them. So eye balling it first placing traces where I wanted the battery but what I first did not realize was how big the 3V battery is compared to the other components... almost as big as 3 buttons! So a quick .png export to gimp for control measuring the pad size and back to Kokopelli and redesign. In the end I want to have the battery covering the resonator to save space but thought that this first prototype should have easy access.
Loading the Make file I got a:
Internet recommend the following solution:
"Error 1" for "avrdude: initialization failed, rc=-1 Double check connections and try again" is one of the most common problems you will encounter when trying to send the program to the board. This can happen most certainly because of a hardware problem, so:
I made sure the cable was all the way to the bottom and they where not, could hear a small click as it settled. Tried again and now the fuse was a success, but the celebration came to a abrupt stop when I tried uploading the the C code and got the same rc=-1 error again.
Next step was to swap micro controller but that made no difference so I tried changing the programming cable and now it worked every second time.
Then Francisco "Eagle Eye" Sanchez came by and noticed that I had forgotten the ground wire for the resonator, and guess what... I could upload code! I turned the switch to power the board with battery and... nothing happened... until i pressed the button. Very dim lights as probably because I followed Neils schematic where he is powering it with 5 V and I am powering it with a 3V battery. So back to the soldering station.
Changing from 499 to 100 ohm resistors made the LED glow brighter but why did I have to press the button to get it to work!? Some further investigation revealed that I had forgot the ground connection for the micro controller.
Some of the LED don't light up, not sure if it is the code that have to be modified or my rearranging of LED that broke it?
I came back to this board in week 15 trying to fix it. After some serious debugging, comparing and voltage meter action I finally found the error. Had two extra wires coming out from D54 that should not bee there.
Working backward through the spiral development cycle I decided to simplify and make a simple charleplexing board. I did not feel I really understood the connections by modifying Neils board so this time I would make one with only 6 LED and a button. The goal being to end up with a code breaker puzzle board. Kind of like a low tech one button blip game.
Having sat down, drawing out the schematics and the wiring on paper I finally understood how charliplexing works. From there it went quite quickly to build the board, stuff it and program it.
The shape for my Servo board where determined by what material was left on the PSC plate. Form those dimensions I design the board in Kokopelli.
I stared with a SpringRC SM-S4303R Continuous Rotation Servo The default rest point is at 1.5 ms pulses. Pulse widths above the rest point result in counterclockwise rotation, with speed increasing as the pulse width increases; pulse widths below the rest point result in clockwise rotation, with speed increasing as the pulse width decreases. I monkeyed around with the numbers until I found a mid point and an approximation of the the two extremes.
But the numbers did not add up so I check my PWM with an oscilloscope. My pulse width where double the length 40 ms so something off with the clock. I burned the boothloader through Arduino IDE. This changed it my pulses to 16 ms not 20 ms! ...so the timings are still off some how!
Next I switch to TowerPro SG-5010, a fixed angle servo and with the same code but some adjustments I got my center and the two 180 positions with.
Showing the five PWM steps runing on the microcontroller..