I have a raspberry pi with a standard 16x2 display (see image).
Now I want users to be able to set the text on that display via a website powered by phoenix.
What is the best way to go here? Do I create a cluster so that the applications talk to each other directly (e.g. the raspi could run a nerves app)? Can I use sockets between 2 phoenix applications? Or do I go for a “boring” API?
What are the advantages and drawbacks of the approaches?
FYI: At a later stage I also want to connect more things to that pi and make them accessible (e.g. a webcam, LED strips, small robots, …).
I have a Nerves poncho project, all_of_the_lights, to control lights on a relay switch using Phoenix channels. The RaspberryPi runs both the Phoenix server and controls the relay switch. I interface with the Phoenix server through any web browser on my home network. The
master branch uses channels. The
rest_api branch uses http requests through a controller. I only have it set up so you can access the phoenix website on my home network. I’m not sure what changes would be required to access it from the web.
It uses the grovepi project to control the relay.
I just have buttons to turn the lights on and off, but you could fairly easily create a form to submit the text and then handle it in your application to update the display.
This is all I’ve done mixing Phoenix with Nerves, so I don’t know about the other approaches you mentioned.
Thanks for your help. So your phoenix app gets deployed and runs with nerves, right? Just like this nerves example. That is awesome. .
I guess I’ll follow the same approach, but will use a REST interface like follows:
The phoenix app running on nerves on the raspi will control the display. When it starts, it will broadcast it’s public IP to the official website. That official website runs another phoenix app and saves the location (IP) of the raspi. I’ll use port forwarding on my router to make sure that it’s reachable. The official website will forward the user input to the raspi via json REST.
What I’m unsure is how to stream the webcam. I guess that will be a challenge of it’s own and I’ll have to take a loot at webRTC.
Exactly right! Good luck, sounds like a fun project!