Scenic with Nerves on RPi3 - screen compatibility


Does anyone have experience running Scenic with Nerves on RPi3, with display output going to a smaller screen that fits on top the the RPi3?

There’s quite a few ways to connect a display to an RPi3 and it’s unclear to me which ones are compatible with Scenic+Nerves.

From looking through the ads and docs of some displays, it seems they need a special driver or library. Curious if anyone has gotten one to work with Scenic+Nerves.

I did get Scenic+Nerves to draw on a regular computer monitor attached to the RPi3 via HDMI.

Thanks for any pointers,


Hi! I have the officialRaspberry PI touch display (from the ElixirConf nerves training) and it’s working great with Scenic (I even have touch working!). I didn’t have to do any special setup except for configuring scenic_driver_nerves_touch.

If you want to look at my code it’s available here:

Although it won’t work without a little tweaking because I have a few external path dependencies in there.

Edit: Now there aren’t any path dependencies, so everything should work fine.


Great, thanks! I’m looking for something smaller though, around 3.5 or 4 inch so the display fits on top of the RPi3 :slight_smile:

Something like this:
Or like that:

1 Like

Okay, I see. I don’t have experience with that unfortunately, but I’m sure someone will chime in!

1 Like

Are you using a keyboard with the rpi3? I have an rpi3 and the same touch screen plus a USB keyboard but I am not getting any keyboard events via handle_input/3 in my scene code. Works fine on MacOS, but on rpi no keyboard events.

Also haven’t figured out how touchscreen events work with the handler model in Scenic scenes, does it also work with handle_input/3? what to pattern match on? Any advice?

Haven’t tried connecting a keyboard since I don’t have a spare one at the moment and I’ve been too lazy to steal one from a computer.

My top-level handle_input captures everything:

  def handle_input(input, viewport_context, state) do"Received input: #{inspect input}")
    do_handle_input(input, viewport_context, state)

Then the do_handle_input clauses matches on {:cursor_pos and {:cursor_button:

  # Mouse/Touchscreen drag input
  def do_handle_input({:cursor_pos, cursor_coords}, _viewport_context, state) do
    {:noreply, update_cursor_coords(state, cursor_coords)}

  # Mouse Click/Touchscreen tap input
  def do_handle_input({:cursor_button, {:left, :press, _, cursor_coords}}, _viewport_context, state) do
    # track tap

Have you used RingLogger to view logs from the device? The logging is the main reason that I keep the top-level handle_input around. If you have ring logger installed you can ssh into your raspberry pi and run RingLogger.tail or RingLogger.attach to view the logs.

If you want to try out my code it’s released as MIT: It’s a little asteroids clone that’s most of the way done (although there’s no way to move around on a device, unless a keyboard works, also I should rename my repository).

If you cd fw; mix deps.get; mix firmware; and then upload the firmware to your device it should work.

Also are you running your scenic program locally as well? Or just on-device?

1 Like

Sadly, I don’t think anyone has written a non-touch input driver for Scenic on Nerves yet. The input driver at scenic_driver_nerves_touch only looks for a touchscreen sensor and processes events from it.

It seems like there could be a driver receives input from all input devices and sends them through Scenic. The input_event library looks like some code could enumerate the input sources and then start a listener on all of them. I haven’t studied the glue code to scenic, but I’d hope that the touch driver could serve as a good guide.


Thanks for the info. I now have things set up with nerves init-gadget, firmware_ssh, etc and started using RingLogger over ssh. Your code examples were helpful, thanks again.

1 Like

Great! I’m glad it was helpful :smile:

1 Like

To get started, I went ahead and got the official 7" Raspberry Pi screen and a matching stand. This setup will actually be better for my current needs :slight_smile: We’ll see where it goes later. Next step for me is to learn more Scenic and read analog input from a linear poti.

1 Like

Update on input events to Scenic: I just submitted a PR to the input_event library to support generically identifying keyboards, mice, joysticks, touchscreens, and the other random things that show up as input devices like audio input jack detectors and power buttons. Hopefully once it gets merged (it is a big change, so might take a bit), someone can help add the Scenic driver pieces to make it work.


Update: the PR got accepted and an input_event release was made. Thanks @mobileoverlord! Also, @boydm made a new release of scenic_driver_nerves_touch that is compatible with it. There was a breaking API change in the PR, but I think it will go unnoticed.

One last comment: I spent entirely way too much time playing asteroids thanks to @axelson’s scenic_playground. That was fun. Everything happening around scenic really makes me happy.


Thanks! I’m glad that you enjoyed playing with it :slight_smile:

It’s just about ready for me to create it’s own post for it.

I’ve been playing with it too. Very nice work!

1 Like