This week was about making microcontrollers talk to each other, and working on the final project.

I made new boards based on the goals from last week: servo signal on hardware PWM and current sensing resistor (potentially useful design detail side note: the programming header section can be cut off the board to make it smaller once the code is finalized, and there is a footprint that can accommodate multiple sizes of resistors, because I was waiting for high power current sensing ones to arrive and stacking multiple 1 ohm resistors in the meantime).

This week involved a LOT of debugging of one mysterious problem after another. Progress was slow, but solutions were illuminating.

1. If the communication back to the computer via FTDI cable only works when the FabISP is plugged in, wire the grounds from the FTDI cable and your power source together (doh!).

2. Servos (or at least the HS-311) do not take kindly to even slightly more than 6V.

3. When using an external clock, double check the F_CPU parameter in the Makefile.

4. Hardware PWM is easier than software PWM.

5. The oscilloscope is your friend.

6. Finally, if the communication back to the computer via FTDI cable only works when the FabISP is plugged in EVEN IF IT IS NOT POWERED, add a diode somewhere (still completely stumped on this one).

But at last, blinking happens!

Note testing setup with components velcroed to my desk for quick reprogramming (thanks Adam Setapen for taking the great pictures):

This is running the serial bus code adapted for my boards, so the computer can send them the length of the loop to play (when the audio clip is changed) and possibly so they can update each other when one of the contact points on the face is moved. The challenging part turned out to be communication back to the computer, even though I had successfully made that work during the input devices week. The problem turned out to be that I had not wired the grounds of the FTDI cable and battery together (last time I did not use an external power supply).

I also *finally* got the boards talking to a servo (see points 2, 4, and 5 above).

I was then able to measure the voltage on the sense pin connected to the servo ground and power resistor with a multimeter and could see a clear jump when the servo was backdriven. I am still having trouble figuring out how to set the reference voltage for the ADC to 1.1V, read from the appropriate ADC register, and print to the serial port to see what the values look like.

Here is my prioritized semi-triaged to do list for the final project (a customizable facial expression sequencer robot, using servos that can detect when they are being backdriven so the expressions synced to an audio track can be changed in real time):

    • Cut faceplate (where other elements will be mounted, already designed).
      Cut servo and phone brackets.
      Sense current from microcontroller pin.
      Sense potentiometer from microcontroller pin (change reference voltage and make sure the timing works with the servo control).
      Record a sequence of positions.
      Play back a sequence of positions.
      Sense backdriving and stop servo playback, let go of servo.
      Detect when servo released.
      Integrate interruption, recording, playback loop.
      Cut and attach skeleton (to hold up fabric over curves of face).
      Make removable face cover.
      Mold and cast body.
      Interpolation between servo sequence points.
      Add ability to send a serial message to change the length of the sequence.