[Project] An Arduino Linkbot Siren System as Police Car, Ambulance, or Fire Truck
Introduction:
Linkbot is a reconfigurable modular educational robot. Arduino board is a popular open-source single-board microcontroller. Barobo Arduino provides a user-friendly solution for making and building in the physical world, and integrating sensors into Linkbot systems using Arduino.
In this project, a Linkbot and Arudino are used to build a police car, ambulance, or fire truck with a flashing light. The robot moves with a blinking RGB LED and siren of police car, ambulance, and fire truck. The entire system is controlled by a program with only 19 lines of code!
Information:
Grades: 7 – 12
Duration: 6-20 Hours
Level: Intermediate (using Arduino)
Products Used in the Project:
Parts Used in the Project:
1 Linkbot-I
1 Linkbot Dongle
1 Ball Caster
2 3.5” wheels
2 Snap Connector
1 Cube Connector
1 Arduino board
1 Mini breadboard
1 RGB LED
1 Bluetooth module
1 9V battery holder
1 9V battery (16x 9v 600 Amh Li-ion Rechargable Batteries are included in 16 Linkbot Uno Pack Classroom Bundle)
Some jump wires from Arduno Uno Starter Kit
Some screws from Linkot Uno Pack
Setup:
The Arduino Linkbot Siren System as a police car, ambulance, or fire truck with a flashing light is shown in Figure 1. The detailed wiring information can be found in section 11 “Adding Sensors to Linkbot Using Linkbot Uno Pack” of the textbook Learning Physical Computing with Arduino for the Absolute Beginner. The Complete PDF files is available to you if you purchase a Barobo Arduno Uno Starter Kit
Figure 1: An Arduino Linkbot Siren System as a police car, ambulance, or fire truck.
Programming the Linkbot Siren System in Ch:
A Ch program linkbotSiren.ch can be used to control this Linkbot Siren System. Details for each robot member function for CLinkbotI can be found in the textbook “Learning Robot Programming with Linkbot for the Absolute Beginner”. How to write a C function can be found in the textbook “Learning Computer Programming with Ch for the Absolute Beginner”. The entire PDF files for these two textbooks are available in C-STEM Studio. The detailed information Arduino functions can be found in textbook "Learning Physical Computing with Arduino for the Absolute Beginner."
/* File: linkbotSiren.ch
Drive a robot and play a siren at the same time
while making an RGB LED blink */
#include <arduino.h>
#include <linkbot.h>
CLinkbotI robot;
double radius = 1.75;
double trackwidth = 3.69;
//Set up pin 3 for output
int ledPin = 3;
pinMode(ledPin, OUTPUT);
digitalWrite(ledPin, HIGH);
//Play police car siren while the robot drives forward
robot.driveDistanceNB(45, radius);
robot.playMelody(PoliceCarSiren, 1);
//wait for driveDistanceNB() to finish
robot.moveWait();
robot.turnRight(180, radius, trackwidth);
//Play an ambulance siren while the robot drives backward
robot.driveDistanceNB(45, radius);
robot.playMelody(AmbulanceSiren, 1);
robot.moveWait();
robot.turnRight(180, radius, trackwidth);
//Play a fire truck siren while the robot drives forward
robot.driveDistanceNB(45, radius);
robot.playMelody(FireTruckSiren, 1);
robot.moveWait();