I am presenting a compact design of a stripboard Arduino board (DIYduino) that includes a 2A motor driver and has additionally the functionality of a sensor shield. The 2-channel version cost approximately $29.43 and is more affordable compared to $39.00 for a commercially available system consisting of an Arduino Uno, $21.50, a sensor shield, $8.50, and a motor shield, $9.00. The cost can be further reduced to $27.44 by building a “bare bones” version that omits parts that are not required for the functionality of the device but are rather added for convenience. Such parts are LEDs and their resistors and screw terminals.

I am presenting a total of five different versions:
1. DIYduino
2. DIYduino with integrated sensor and 1-channel motorshield - no speed control
3. DIYduino with integrated sensor and 1-channel motorshield - with speed control
4. DIYduino with integrated sensor and 2-channel motorshield - no speed control
5. DIYduino with integrated sensor and 2-channel motorshield - with speed control

My pictures represent the third version, which is the one I chose for a particular robot application that I am currently building.

Step 1: Parts List

The table shows all the parts for the devices including prices from Jan, 2013. I considered some of the parts, such as jumper wires or resistors, as standard inventory that is likely purchased in bulk and not as individual parts. Therefore I typically listed individual parts and noted with an asterisk when you would have leftovers, such as for example extra strip board which you can use on other projects.

I did not consider the prices marked with the single asterisk for the total price of the device. Further note that item prices at Newark drop when you order a certain number of parts, typically if you order more than 10x. I listed the highest individual prices here and also ignored any special offers or promotions. If you buy more the price will go down. On another note, not all of the parts listed here are really necessary for operation. The parts that you can omit are marked with a double asterisk. The 'bare bones price' is also indicated at the bottom of the table.

Last not least, the ATMEGA 328 that I used required a bootloader. I recently created an instructable called ArduinoISP Bootloader/Programmer Combination Shield that addressed how to upload a bootloader to a “virgin” ATMEGA. You can also buy ATMEGAs that have a bootloader installed. They are almost double the price. For completion I listed one in the table.

The component prices were taken from www.newark.com and www.mcmaster.com. You can find order numbers and prices in the table.

Step 2: Tools and Hardware

The picture shows most of the hardware that I used:
1) Solder iron & solder – to solder everything together
2) Carpet knife – to separate copper traces between holes
3) Hand saw with skinny blade – to cut strip board to size
4) File, not too coarse – to deburr strip board after cutting it
5) Wire cutters – to shorten legs of soldered electronic component
6) Fine tipped pliers – to bend component legs
7) Red, black, blue sharpie markers and pencil – to transfer layout to stripboard
8) Third Hand (invented by rstraugh ...thanks) – to hold parts and board when needed
9) Track Cutter (invented by scraptopower ...much obliged) – to separate copper traces at holes
10) Voltmeter with test leads – to confirm functionality of separation cuts and debugging
11) Scanned in strip board pattern – to develop stripboard schematic
12) ArduinoISP Bootloader/Programmer Combination Shield (not shown) & Arduino with USB to serial chip (e.g. Arduino Uno) - to upload the bootloader and sketches to DIYduino. You can also use a USBtoSerial programmer for uploading a sketch and work around the Bootloader Shield and use the DIYduino you build here to load the bootloader.
13) Cables to plug onto male/female connectors (not shown) – to make connections for testing
14) Variable power supply with voltage range of roughly 3V to 12V – to test voltage regulator and provide power to stripboard (not shown)
15) Computer with Arduino software – to test functionality of DIYduino & motor driver (not shown)
16) Drill and drill bits (not shown) – to widen/drill holes for stand offs and drill hole in heat sink

Step 3: Combining Schematics of DIYduino & Motor Driver

To create the strip board layout I determined the schematic I wanted to create first. You can essentially do a strip board design with any schematic no matter if you invented it, downloaded it, or re-engineered it. For me the official Arduino schematic was a tad too complicated and essentially overkill for my purpose. Instead I altered the much simpler schematic of the minimalist Arduino as shown in the first figure. This schematic was published and discussed on http://thetransistor.com/projects/arduino/.

In the schematic shown here I marked my changes in red color:
1. I crossed out the items that weren't part of my built.
2. I changed the values of the capacitors that smooth potential voltage peaks at the 5V regulator. These are the values that I had available in my stock and they'll do the job.
3. I crossed out the LED/resistor connected to Pin13 to safe parts. I only connected an LED/resistor temporarily to test the functionality of the DIYduino as described later.
4. I removed the +5V from the Aref as recommended in a comment with respect to this tutorial: http://arduino.cc/forum/index.php/topic,7569.0.html

