Matchbox Car v1

IMG_20150808_132731

IMG_20150808_132820

IMG_20150808_132911

IMG_20150808_132857

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)

sch

board

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…..

Downloads

Google Drive folder with board artwork and code etc.

This entry was posted in Hacks, Hardware, Ideas, Microcontrollers, PCBs, pic microcontrollers and tagged , , . Bookmark the permalink.

4 Responses to Matchbox Car v1

  1. Pingback: Matchbox car - Electronics-Lab

  2. ankit1985 says:

    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

  3. Pingback: Adorable Matchbox Robot | Ad Pub

Leave a Reply