Online Digital Forensics Courses and Labs
Building a Low-cost and State-of-the-art IoT Security Hands-on Laboratory

Funded by National Science Foundation (NSF)

IoT Smart Car Lab 1: Assembly and Programming


Courtesy of Manufacturers

Instructor: Dr. Yier Jin, 352-294-0401, yier.jin@ece.ufl.edu

Prerequisite:

  • Basic understanding of robotics
  • Ability to use a computer

Goals of this demo:

The goal of the IoT Smart Car is to introduce young students to the Internet of Things (IoT) through a fun and interactive lab. A car will be constructed and equipped with motors and sensors. The car can drive over the WiFi from the student's laptop and the sensors can be read remotely as well.

Overview:

In Lab 1 the IoT Smart Car will be constructed and the microcontroller will be programmed.

In Lab 2 the IoT Smart Car will be driven over the WiFi using Node-RED. Then a Node-RED dashboard will be created to drive the car.

In Lab 3 sensors will be added to the IoT Smart Car. The sensor readings will then be monitored using the Node-RED dashboard.

Hardware Needed:

Software Needed:


Assembling the Car and Electrical Components

Constructing the car

There should be a base, two motors, a battery holder, wires, screws, two back wheels, and one front wheel. Follow the instructions that came with the car to assemble it.

Attaching the motor shield

Next take a look at the motor shield. Use some of the leftover screws from the pack to screw the motor shield onto the top of the car. Make sure you screw it on with the screw terminals facing towards the battery pack and that you leave enough room for a small breadboard.

You will see that there are terminals with screws to open and close them. These are labeled A-, A+, B-, B+, VM, GND, VIN, and GND.

Take the red wire coming from the battery pack and screw it into the VIN terminal. Take the black wire coming from the battery pack and screw it into the GND terminal. When you are screwing these wires into the terminal make sure the metal end of the wire is touching the metal contacts of the terminal. You want to make sure there will be an electrical connection.

Now the motor shield will have power, and when the NodeMCU microcontroller that will be used in this lab can be powered from the motor shield.

Powering the Motors

There should be two more pairs of red and black wires that came with the car kit. Attach one red wire to the A+ and the other red wire to the B+. Then attach one black wire to the A- and the other black wire to the B-.

Solder the red wire from A+ to the bottom of the motor on the right wheel (oriented to the car). Solder the black wire from A- to the top of the motor on the right wheel. Then solder the red wire from from B+ to the bottom of the motor on the left wheel. Then solder the black wire from B- to the top of the motor on the left wheel.


Programming the NodeMCU

Download the Arduino IDE from the website here. Choose the Windows Installer if you are on a Windows computer and choose the Mac OS link if you are on a Mac. Follow the instructions in the installer to install the IDE.

IDE Settings

After installing, open up the Arduino IDE.

Downloading and Modifying the Program

Now the vehicle is programmed and ready to receive commands over the network!

In the next tutorial we will set up Node-RED which is a program that will allow us to send commands to the smart car over the WiFi. See the next lab here.


Take Away:

References: