The best tools to make your project dreams come true

Login or Signup


How to Make a Simple Robot Using Digi-Key IoT Studio

By Maker.io Staff

The aim of this project is to create a simple, Bluetooth-controlled robot that can take sensory readings of its surrounding environment. Such robots are frequently used in dangerous environments, such as radioactive contaminated areas and dangerous structures, as well as remote locations, such as planetary rovers and satellites. While the robot in this project would struggle to work in a radioactive contaminated zone as, this project demonstrates how Digi-Key IoT Studio can be used for more than just simple IoT sensory devices.

BOM

Scheme-It 

 

The Physical Bot

The robot (more like a rover) is built around the micro:bot kit, which includes motors, wheels, a body, and driver board. This kit is designed to be used with a micro:bit, and the motor driver includes the micro:bit card slot that allows micro:bits to be inserted with ease. However, we only require the physical frame, motors, and wheels, as we will be using a different motor driver that is designed to be used with the Digi-Key IoT Studio: The H-Bridge 1 Click.

The robot has two motors, with one on either side that provide forward, backwards, and turning motions. To prevent the robot from falling over (as two wheels is not enough), the front of the robot has a small wheel that sits on a bearing which allows for the wheel to turn freely.

The Hardware: Huzzah32 and H-Bridge 1 Click

The electronic side of the robot uses the Adafruit Huzzah32 at its core which provides the Bluetooth connectivity as well as sensor readings and motor control. The motors are controlled with a single H-Bridge 1 Click controller that integrates two H-bridges into a single package. The H-Bridge 1 Click is mainly designed for stepper motors but can be used to control two separate DC motors, with each bridge being able to control the direction of rotation of the motor.

The Adafruit Huzzah32 in this project is connected to a breadboard instead of connecting directly to the ADXL343 feather wing. The reason for this is that there are many other devices that require connecting and the feather wing only has soldered connections (which are not desirable). Many of the sensors are I2C based and all have different addresses, which means that they can all be connected to the same I2C bus with no issues.

The connection between the H-Bridge and the motors is critical, as getting the polarity of the motor incorrect will result in reversed behavior such that telling the motor to move forward will in fact cause the motor to go backwards. The motors (which are connected to gearboxes) have a + marking next to one of their terminals. This connector is a polarity connector that indicates which terminal, if made positive, will cause the motor to spin clockwise; however, it would be good practice to test this first before proceeding. Once the polarity is identified, we then need to understand the truth table for the H-bridge (shown below).

mode_2

It is important to recognize that while the H-bridge controller consists of two bridges, they are opposite in operation. However, this is advantageous for moving forward and backward as these motions require the motors to be spinning in opposite orientations, as they are identical (but pointed away from each other). Therefore, for the robot to move forward (and assuming that the right motor is turning clockwise), the left motor needs to turn counterclockwise with respect to its polarity, so that it will spin clockwise with respect to the right motor. This is easier to see in practice as opposed to trying to explain it in words.

To summarize, each motor will be connected identically to the H-bridge such that if the positive pin of the left motor is connected to I2A then the positive pin of the right motor will be connected to I1A.

The Software: Bluetooth on the Digi-Key IoT Studio

The software for the robot is simplified, thanks to the ability to insert multiple Bluetooth elements. This eliminates the need for packet parsing, whereby incoming messages would contain a command (and this command would have to be passed through a comparative element to which the correct motor signals are sent). The device software consists of a Bluetooth element for each function, including all four turns and sensors.

The interval element called SensorProbe simply probes the connected sensors for data, which is then sent to the mobile via Bluetooth. The movement Bluetooth elements are used to change the state of the H-bridge controller which will make the motors either move the robot forward, reverse, turn left, or turn right. You may notice that the robot will continue an action until the MoveStop Bluetooth element sends a message, so there is no need to hold onto buttons or send repeated signals. The Bluetooth elements responsible for changing the H-bridge state do not send values to the H-bridge element (but merely trigger it). The reason for this is that the motor controller only needs to know that there was a request to move in that direction, so triggering the element is more than enough.

element_3

The application side of the project is designed to be used as a controller with a button layout that shows each movement; forward, reverse, turn left, turn right, and stop. When these buttons are pressed, the corresponding Bluetooth element sends the message “GO,” which causes the connected Bluetooth element on the app to trigger the H-bridge element. However, this message is not important (and could be anything), as the Bluetooth elements on the app change the state of the H-bridge when written to. The app also includes two labels that display the recorded temperature surrounding the robot as well as the light level. The interval element is used to probe the light sensor and temperature sensor Bluetooth elements for data, which is then passed to their respective labels.

labels_4

Key Parts and Components

Add all Digi-Key Parts to Cart
  • 1568-1656-ND
  • 1471-2014-ND
  • 1568-1048-ND
  • 1528-2880-ND
  • 1528-2514-ND
  • 1738-1293-ND
  • 1568-1511-ND
  • 1738-1326-ND