Skip to content

Instantly share code, notes, and snippets.

@dceejay
Created February 27, 2018 11:31
Show Gist options
  • Save dceejay/2b6c2f0d7a316f1a6831782d33a0d40c to your computer and use it in GitHub Desktop.
Save dceejay/2b6c2f0d7a316f1a6831782d33a0d40c to your computer and use it in GitHub Desktop.
Pi Camera Stills to Dashboard

A simple flow to grab a still image from a directly attached Pi Camera (using raspistill) and push it to a ui_template widget on a dashboard.

[{"id":"56677cb7.9840b4","type":"inject","z":"6fd852c2.a76acc","name":"","topic":"","payload":"","payloadType":"str","repeat":"","crontab":"","once":false,"x":110,"y":160,"wires":[["f7696701.4cf1e8"]]},{"id":"f7696701.4cf1e8","type":"exec","z":"6fd852c2.a76acc","command":"raspistill","addpay":false,"append":"-w 320 -h 240 -o -","useSpawn":"false","timer":"","oldrc":false,"name":"","x":240,"y":160,"wires":[["e7f06c8d.c0a3b"],[],[]]},{"id":"e7f06c8d.c0a3b","type":"base64","z":"6fd852c2.a76acc","name":"","action":"str","property":"payload","x":400,"y":160,"wires":[["9e6ed9dc.f64ba8"]]},{"id":"9e6ed9dc.f64ba8","type":"template","z":"6fd852c2.a76acc","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"<img width=\"320px\" height=\"240px\" src=\"data:image/jpg;base64,{{{payload}}}\">","output":"str","x":530,"y":160,"wires":[["28439a97.39e7a6"]]},{"id":"28439a97.39e7a6","type":"ui_template","z":"6fd852c2.a76acc","group":"c7a43587.2944e8","name":"","order":0,"width":"6","height":"5","format":"<div ng-bind-html=\"msg.payload\"></div>","storeOutMessages":true,"fwdInMessages":true,"templateScope":"local","x":660,"y":160,"wires":[[]]},{"id":"c7a43587.2944e8","type":"ui_group","z":"","name":"Default","tab":"fbd536a.22bf9c8","disp":true,"width":"6","collapse":false},{"id":"fbd536a.22bf9c8","type":"ui_tab","z":"","name":"Home","icon":"dashboard"}]
@dceejay
Copy link
Author

dceejay commented Jan 29, 2020

Well looks like the camera isn't working correctly... did you try googling that error ? ENOSPC mmal

eg
https://raspberrypi.stackexchange.com/questions/13764/what-causes-enospc-error-when-using-the-raspberry-pi-camera-module

@baqwas
Copy link

baqwas commented Jan 30, 2020

Yes! Operator error!!! Sorry for the bad report on my part that wasted a few cycles at your end.

I forgot all about motion (running as a service) that I had installed for a comparison test. I attributed the always on LED to some 3rd party (pan-tilt servoblaster) driver issue. After stopping the motion service (and the LED went off :)), the flow (your suggested demo test) started working. I've now connected the PIR sensor too as a trigger.

I was trying to self-study a [tutorial](Developing a Machine Learning IoT App with Node-RED and TensorFlow.js). I have a Rube Goldberg solution on the same box (my first RPi with OpenCV/MariaDB/multi-server/etc.) and I had installed TensorFlowLite previously with some workarounds but this article looked like a good opportunity to practice some N-R and with your help I'm back on track.

Appreciate the follow up. Kind regards.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment