In my prior blogs (Mr. Machine gets an upgrade - working on the pieces. , Mr. Machine gets an upgrade - new internals, motors installed and new PCBs , Mr. Machine gets an upgrade - time is running down and Mr. Machine gets an upgrade - New boards, but not enough time ) I walked through Mr. Machine's history and some of my updates. This time (for the second time, thanks to a extended due date, thanks Tariq) I will wrap up what I can as the project14 deadline closes.
For the most part I have written enough code to exercise the basic functions of the three boards that make up Mr. Machines electronics. There was a fair amount of hacking involved to get some of the functions to work and the once pristine PCBs look like that have survived a war. The most glaring of errors occurred in the LED dimmer circuit. I have used the dimmer chip (TLC59731) before in another product, but it was a single LED channel. In copying the circuit (which I designed a few years ago), I failed to remember that I single MOSFET in the serial path was both a switch (to suppress other serial traffic) and an inverter. The inverter is used to invert the uart output to match the requirements of the dimmer chips requirements, so without it, I was unable to program the LEDs. Also, due to the use of multiple LEd dimmers I needed to work out a method of injecting a fixed width low signal between programming bursts. This one took a bit of head scratching, but I ended up using a time interrupt to signal when the serial stream should resume. Here is an image of the PCBs prior to putting them all back into Mr. Machine:
Here are the PCBs getting attached to Mr. Machine's internal frame:
From here the internal frame (with attached electronics) was fitted into Mr. Machine's plastic skin. It was during the assembly process that I ran into a problem. Mr. Machine's old winding key was supposed to be repurposed into an on/off switch. But once everything was in place (and because of the rework on the backside of the Power Pack, I noticed that the micro switch was push away from the cam assemble that should have pressed and released the switch. I tried to shim and reposition things. but I was unable to come up with a clean solution. With the deadline rapidly approaching, I decided to leave the key assemble out and I would use a pencil through the key hole to press and release the switch. One mission objective scratched.
Speaking of scratched mission objectives, here are a few other features that fell off the table as I struggled to get some of the most basic features working. Here are a few of the missing and/or limited features:
- Motor control - I had initially written a complex motor control function that included ramp up/down stepper controls and a multiple state state machine, but the debugging process was not going well, so I stripped the functions out and quickly wrote some simple code to read the R/C receiver outputs (direction/speed and turning) and convert them into appropriate stepper motor pulse patterns.
- Front and Rear IR sensors - I ran out of time to code the fail safe stops and inhibits associated with the sensors, so they were left off.
- LED light during movements - I had previously scratched the idea of getting LED lighting cues from the Midi player, but again with time running out, I left off any LED sequencing when Mr. Machine was moving. I did a short LED sequence on power up for each board (shown below), the more impressive light show will have to wait for later.
- Winding key on/off switch - The final fit of all the pieces killed this feature. I need to use a pencil to reach into Mr. Machine to reach the tiny micro switch to turn him on and off.
With everything installed inside Mr. Machine, it was time for a couple of quick (uneditted and very raw) videos of Mr. Machine in action. First up is a video of Mr. Machine motors running on my desk top/workbench. This video shows the speed and direction control of the two stepper motors.
Next up is a power up sequence, followed by the Midi file player playing "This Old Man" (a very fitting song given the creator of this project). (Note: the audio is a bit distorted, but the case also seem to cause some resonance issues)
Finally, the proof video of Mr. Machine in motion. I really struggled to speak in this video as I was rushing about trying to get things running and my brains were a bit scrambled. I did experience some issues with the motors during this video. I believe that these motors (even with their gear reductions) were a bit over loaded (not enough torque), but I does demonstrate forward/reverse and turning.
Once again, I would like to thank Tariq and the rest of the staff at element14 for givings us all a great place to gather and the opportunity to exercise our creative juices. I had so much fun working on this project and I look forward to tuning this all up and working out the remain bugs and completing the features that did not make it in yet.
Note: attached are all of the source files for the various processors and PCBs.
Thanks and enjoy!
Top Comments