You Are Here: Home » AVR ATmega Projects » Motor Projects » Building the I2C Smart DC Motor Controller with Atmel AVR Microcontroller – Part 1

Building the I2C Smart DC Motor Controller with Atmel AVR Microcontroller – Part 1




The idea of building my own I2C (read as I square C) smart DC motor controller is came to me when I was learning and playing together with my son on his LEGO® MINDSTORM® NXT 2.0 about a year ago. The NXT sophisticated controller also called NXT Intelligent Brick is powered by Atmel 32-bit ARM7 AT91SAM7S256 microcontroller and communicating with Atmel 8-bit AVR ATmega48 acting as a co-microcontroller using I2C protocol. This NXT co-microcontroller main function is to help handle some of the NXT I/O special task i.e. power management, reading buttons, analog’s input sensors and control to the motors. The following picture shows my version of the I2C smart DC motor controller which is power by Atmel 8-bit AVR ATmega168 microcontroller:Building the I2C Smart DC Motor Controller with Atmel AVR Microcontroller – Part 1

The advantage of separating this special I/O task to the co-microcontroller is to release the main microcontroller from the hungry resources task such as generating the required Pulse Width Modulation (PWM) to the motor and reading the analog input, therefore the main microcontroller could be used to do other important task. This I2C smart motor controller which has these following features:

  • Communicate with a standard I2C protocol to the any smart controller (e.g. microcontroller based board or microprocessor based board) that supports I2C protocol.
  • Driving two DC geared Motors simultaneously which maximum current up to 1 A, maximum voltage of 20 volts
  • Separate PWM for each motor for precision motor steering
  • Build in steering routine such e.g. forward/backward, turn left/right, rotate left/right, and arc left/right
  • Support unlimited, timed (in second), rotation (with wheel encoder), and degree (with wheel encoder) wheel movement
  • One channel precision 5 volt Servo Motor Driver
  • Two Interrupt input channel for wheel encoder
  • One 10-bit analog input channel
  • TTL UART communication, implemented for debugging purpose

I will split this project into 3 articles (part 1 to 3) and as we move to implement more complex features, the firmware will be slightly modified to support the additional features, and finally we will use a different type of master controller board to experiment with this I2C smart DC motor controller as shown in this following picture:Motor Building the I2C Smart DC Motor Controller with Atmel AVR Microcontroller – Part 1

This I2C smart DC motor controller project also serve as a basic knowledge required to any microcontroller enthusiast or hobbyists to start their own embedded system application design. Ok let’s take a look at all the electronic components and software required to develop this project:

  1. Resistors: 10K Ohm (6), 330 Ohm (1), 1K Ohm (4)
  2. Capacitors: 0.1uF (7), 0.01uF (1), 22pF (2), 100uF/25v (1), 10uF/25v (1)
  3. Inductor: 100uH (1)
  4. Crystal: 16 MHz (1) used for external clock
  5. Diode: 1N5817 (1)
  6. LED: 3mm blue (4), 3 mm red (1)
  7. One 5 Volt Regulator IC LM7805
  8. One Atmel AVR ATmega168 Microcontroller
  9. One L293D Push Pull Four Channel Motor Driver
  10. One Tactical Switch
  11. One standard size Breadboard
  12. Adequate jumper cables for bread boarding
  13. One USB to UART converter for debugging
  14. Atmel AVR Studio 6.0 for coding and debugging environment
  15. Atmel AVR Programmer such as Atmel mkII programmer
  16. 5 Alkaline AA battery (7.5 volt) or two 18650 3.7volt Rechargeable Lithium battery (7.4 volt), or any adequate 7.5 volt regulated DC power source.
  17. Atmel AVR ATmega168 and L293D Datasheet
  18. The complete electronic schematic file (PDF) for this project

The following is a simplified version of the I2C smart DC motor controller electronic schematic used in this project:Schematic Building the I2C Smart DC Motor Controller with Atmel AVR Microcontroller – Part 1

For more detail: Building the I2C Smart DC Motor Controller with Atmel AVR Microcontroller – Part 1

Leave a Comment

You must be logged in to post a comment.

Scroll to top