My First Projects With Raspberry Pi 3b and Donkey Car
Live-Stream Video
We have decided to solve the problem of finding any kind of life in disaster situations that we can imagine. Then, I imagine that using the car "Donkey Car" and that being manipulated by its remote control, we can move it to approach it and pass under a car on fire, or under heavy slabs after an earthquake to find someone with life. Then the car "Donkey Car" could capture the video in real time from these places and we could see it through another computer that connects remotely to the "Donkey Car" and thus we would save a lot of time.
Method:
The technical details of this diagram are the following:
a) The schematic diagram and the code "live_stream_video.py" you can download at the end of this tutorial. The Python version of our Raspberry Pi is 3.5.3
b) We use our Raspberry Pi as a server. Then we have to wait for a connection from our client before streaming video.
c) We must be connected to our router via WiFi and we verify our IP using the following command (in my case I got an IP of: 192.168.0.100):
$ ifconfig
d) If we want our program to start every time we start our Raspberry Pi in our "Donkey Car", first we need to copy our file "live_stream_video.py" in the following directory: / home / pi /
e) Next we execute the following command:
$ sudo nano / etc / profile
f) At the end of the code we add the following line, save the file and log out:
sudo python /home/pi/vid.py &
g) The & character indicates that the program runs in the background. Finally we use as a client our computer that has a Windows 7 operating system and is also connected to my router via WiFi.
h) On this PC we have installed the VLC player. We start it, and then we go to: File> Open Network and insert the following address: vlc tcp / h264: // my_pi_address: 8000 / (In my case I insert the address: vlc tcp / h264: //192.168.0.100: 8000 /).
i) The video begins to transmit in real time as we can see in the next video and every time the video is interrupted we have to restart our Raspberry Pi and our VLC player.
In the next video we can see a demonstration.
Spy Camera
On this occasion I have raised the problem that the car "Donkey Car" travel places where disasters such as hurricanes or volcanic eruptions or perhaps in war zones and capture photographs every time this device detect the movement of some infrared emitter as It could be a person or even an animal that passes in front of this system. This project is autonomous in terms of decision making to capture images, since it does not require any human to be activated but by means of a PIR sensor.
Method:
a) The schematic diagram and the code "spy_camera.py" you can download at the end of this tutorial. The Python version of our Raspberry Pi is 3.5.3
b) We use the PIR motion sensor (passive infrared snsor) to activate the camera of our Raspberry Pi every time someone passes in front of it. The PIR sensor has three connectors: Vcc, Gnd and Out. The "Out" pin is connected to the GPIO14 pin of our Raspberry Pi.
c) A great advantage of this model is that due to the mobility of the "Donkey Car", we can capture movement images of humans or animals in several places and we just have to use a good battery that feeds this hardware for a long time.
d) If we want our program to start every time we start our Raspberry Pi in our "DonkeyCar", first we need to copy our file "spy_camera.py" in the following directory: / home / pi /
e) Next we execute the following command:
$ sudo nano / etc / profile
f) At the end of the code we add the following line, save and exit:
sudo python /home/pi/spy_camera.py &
g) In this way the system will work automatically for a long time and all the images will be saved with the date and time they were captured.
In the following video we can see a demonstration.