Then I combined the minimalist Arduino schematic with a schematic of a L298N motordriver that I found on solarbotics's site. I did this by connecting L1, L2, L3, and L4 (L298N pins 5, 7, 10, & 12) to the ATMEGA's digital pins 7, 8, 13, & 12, respectively. Pins E1-2 and E3-4 (L298N pins 6 & 11) are connected to +5V for maximum motor speed at all times or to Arduino PWM pins 9 & 6 for adjustable motor speed, respectively. I am also showing the ATMEGA 168/328 pin map, which help me to assign the proper ATMEGA pins and which can be found at http://arduino.cc/en/Hacking/PinMapping168.

Step 4: The Stripboard Layouts

I took a paper copy of an empty stripboard and transferred the schematics onto it. The results – after several iterations – of all five versions are shown here.

A few specifics with respect to these layouts:
1. Red crosses are track interruptions placed at a hole location
2. Red lines are track interruptions placed between hole locations.
3. Blue lines are connections made on the copper side of the board.
4. Dashed lines are outlines of components such as ICs or connectors.
5. The sensor shield type connector rows are GND/+5V/Signal (GVS) on the left and Signal/+5V/GND (SVG) on the right side with respect to the ATMEGA. This means the signal row is always closes to the ATMEGA and the GND row farthest.
6. There is a pin to connect to the reset of the ATMEGA. This pin, together with adjacent pins Rx and Tx (pins 0 & 1), allows for programming the ATMEGA.

Step 5: Preparing the Stripboard

a) Marking the component positions:
I double and triple checked everything. Then I marked the locations of all parts on the top side of the strip board. I used red dots for all parts, blue crosses and lines for the track interruptions, black lines for the outline of the board, and black dots to override any errors.

b) Cutting out the board:
I took my handsaw and cut out the stripboard section that I needed for the build. I carefully cut from hole to hole, which is a fairly fast and easy process with a fine edged sharp handsaw. Subsequently, I deburred the edges carefully, to avoid sharp edges and shorts. I inspected all edges and traces to ensure that no traces were shorted.

c) Drilling holes for standoffs:
I chose a 1/8” (3.125mm) drill to fasten the standoffs. The nylon screws were M3 (3mm) which makes for a nice fit. I widened 3 holes at three corner locations where I had no conflict with any components. The fourth corner hole I moved outside of the hole grid, due to a conflict with one of the sensor type contact areas. I deburred and inspected the holes on the copper side to ensure I didn't create any shorts.

d) Attaching the standoffs:
I stuck the M3 nylon screws through the hole and hand tightened the standoffs on the board. As shown in the pictures, the board could now stand by itself and was ready to be populated with components.

e) Adding the track interruptions at the holes:
Next I took my fantastic DIY track cutter and put all the track interruptions that are located at holes into the board. During the process I stuck a wire every now and then through a marked hole to orient myself and to keep track of the correct locations. Beware that the layout shows everything from above, i.e. the non-copper side, but the interruptions are all put into the copper side. After I placed the interruptions, I used the multimeter to confirm proper track interruption at each hole. Better to be sure right away. It's much harder to fix a small mistake later.

f) Adding the line track interruption:
This is the most tedious part of the building process. Use the carpet knife to carefully cut the copper away between the holes. You need to leave enough copper around the hole so that you can still solder on the connector pins. Take your time and don't press too hard. With each cut you'll remove a small layer of copper until the copper is gone. Keep repeating the procedure until you get the desired result. Once you get through and get an interruption, take care to deburr the edges of the cut by scraping them carefully with the knife. Once more I made sure with my multimeter that I indeed successfully created a track interruption and didn't have any shorts.

Step 6: Building the DIYduino Section

a) Populating the DIYduino section of the board:
I placed the components for the DIYduino section first. This allowed me to test the DIYduino separately from the rest of the circuit. I started with the shallowest components, sticking them in, and soldering them before moving to the next component height level. If the components are of the same height you can just lay the board flat on its back for soldering and save some time and awkwardness. I found this to be a fast and convenient process. To ensure that the components don't fall out of the board, I bent the wires apart after placing them. This allows you to turn the board over for the soldering process.

