I finished the code this late afternoon, I’m fairly happy with it. I think I hit all the goals I set for myself (interrupt driven, uses the embedded ROM API and is fairly modular). This evening I started to hack it all together. The end result works much much better than the last design. It’s not as pretty, but it works! I’ll get a video up soon, once I figure out how to do that. Here’s some photos in the meantime…
In “Standby Mode”, note the red led. Pressing the push-button will toggle the device On and Standby. The power switch on the development board will turn the device off completely. Once On, the potentiometer knob acts as speed control. It sends an analog voltage to the MCU, which is captured, digitized and used to set the duty cycle of the PWM signal going to the motor driver. A few other GPIO outputs to control direction and braking, and it’s a nice little bit of control. Place a BB in the hopper and the centrifugal force (if that’s the right term) of the oscillating spiral shoots it out the end.
Here’s a close up of the motor rigging. I just used what came to me first. That’s why the free spinning stabalizer is an old chair caster I had in a box of junk. The box, motor and wheel are from an inexpensive Actobotics chassis from Frys. The baseplate is from a Sparkfun: Red-Bot chassis. The end game was to put this bad-boy on the rest of the chassis. The problem with that is that the bot is too light and ends up bouncing all around. This was not exactly a precision build, and everything I used from the robot chassis’ can go back to what it was originally made for. There’s a good amount of slop which means a lot of unwanted wobble/vibration. The point was to get it to work first. If it were going to be made permanent, it would be made much tighter.
I ended up using my soldering iron with a wide tip to weld the two halves of the spiral together. Super glue just wouldn’t cut it and I knew heat would work. I did my best to keep the nylon vapors out of my lungs; we’ll see how that went in twenty years.
Get to the Hopper! <Predator was on television earlier this week, so that’s stuck in my head> I ended up making a hopper for the BB(s), since it was rather difficult to get them in to the start of the spiral. Again, not pretty, but it works well enough. I will by some “ammo” tomorrow to see if it can handle more than a few…or maybe I’ll take a part some more bearings tonight…hmmmm.
This was nice too see during the code writing process. Got it right the first time. I set the duty cycle to 50% at a switching frequency of 250Hz, and that’s exactly what my logic analyzer showed me I had. Turning the pot [knob] was changing the duty cycle but not the frequency, just as expected. Very good feeling to get it right. In fact, as soon as I made a real plan for this project, it all fell into place.
I’ll play around some more, figure out video and give another update tomorrow.