This is a rough draft python program which allows two Raspberry Pi systems, each equipped with a webcam and HDMI screen, to work like a portal in the Portal video game. That is, each screen shows the output of the opposite camera, much like a super slow video conference on two smartphones using their rear cameras.
See the 'blue' raspberry pi and camera on the left under the roll of blue electrical tape, and the 'orange' raspberry pi's screen above.
- config.py contains the variables you need to set for your environment.
- Make sure your Notecard is using fw version
v3.2.1
or later.
The two portals communicate via Blues Wireless Notecards (cellular or wifi) to Notehub.io, a secure cloud data routing service.
* the cloud service is not shown in this repo and is left as an exercise for the reader. See the Notehub Route Tutorial and Notehub API introduction.
- Display the image right from python. Currently it needs to be done by a separate linux process.
- Test the latest refactor on a Raspberry Pi which I sadly don't currently have.
- Test your image payloads. Keep them as small as you can. 8kB is way too big.
- While testing your use case, keep an eye on notecard flash storage usage percentage (printed out after sending each frame.) Note the Notecard usually has about 700kB note storage, but less in some circumstances like during DFU.
- Check notecard api responses for
err
messages and handle appropriately.
Images are captured as jpg, resized to 240x400, compressed into WebP at low quality (0-2 on a scale of 0-100), encoded as base64, and put into a json body suitable for the Notecard JSON API.
{"destDeviceUID":"dev:5c02723120f3","image":"UklGRrQIAABXRUJQVlA4IKgIAABQFgCdASrwAMgAP73e6W6+N7AqojO5E8A3iWNttqQsohAsJC8RbxM+U8fBfMQU7B0L7vkNxmlFJQ//6+dfSXTxWfENu4cz53HYyYdCclVdz/JR+WfgGRjcZ0QtijSiwXeprrx82FW8yaPcXSKf959acNZUB1s+fCweg10kZokyuMJPQI9I0dB4Y5lr3Gmz6IAUXmcfi3JGqSn6EWT114q9XWd3lVKRnz4lCag7Ctw8tfz1njb2DRBtUwPAAP7Z9DGR3Lq0PBKXrhqZnB2leuXyY9Uk6QwkCdcEWV+iCcj0G2rQDY0Bl0sfh3yZgOGIIyf60+/Oj5IxEMMdMaNNIoUrvb3lBrZ9PPNN+yXw+5Cd1Wkx9dE1ICrllT9erGQ4MHr5JRB1AlRqddS4baN54fHffyAd/Dwgeu0NHZCKmGbPQ5pUvO8O+8SVavvR5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