b) Connections/components on the copper side:
I used several ways to create track to track connections at the copper side of the board.
(i) For the diagonal connection underneath IC1, I bent a wire so that it fit into the diagonal holes. A regular two hole jumper wire is too short, and a three hole one too long. Then I cut the ends of the wire so short that they didn't penetrate the board. The holes now held the wire in place for soldering the diagonal connection. Please note that the connection in the figure is not correct. It should go from lower left to upper right not from lower right to upper left as seen in the picture.
(ii) I tested two different ways to create the cross-track-connections for the sensor shield type connectors. Both ways were a little tricky.
If you are experienced in soldering you can solder the adjacent pins together, relatively quickly and painlessly. However, if you are not so experienced, or you don't have a good solder tip/iron, or you have a shaky hand, this bears the danger to create an unwanted connection to another pin, i.e. a big solder glob. To clean up this unwanted connection/glob can be pretty messy and frustrating.
The second way is to place a wire along the contacts you like to connect and subsequently solder it on. This typically guides the solder to the right spots. However, placing it and keeping it there can be difficult. Solder all contacts to the board first, then place the wire for the 'cross-connection', holding it for example with a third hand. Then you can solder it onto the contacts.
(iii) The button switch was a SMD mounting type. It was easiest to place it on the copper side of the board. I directly soldered it onto the track at the appropriate place.

Step 7: Testing the DIYduino Section

a) Testing the 5V regulator:
It is a good habit to test the functionality of the supply voltage first. I first ensured that I didn't have an ATMEGA in the IC socket. Then I took a variable power supply, switched it on, dialed the voltage to below 5V, and switched it off again. Next, I connected the voltmeter to the output of IC2 (7805). I switched the power supply on and slowly increased the supply voltage. While ramping up the voltage I compared the meter at the power supply with the voltmeter. Once the supply voltage exceeded 5V, I made sure that the IC2 regulated the voltage to 5V, i.e. I checked that the voltage at the voltmeter was 5V no matter what the supply voltage was. I confirmed stable operation up to the motor voltage I intended to use, which in my case was 12V. Note that you should never exceed the supply voltage above the maximum rated voltage of the 7805, L298N, or the diodes you used.
The board I built was a “Bare Bones” version, so I did not place LED1 and R1 on the board. If you do, LED1 should light up when IC2's output reaches 5V or even earlier. Please make sure that R1 is properly selected for your LED1 and a voltage of 5V. You can use https://www.instructables.com/id/Choosing-The-Resistor-To-Use-With-LEDs/ to determine how to do that.

b) Testing if DIYduino can execute a sketch:
I already had an ATMEGA328 with “Bootloader” and “Blink” programmed which I used to test the functionality of the DIYduino circuit. You can look at my first instructable to find information of how to load a bootloader and upload a sketch onto a blank ATMEGA328. For the test I connected an LED in series with a resistor to pin13 of the ATMEGA328 using the sensor type contacts. The LED/resistor pair was calculated for 5V. The LED anode (round side) was connected to the signal Pin13, the cathode (flat side) was connected to the resistor, whose other side was connected to ground. I made sure that the power supply, which was still connected from the previous step, was switched off. Then I plugged the ATMEGA328 that contained the Blink sketch into the IC socket and switched on the power supply. Sure enough the LED started blinking, which indicated that my DIYduino was up and running.

c) Testing if DIYduino can be programmed with this setup:
With the setup of b), an Arduino Uno, and a few wires I tested if I could send a sketch to my DIYduino. The Arduino was used as a USB to serial interface. Look at http://arduino.cc/en/Tutorial/ArduinoToBreadboard for more information.
To perform the test I:
   (i) Removed the ATMEGA328 that was on the Arduino
   (ii) Connected the following Arduino Uno to DIYduino pins: Reset/Reset, GND/GND, Tx/Tx, and Rx/Rx. (I connected GND to GND because I was using two different power sources for the boards, the variable power supply for the DIYduino and the USB cord for the Arduino.)
   (iii) Opened my Arduino Program “Arduino 1.0”.
   (iv) In the menu “Tools/Board” I selected Arduino Duemilanove w/ATmega328.
   (v) I started the “Blink” sketch by going to menu “File/Examples/1.Basics/Blink”.
   (vi) I changed the delays for the blinking process to 3 seconds off, 3 seconds on by exchanging:

