ATmega 8 based self driving car.
Watch the YouTube video to develop some comprehension.
The ATmega 8 is programmed using an ICSP programmer. In my case, I used an Arduino UNO as an ICSP programmer. By default, the microcontroller uses the internal 8MHz internal PC oscillator, but we want to use an external 16 MHz oscillator. So we need to make certain changes to the fuse bits of the ATmega 8. Below are the steps to do so:
- Download and install AVRDude. AVRDude is the program used by Arduino IDE and PlatformIO to upload your code to an AVR microcontroller.
- Open up the Arduino IDE, select
ArduinoISP
under File/Examples/ and hit upload. - Wire up the Arduino and ATmega8 as shown in the schematic:
- By default, the low fuse of the ATmega8 is set to 0xE1. This must be set to 0xE4 to configure the microcontroller to run at 8MHz. Type
avrdude -c stk500v1 -P COM5 -p atmega8 -b 19200 -U lfuse:w:0xe4:m -U hfuse:w:0xd9:m
. Alternatively, you can use an online AVR fuse bit calculator for your selected microcontroller.
The -P <port>
argument specifies the connection port. In my case, the arduino is connected to COM5
and hence the argument -P COM5
. For -p <partno>
either -p m8
or -p atmega8
can be used. Refer this guide for more information.
- That is all. The ATmega8 is now ready to be programmed with PlatformIO using the arduino as an ISP programmer.
You can find the component list here.
The case along with the motor is available here: https://quartzcomponents.com/products/2wd-smart-robot-car-chassis-kit
MOC7811 optical encoders: https://quartzcomponents.com/products/moc-7811-encoder-sensor
HCSR04(Ultrasonic sensor): https://quartzcomponents.com/products/hc-sr04-ultrasonic-sensor-module?_pos=1&_sid=1f37cc7e0&_ss=r
Ultrasonic sensor mount: https://quartzcomponents.com/products/ultrasonic-sensor-mounting-bracket-for-hc-sr04?_pos=3&_sid=1f37cc7e0&_ss=r