Wiring and Programming SMARS V1 (Etsy Version)

by smars_project in Circuits > Arduino

2517 Views, 7 Favorites, 0 Comments

Wiring and Programming SMARS V1 (Etsy Version)

27265072_1672678562812818_31717489_o.jpg

This guide explains how to wire up and upload code on the SMARS V1 with official electronics kit available on Etsy

Supplies

An already assembled SMARS ( assembling guide and .stl files available here : https://www.thingiverse.com/thing:2662828 )

SMARS Electronics kit https://etsy.me/3qxYLdx

HC-06 bluetooth module http://s.click.aliexpress.com/e/739DNs4

SMARS APP https://play.google.com/store/apps/details?id=com.bluino.smarsapp&hl=it&gl=US

Arduino IDE https://www.arduino.cc/en/software

Insulating tape

White A4 paper sheet

9V battery

Motors Wiring

IMG_3636.JPG

First step is connecting the motors as show in the pic.

The robot will move in the direction of the arrow, so be sure to connect left motor to "MOTOR B" port and right motor to "MOTOR A"port. Starting from left the connections must: L+,L-,R-,R+ (+= red, -= black).

Ultrasonic Sensor Wiring

IMG_3637.JPG
IMG_3640.JPG

Second step is to connect the ultrasonic sensor to the Motor Shield. The sensor's pins must be connected to the shield in the following order:

VCC --> +

Trig --> T

Echo --> R

GND --> G


Be careful, sensor connections are not in the same order, trig and echo are flipped!

IR Sensor Wiring

IMG_3643.JPG
IMG_3648.JPG

Third step consists in connecting the infrared sensor to the board. IR sensor's pins have to the connected as follow:

GND --> GND

OUT --> A4 (white pin)

VCC --> +5

Be careful, sensor connections are not in the same order, VCC and Signal are flipped!

IR Sensor Calibration

IMG_3648.JPG
IMG_3663.JPG
IMG_3664.JPG

In this step we'll calibrate the IR sensor to make it able to detect a black line. To do it will have to put a piece of insulating tape on the A4 sheet, power up the sensor (connecting the 9V battery or the USB cable to the Arduino) and with a screwdriver start to adjust the 2 potentiometers on the sensor until the red light on it will turn on when sensor is on sheet and turn it off when you move it on the tape.

Uploading Demo Codes

Schermata 2021-12-29 alle 12.58.36.png
IMG_3672.JPG
Schermata 2021-12-29 alle 12.59.21.png
Schermata 2021-12-29 alle 12.59.34.png
Schermata 2021-12-29 alle 12.59.58.png

Download and install Arduino IDE (if you will have problems with the drivers, have a look here https://www.arduino.cc/en/Guide/DriverInstallation)

  1. Open the demo file "Etsy_SMARS_ULTRASONIC_NAVIGATION.ino"
  2. Go on " Tools --> Boards --> Arduino AVR Boards" and select "Arduino Uno"
  3. Connect your SMARS to PC with USB cable
  4. Go on "Tools --> Port " and select the port it just appeared, could be a "COMn" or something with "serial port" in it
  5. Press "Upload"
  6. If everything went well, the message "Done uploading." should appear in the left bottom corner of the page and your SMARS should start moving
  7. Unplug the USB cable, plug in the 9V battery and watch your SMARS exploring the room avoiding obstacles!
  8. Repeat the previous steps to upload the other demo codes and watch your robot behave differently.

Bluetooth Remote Control

IMG_3644.JPG
IMG_3645.JPG
IMG_3646.JPG
Screenshot_2021-12-29-13-13-38-337_com.bluino.smarsapp.jpg
Screenshot_2021-12-29-13-14-03-126_com.bluino.smarsapp.jpg
Screenshot_2021-12-29-13-13-56-277_com.bluino.smarsapp.jpg
Screenshot_2021-12-29-13-14-08-443_com.bluino.smarsapp.jpg

In this step we are going to add bluetooth remote control to the robot.

  1. First thing to do is to repeat the previous step and upload the code "Etsy_SMARS_BLUETOOTH _RC_.ino"
  2. Connect the bluetooth module as shown in the pics
  3. Download and install the SMARS APP on your phone
  4. Power up your SMARS and pair your phone with the bluetooth module. It's possible that it will ask for a pairing code, it should be "1234" or "0000".
  5. Open the SMARS APP and go to "Bluetooth Remote Control --> Remote Control Mod --> play-Remote Control Mod
  6. Press the bluetooth logo button and select HC-06 from the devices list
  7. Wait for "Device Connected" message
  8. Control your SMARS

Troubleshooting

L298P-Motor-Driver-Shield-OPT-Power-Jumper.jpeg

In this step we will talk about the main mistakes you could have done and try to find a solution.

  1. The robot doesn't move in the right direction
  2. you probably inverted the motors connections.
  3. if it turns on itself instead of going forward you have to flip the cables of the motor going in the wrong direction ( example: move L+ from A+ to A- and L- from A- to A+).
  4. if it goes backward instead of forward, you have to flip the cables of both motors by keeping the same ports ( move L+ from A+ to A- and L- from A- to A+, same with R and B)
  5. if it turn left instead of right you have to switch the ports by keeping the same cables position ( connect red cable of the motor to B+ instead of A+ and connect black to B- instead of A- and the other way around)
  6. The robot doesn't move
  7. check the power supply, maybe the battery is discharged
  8. check if the sketch has been correctly uploaded
  9. check if the little green/blue jumper on the board is still in place (the one in pic)
  10. The compiler gives me an error
  11. check if you selected the right board
  12. check if you have selected the right port
  13. be sure bluetooth module is not connected to the board (they use the same serial pins so it will not work if its connected)
  14. Ask to Arduino community or google your error, it could be many things and probably you're not the only one with that issue