void loop() {
  digitalWrite(13, HIGH);   // set the LED on
  delay(1000);              // wait for a second
  digitalWrite(13, LOW);    // set the LED off
  delay(1000);              // wait for a second

void loop() {
  digitalWrite(13, HIGH);   // set the LED on
  delay(3000);              // wait for three seconds
  digitalWrite(13, LOW);    // set the LED off
  delay(3000);              // wait for three seconds

   (vii) Uploaded the sketch with the arrow button and enjoyed a very slow blinking LED. This told me that the upload was successful and everything worked.

d) Testing if Reset button works:
With the LED blinking from the previous test, I pressed the reset button, that is located on the copper side of the board. The LED blinked once for a short time, then returned to the programmed blinking pattern. Since the reset button restarts the sketch that is loaded into the ATMEGA I took this as a sign for a successful reset.

Step 8: Building the Motor Driver Section

I repeated the steps described in Step 6 to complete the second part of the board. The stripboard pictures show board version 3, i.e. the DiYduino with sensor shield contacts and a speed controllable 1-channel motor driver.

a) The version in the first picture is missing R1 & LED1 (which indicate board power) but is, with exception of the heat sink, complete. It includes motor direction indicating LEDs 2 & 3, a screw terminal to connect the motor, and all sensor shield type sensors.

b) In the second picture you see the same board assembled for my current project in a bare bones version. This board forgoes the connectors for the analog input pins, LEDs 2 & 3, and the screw terminal. Instead of the terminal I soldered the wires for the motors directly onto the stripboard.

c) The L298N has a Multiwatt15 package. The 15 leads of the package do not all align with the 0.1” hole pattern of the stripboard. To align them, I inserted the eight front contacts of the package into the row of holes located closes to the edge of a stripboard as shown in one of the pictures, leaving the seven back contacts hanging over the edge. Then I pushed gently to the left until the back legs aligned with the front legs as shown in the next picture. I further visually inspected and confirmed with my voltmeter that I had no shorts between adjacent contacts.

d) The board has a heat sink mounted to the L298N using thermal grease. However, to avoid a conflict with ATMEGA pins 9 – 13 I drilled a second mounting hole into the sink to move the heat sink over.
Also, the heat sink had a groove for a TO-220 package size on it's standard mounting side. To use a flat contact surface for the significantly wider L298N I flipped the heat sink around so that the L298N contacted the back side of the heat sink.

f) All the layouts with the motor controllers have at least one diode mounted upright. For the version 3 board shown in the picture the upright diode had a conflict with the heat sink. To make it work, I bent the leads of this diode to lay it down more. This created a sufficient gap to the heat sink.

Step 9: Testing the Motor Driver Section

I tested the functionality of the completed stripboard using a sketch that:
1. Turns motor A in one direction for 3 seconds at reduced speed
2. Reverses motor A for 3 seconds at reduced speed
3. Turns motor A in the other direction for 3 seconds at full speed
4. Reverses motor A for 3 seconds at full speed
5. Stops motor A
6. Repeats steps 1.-5. with motor B
7. starts all over
The sketch is shown below and can be used to test board versions 2 – 5. Note that the motor driver board versions that do not have a variable speed option will always operate at full speed.

To test the board, I:
a) Connected the DIYduino with Rx, Tx, GND, and Reset to my Arduino Uno as shown in step 7 “Testing the DIYduino Section”. You can also use a USB to Serial Programmer if you have one.
b) Connected my chosen motor supply voltage Vcc = 12V to the DIYduino power input.
c) Connected a voltmeter to the motor output of the board. This board only utilized one output.
c) Uploaded the sketch 'Sketch for Testing 3-in-1 DIYduino' shown below.
d) Watched the voltmeter and verified that the supply voltage to the motor was:
      (i) Switched on
      (ii) Inverted
      (iii) Switched on
      (iv) Inverted
      (v) Switched off
in 3, 3, 3, 3, and 12 seconds, respectively.
For variable speed motor drivers (version 3 and version 5) the first two steps should result in a voltage output < Vcc. The second two steps should output Vcc.
For fixed speed motor drivers (version 2 and version 4) the output should always be Vcc.
e) If you built a 2-channel board, move the test leads of your voltmeter to the other channel. You should observe the same pattern.

This concludes this instructable.

Good luck with your robots.
If you happen to build and use one of these boards in your designs, I'd love to see them. Please upload some pictures.

Sketch for Testing 3-in-1 DIYduino:

/*-----( Declare Variables )-----*/
int dir1PinA = 7; //set direction 1 pin for Motor A to pin 6
int dir2PinA = 8; //set direction 2 pin for Motor A to pin 5
int speedPinA = 9; //set control speed PWM pin for Motor A to pin 9
int dir1PinB = 12; //set direction 1 pin for Motor B to pin 12
int dir2PinB = 13; //set direction 2 pin for Motor B to pin 13
int speedPinB = 6; //set control speed PWM pin for Motor B to pin 6

