Skip to content

gumbypp/LegoRobot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

README

LegoRobot is a simple Arduino sketch that controls a Lego Power Functions XL-Motor using the Pulse Sensor Amped heart rate sensor (the heavy lifting of converting the analog reading to a BPM value is done using Pulse Sensor Amped sample Arduino code). As designed, it turns the motor on in reverse if the detected heart rate is above 80 BPM and forward if the heart rate is above 90 BPM. The motor is turned off if the heart rate is below 80 or cannot be detected.

For fun, it also shows a flying bird with the current heart rate (or blinking eyes when a heart rate is not detected) via an attached 2x16 LCD.

Hardware required

Here's the setup with the motor controlling a 4-wheel robot:

Robot Robot Robot

Schematic

Schematic

Dependencies

Arduino libraries:

Building

  • dissect a Power Functions 8871 Extension Wire so that it can be controlled by the relays on the Relay Shield. The key is to connect +9V/0 from the Battery Box to pins C1 and C2 of the XL-Motor to control its direction as follows:
DirectionforwardPin (4)reversePin (5)Control C1Control C2
Off0000
Forward10+90
Reverse010+9
N/A11+9+9
  • plug the Relay Shield on top of the Uno, and connect the Form C terminals to the Extension Wire as shown in the schematic
  • connect the XL-Motor to something fun, like a wheeled robot or helicopter
  • connect the Pulse Sensor Amped to analog input 0 and the +3.3V power supply
  • connect the LCD display to pins 2, 3, 8, 9, 11 and 12 using this tutorial
  • build and download the Arduino sketch

About

Arduino + Pulse Sensor Amped + Lego

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Other 100.0%