This IoT project utilizes PubNub API to control a small robot car and receive collected ultrasonic sensors data from anywhere in the world in real time!
Github Repository: https://github.com/megatran/pubnub_iot_tinkering
- Linux machine
- A basic robot or a chassis from an old RC car
- 5V Portable Power Bank to power raspberry pi via USB
- 9V Li-ion battery to power motors
- H-Bridge L298N to control motors
- Ultrasonic sensors HR-S04, 1k and 2k resistors
- Lots of jumper wires (male to female, male to male, female to female…)
- Raspberry Pi 2 Model B
See below pictures:
– Motors and 9V battery to H-Bridge L298N. Then from H-Bridge -> Pi in pins 7,11,13,15
Ultrasonic Sensor Wiring:
TRIG goes to pin 36 and ECHO is plugged in to pin 38 of the Pi.
– While running the PubNub sender, you should be able to see some instructions in the terminal screen.
– Press the Arrow (up, down, left, right) to control the robot movement.
– Press ‘s’ to pause/stop – Press ‘q’ to quit program
– You should be able to see the sensor data of the distance between the robot and nearyby object in the sender’s terminal screen.
It gets updated in real time thanks to PubNub feature!
– I plan on attaching a webcam to the pi and tinkering with Computer Vision library OpenCV so that I can control the robot far far away while seeing the livestream of what is happening. The OpenCV will add the human facial recognition feature, too!