void setup()   /****** SETUP: RUNS ONCE ******/
    //set pin modes
    pinMode  (dir1PinA, OUTPUT); // for motor A control direction
    pinMode  (dir2PinA, OUTPUT); // for motor A control direction
    pinMode  (speedPinA, OUTPUT); // for motor A control speed
    pinMode  (dir1PinB, OUTPUT); // for motor B control direction
    pinMode  (dir2PinB, OUTPUT); // for motor B control direction
    pinMode  (speedPinB, OUTPUT); // for motor B control speed

  //start up with stopped motors:
    //Motor A
      digitalWrite (dir1PinA, LOW);
      digitalWrite (dir2PinA, LOW);
    //Motor B
      digitalWrite (dir1PinB, LOW);
      digitalWrite (dir2PinB, LOW);

}//--(end setup )---

void loop()   /****** LOOP: RUNS CONSTANTLY ******/
  //Turn motor A in first direction with speed 100 on a scale up to 255
      analogWrite (speedPinA, 100);
      digitalWrite (dir1PinA, HIGH);
      digitalWrite (dir2PinA, LOW); 
  //Wait for 3 seconds
  //Turn motor A in second direction with speed 100 on a scale up to 255
      analogWrite (speedPinA, 100);
      digitalWrite (dir1PinA, LOW);
      digitalWrite (dir2PinA, HIGH);
  //Wait for 3 seconds
  //Turn motor A in first direction with speed 255 on a scale up to 255
      analogWrite (speedPinA, 255);
      digitalWrite (dir1PinA, HIGH);
      digitalWrite (dir2PinA, LOW); 
  //Wait for 3 seconds
  //Turn motor A in second direction with speed 100 on a scale up to 255
      analogWrite (speedPinA, 255);
      digitalWrite (dir1PinA, LOW);
      digitalWrite (dir2PinA, HIGH);
  //Wait for 3 seconds
  //stop motor A
      digitalWrite (dir1PinA, LOW);
      digitalWrite (dir2PinA, LOW);   
  //Turn motor B in first direction with speed 100 on a scale up to 255
      analogWrite (speedPinB, 100);
      digitalWrite (dir1PinB, HIGH);
      digitalWrite (dir2PinB, LOW); 
  //Wait for 3 seconds
  //Turn motor B in second direction with speed 100 on a scale up to 255
      analogWrite (speedPinB, 100);
      digitalWrite (dir1PinB, LOW);
      digitalWrite (dir2PinB, HIGH);
  //Wait for 3 seconds
  //Turn motor B in first direction with speed 255 on a scale up to 255
      analogWrite (speedPinB, 255);
      digitalWrite (dir1PinB, HIGH);
      digitalWrite (dir2PinB, LOW); 
  //Wait for 3 seconds
  //Turn motor B in second direction with speed 100 on a scale up to 255
      analogWrite (speedPinB, 255);
      digitalWrite (dir1PinB, LOW);
      digitalWrite (dir2PinB, HIGH);
  //Wait for 3 seconds
  //stop motor B
      digitalWrite (dir1PinB, LOW);
      digitalWrite (dir2PinB, LOW);            

}  //--(end main loop )---
What an awesome instructable. Well done. I'm already planning my own one.
<p>SuPerBenDeR...You Rock! Thanks for this! This build is a perfect &quot;base&quot; for expanding on / building various robots! 1 board...So nice.</p>
<p>Hi Schel,</p><p>Thanks for the praise. I appreciate it. Please post some pics of the applications you use these boards for if you find the time. I'd love to see them. I can tell you it's motivating to see the instructable helping somebody. Makes it worth all the work that went into writing it.</p><p>Keep on building.</p>
wow,that's nice i think you should start making a board with printed pcb
Hi deqwer, <br>Thanks for the suggestion. If in the near future I need to use more than one I'd absolutely go that way. I'd actually would try to make the pcb design flexible so that you can switch between versions using jumpers or jumper cables. Switching from a fixed max speed to an adjustable speed is for example part of the commercial motor driver design that is shown in the first picture.

About This Instructable




Bio: I got into wood working fairly recently and have also been dabbling with electronics since about forever. The combination of both I find very fascinating ... More »
More by Superbender:Backlit Smart House Numbers Wall Mounted Ski Boot Drill Holder Giraffe Shaped Mailbox 
Add instructable to: