Simple solution that uses an embedded MQTT broker with a MQTT client to send the camera output to any connected client. The camera used is the standard RPi camera module.
The program starts raspistill if it isn't already running. It configures it to take a shot every second.
A timer sends the image every second.
Building a client that displays the image is trivial:
In this example I've implemented it with B4A.
Note that raspistill will be left running if you kill the process.
You can kill it with:
You may need to update raspistill for it to work properly. I've tested it with v1.3.8.
The program starts raspistill if it isn't already running. It configures it to take a shot every second.
A timer sends the image every second.
B4X:
Dim shl As Shell
shl.Initialize("shl", "raspistill", Array("-o", "temp.jpg", "-t", "0", _
"-tl", "1000", "-w", "640", "-h", "480", "-q", "75"))
shl.Run(-1)
B4X:
Sub Timer1_Tick
client.Publish2("image", Bit.InputStreamToBytes(File.OpenInput(File.DirApp, "temp.jpg")), 0, False)
End Sub
Building a client that displays the image is trivial:
In this example I've implemented it with B4A.
Note that raspistill will be left running if you kill the process.
You can kill it with:
B4X:
ps -a |grep raspistill
kill <pid>
Attachments
Last edited: