Introduction: How to Make Small Robots With NRover Board
The nRover, is a small board designed to build small robots like UGV (unmanned ground vehicles), line follower or to home automation, it can be controlled by wifi, Bluetooth or radio control.The main goal is the development of a small solution with electronics components, cheap, easy to find and that can be built for anyone with small expertise in electronic assembly.
The first version of this board was used in my final graduation project of industrial mechatronic, the goal of this project are:
• Microcontroller with 8 bits and clock frequency from 16 to 20 MHz
• Easy to find, easy to mount and soldering components (no SMD components).
• Only three ports of the microcontroller to control two small electric motors leaving free more ports to other use.
• Small size compatible with Arduino shields.
• Operating voltage 7.0 to 15 V.
There are a lot of shields for Arduino with the function to control small electric motors, but some of them employ surface mount technology, that can turn a task to replace a damaged component, hard and costly, because they need special tools and expertise, moreover in some countries these components are not so easy to find.
Basically, the board is compound by a microcontroller Atmega 328P and an h-bridge L-293D, besides of the passives components, with this configuration it can control two small electric motors, using only two ports of the microcontroller to change the direction of rotation (ahead and backward) and one pin to change the speed of rotation (PWM), leaving the others ports of the microcontroller free, to use in others applications.
Step 1: Programming Interface
The code can be upload by an Atmega programmer using the interface of the Arduino, Processing or with the Atmel Studio.
Step 2: Size
The nRover board has the same size and ports of the Arduino board, the power source may be from 7 to 15 volts and can control electric motors from 3 to 12 volts.
Step 3: Main Components - Microcontroller Circuit
The Atmega 328 microcontroller is an 8 -bit RISC architecture manufactured by Atmel. It is one of the most popular microcontrollers because of its use and dissemination in Arduino boards, a platform open-source code for electronic prototyping which has as main features the flexibility and use of hardware and software easy to use and learning.
Step 4: Main Components - H-Bridge Circuit
The L293D is a quad push-pull drivers capable of delivering output currents to 1A per channel (peak), it has internal freewheel diodes (snubbers diodes) to provide protection in an inductive circuit.
The function of flyback diode is to minimize inductive voltage spikes, this voltage generated in some cases can exceed hundreds of volts. The advantage of using the L293D, due to the fact of the flyback diodes, are integrated into this integrated circuit, facilitating and reducing the dimensions of the final circuit board to be constructed.
Step 5: Main Components - Inverter Circuit
Between Atmega 328 and L293D, has a logical inverter made with two transistors BC548, the function of this inverter is to provide the logic levels required to change a direction of rotation of motors, in an arrangement in which use a smaller number of ports of the microcontroller. Without this arrangement, would be necessary four ports of the microcontroller, to change the sense of rotation for only one electric motor.
Step 6: True Table
To increase speed, just increase the PWM signal, to stop the motors cut off the PWM signal.
Step 7: The AVR Programmer
The microcontroller can be programmed with a Avr programmer , a small circuit which simulates a virtual serial port based on the STK500 development kit (Atmel), connected to the PC USB to pin PB3 (MOSI), PB4 (MISO) PB5 (SCK), and RESET, transferring the program to the flash memory of the microcontroller (hex format file).
Step 8: Schematic
Step 9: List of Materials
Step 10: Assembling
Its is easier starting with the big and heavy components like screw terminals, DIP Sockets and the voltage regulator (LM7805), they attach firmly and you don't have to turn the PCB every time to solder it.
Step 11: Assembling Components
Some components have polarities like capacitors and diodes, the figure above shows how to assemble correctly.
Step 12: Assembling Reset Switch and Others Components
Others, like reset switch if assembling in a wrong way , will make the circuit inoperable the figure above, shows how to assemble correctly, resistors don´t have polarity, the microcontroller (Atmega 328P) and H-bridge (L293D) have a "dent" or small dot to show the right side .
Step 13: How to Program
To program the nRover board, you need a USB Atmega Programmer, this little device cost about $4,00 and can be found at any electronic store or websites like Ebay.
- The red strip must be aligned with the pin 1 of the nRover.
- Connect the USB Atmega Programmer to computer USB and install the driver that came with the device, after this, a new virtual COM PORT will be created.
- Power up the nRrover with a minimal of 7 Volts.
Step 14: Programming the Fuses
Fuses determine how the chip will act whether it has a bootloader, what is its speed and voltage. We need to change only one fuse what sets its frequency of operation, every Atmega 328P microcontroller, comes with 8MHZ from the factory, to set from 8 to 16 or 20MHZ, only change the LOW FUSE from 0xC2 to 0xD7, to do this use the Avr Studio.
- Open studio Atmel go to TOOLS-DEVICE PROGRAMMING.
- In DEVICE PROGRAMMING chooses Atmega328P
- TOOL generally is STK500, Avr Studio detects automatically, click APPLY
- Go to FUSES, a new Atmega 328P comes from the factory with 8MHZ, change the LOW FUSE from 0xC2 to 0xD7, after this click in PROGRAM, and it is done.
Step 15: Using the Arduino IDE
The latest version of Arduino IDE has some problems with Arduino-like boards, so it's necessary to employ an older version like 1.05r2 (https://www.arduino.cc/download_handler.php), to customizing the interface its necessary change two files, BOARDS.TXT and PROGRAMMERS.TXT, generally locate at C:\Program Files (x86)\Arduinoold\hardware\arduino.
1- open the BOARDS.TXT in notepad and add these lines: ##############################################################
nROVER16MHZ_328.name=nROVER v3.0 ATmega328P 16MHZ Programmer nROVER16MHZ_328.upload.tool= nROVER16MHZ_328.upload.maximum_size=32768 nROVER16MHZ_328.upload.maximum_data_size=2048 nROVER16MHZ_328.build.mcu=atmega328p nROVER16MHZ_328.build.f_cpu=16000000L nROVER16MHZ_328.build.board=AVR_nROVER16MHZ nROVER16MHZ_328.build.core=arduino:arduino nROVER16MHZ_328.build.variant=arduino:standard
2-open the PROGRAMMERS.TXT in notepad and add these lines:
avrispv2.name=AVRISPv2 avrispv2.communication=serial avrispv2.protocol=avrispv2
OBS: this step depends on the type and version of your USB programmer and it´s not necessary in some case because it´s compatible with the programmers already in the IDE interface.
Step 16: First Program in Arduino IDE
This little program show how nRover works:
pinMode (7 , OUTPUT);
pinMode (8 , OUTPUT);
//pinMode (6 , OUTPUT); //PWM control this line is not necessary it is here only for educational purposes//
digitalWrite(7, LOW ); // put PD7low level
digitalWrite(8, LOW); // put PB0 low level
analogWrite(6, 90); // PWM control analogWrite values from 0 stopped to 255 max speed
Atmega328P pin PD6 AKA (Arduino digital pin6) is a PWM port, controlling the speed of electric motors, from 0 (stopped) to 255 (max speed) in this case in a low speed (90).
Atmega328P pin PD7 and PB0 AKA (Arduino digital pin7 and 8), are controlling respectively the electric motor 1 and 2.
So, to raise the speed, raise the analogWrite value, to stop the motors drop the analogWrite value until 0, to change the rotation sense, change the digitalWrite values ,(7 for motor 1, 8 for motor 2) to LOW or HIGH, like explained in the true table.
Step 17: Examples
Controlling using serial communication or Bluetooth, the right side electric motors were connected to MT1, the motors of the left side to MT2 connectors.
The RX/TX pins of nRover were connected to a Bluetooth Module.
Attached to this instructable all files to make the PCB(optimized version), one recommended service is OSH PARK.