book collections email follower instructable user

Step 3: Building the Circuit

Picture of Building the Circuit
circuit1.jpg
circuit2.jpg
top platform.jpg
circuit3.jpg
IMU and middle platformd3.1.jpg

Motor Driver
The enable pins of the L298N are used to control the speed of your motor using PWM (Pulse Width Modulation), while the In1-4 pins of the driver are used to switch the motor's directions. Below are the instructions which describe the Fritzing diagram at the top of this section.

  1. Connect the EnA pin of the L298N to the Arduino's digital pin 6.
  2. Connect the In1 pin to the digital pin 5, and the In2 pin to digital pin 3.
  3. Connect the EnB pin of the L298N to the Arduino's digital pin 11.
  4. Connect the In3 pin to the digital pin 13, and the In4 pin to digital pin 12.
  5. Remove the 5V_EN jumper, in order to supply the Arduino with power from the driver as well.
  6. Connect the 5V screw terminal from the L298N to the Arduino's Vin pin.
  7. Connect one of your motors' positive and negative power wires to the MotorA screw terminals.
  8. Connect the other motor's positive and negative power wires to the MotorB screw terminals.
  9. Cut out another piece of the Power Wire and connect the red wire to the VMS pin of the L298N, and the black wire to the GND pin of the L298N. The other end of the red wire should connect to the Wago connector.
  10. Place a screw terminal at the end of the mini-breadboard.
  11. Cut out another piece of the Power Wire and connect it to the female barrel jack. The red end should then be connected to the Wago connector to complete the circuit all the way to the VMS pin of the L298N, while the black end will go into the screw terminal we placed in the mini-breadboard earlier.
  12. Connect the Arduino's GND pin in the same line as the female barrel jack in the mini-breadboard. This will ensure that our system's grounds are all connected.
  13. Place another screw terminal on the mini-bread board, and connect the other end of the wire we previously placed in the L298N's GND pin into this terminal. Make sure that this is also connected to the ground line we established in the previous step. Our ground circuit should now be complete. (Look at the images if this part gets confusing).


BNO055 Absolute Orientation Sensor
The BNO055 is a 9 degree of freedom sensor. It fuses data from an accelerometer, gyroscope and magnetometer into absolute 3D orientation. The BNO055 uses I2C communication so we will be wiring it to the Arduino Uno's A5 and A4 pins. This would change depending on the kind of Arduino you choose to use.

  1. Solder a header strip into the IMU's breakout board.
  2. Place the IMU on the mini-breadboard.
  3. Using a jumper cable, connect the Arduino's 5V pin to the mini-breadboard.
  4. Connect the IMU's Vin pin inline with the 5V cable coming from the Arduino on the mini-breadboard.
  5. Connect the IMU's GND pin inline with the GND pin coming from the Arduino on the mini-breadboard.
  6. Take a longer jumper cable and run that from the IMU's SCL pin to the Arduino's A5 pin (which doubles as the SCL pin).
  7. Take another long jumper cable and run that from the IMU's SDA pin to the Arduino's A4 pin (which doubles as the SDA pin).


HC-SR04 Ultrasonic Sensors
The HC-SR04 sensor is an ultrasonic ranging module that provides a measurement function ranging from 2cm to 400cm with a 3mm accuracy. It works on a basic principles of sending pulses, and detecting the time it takes to receive the pulse back. The distance measured by this pulse can be broken down into a simple equation: Distance = (High Level Time * Velocity of Sound) / 2

  1. Connect the VCC pin of the HC-SR04 inline with the 5V cable coming from the Arduino on the mini-breadboard.
  2. Connect the GND pin of the HC-SR04 inline with the GND cable coming from the Arduino on the mini-breadboard.
  3. Connect the Trig pin of the HC-SR04 to the Arduino's Digital 4 pin.
  4. Connect the Echo pin of the HC-SR04 to the Arduino's Digital 2 pin.
  5. Repeat steps 1 through 4 with the second HC-SR04 but this time use Digital pin 7 for Trig, and Digital pin 8 for Echo.


Power Supply

Our motors require 12V and around 2 Amps each, so we will be using an external power supply to provide this electricity. The arduino itself will be powered from the 5V output of the motor driver.

  1. Cut out a 5m long strand from your power cable spool.
  2. Strip the ends on either side. Attach on end to the power supply screw terminals, and the other end to your male barrel jack.


Assembly

Assembling the electronic on to the chassis is simple. Simply follow the guide holes you made in the Chassis Construction step.

  1. Take the 5mm wood screws and attach the Arduino to the Top platform using the mounting holes on the plastic case.
  2. Take the 7mm spacers, place them underneath the L298N Motor Driver and slide the M4 bolts through the mounting holes and through the spacers.
  3. Underneath the mini-breadboard there should be a patch of double sided tape. Remove the covering of this patch and stick the mini-breadboard in the center of the Middle platform. Make sure that the IMU is center on the paltform, you may need to adjust the breadboard in order to do so.
  4. Take another piece of double sided tape and attach the Wago connector to the edge of the Middle platform.
  5. Using a cable tie, secure the female barrel to one of the threaded rod pillars.
  6. For testing purposes, cut the cleaning sponge in half and attach each half to the sides of the Top platform, using the rubber bands to secure it in place. You may remove this later once your robot stands on its own, but until then this will keep our electronics from getting damaged.