This build consists of a tiny DC motors ripped from a pair of 9g servos, a h-bridge motor controller, an el-cheapo 8 bit pic and a 100mAh 3.7V LiPo battery.
Circuit :
(click schematic for pdf)
Code:
//wattnotions 7th August 2015 //compiled with xc8 compiler //program to provide pwm signals to motor driver #include <xc.h> #include <pic16f690.h> void delay_ms(unsigned int n); int main(void) { TRISB = 0b00000000; PORTB = 0b00000000; TRISC = 0b00000000; PORTC = 0b00000000; while(1){ PORTBbits.RB4 = 1; PORTCbits.RC2 = 1; delay_ms(1); PORTBbits.RB4 = 0; PORTCbits.RC2 = 0; delay_ms(4); } } void delay_ms(unsigned int n) // with fosc = 4ms this should give around 1ms.....probably { while(n--) { _delay(250); _delay(250); _delay(250); _delay(250); } }
What’s coming next
The problem with using these dc motors is that they have a very high rpm. Without a gearing system to reduce this the car is pretty hard to control with any accuracy. This version was intended as a prototype to test the idea of making a really small robot. I’ve ordered a boat load of tiny stepper motors from aliexpress, they should be here in a few weeks. Matchbox Car v2 will use these stepper motors to allow for more accurate movement (eg turn 90 degrees right, go forward 30cm etc). The next version will also include a small reflective sensor consisting of an infrared diode and receiver pair. This will allow the robot to detect obstacles a few cm in front of it and avoid them. The robot is currently using the front of the matchbox as the front wheel, this is not a great solution so some investigation into other options is probably a good idea. I was thinking maybe a small ball bearing or something like that…..
Nice ! Which stepper motors did you order from Aliexpress ? Also were u able to find a gear system to small enough to fit in there ? I’m also looking for these components
Thanks! I got an assorted box of micro stepper motors http://www.aliexpress.com/item/NEW-5pcs-each-of-10-types-50pcs-totally-4-Wire-2-Phase-dc-micro-stepper-motor/1956048112.html?ws_ab_test=searchweb201556_6,searchweb201644_5_505_506_503_504_301_502_10001_10002_10017_10010_10005_10011_10006_10003_10004_10009_10008,searchweb201560_3,searchweb1451318400_-1,searchweb1451318411_6450&btsid=641ea82e-a192-4671-adaa-28143ab3efbd didn’t find a gear system small enough in the end but I don’t think you should need gears if you manage to get the stepper motors working 🙂