Raspberry Pi capability testing - MAKLab/Moons-of-MAKLab GitHub Wiki
To set up the camera follow the instructions to enable and install the camera at the raspberry pi documentation.
Using the basic recipe to stream video over the network, we can connect to the raspberry pi video stream using vlc:
vlc tcp/h264://my_pi_address:8000/
import socket
import time
import picamera
with picamera.PiCamera() as camera:
camera.resolution = (640, 480)
camera.framerate = 24
server_socket = socket.socket()
server_socket.bind(('0.0.0.0', 8000))
server_socket.listen(0)
# Accept a single connection and make a file-like object out of it
connection = server_socket.accept()[0].makefile('wb')
try:
camera.start_recording(connection, format='h264')
camera.wait_recording(60)
camera.stop_recording()
finally:
connection.close()
server_socket.close()
To get the camera to show up as /dev/video0
run the following command:
sudo modprobe bcm2835-v4l2
I tried a combination of this guide and this guide. In brief...
Disable access to the login shell over serial:
sud raspi-config
- Advanced Options
- Serial
- No
- Ok
- Finish
- Restart
dmesg | grep tty
should tell you the serial port. It should be /dev/ttyAMA0
You will probably need to add yourself to the group allowed to access the serial port:
sudo usermod -a -G dialout username
... I think something happened using screen and minicom.
After a couple of technical issues, we managed to get the rover both to take instructions from the Raspberry Pi's hardware serial port, but also to send a video stream that we watched via vlc on a computer on the same network.
The lag on the video was pretty long, but perhaps usable for our planned games...