Core Electronics Forum

sensors->Arduino->Pi->touchscreen product advice?

Hi, Arduino-based maker, but Pi noob here. I currently have a ‘system’ with two distinct parts:

  1. A handheld unit comprising sensors connected to an Arduino Mega pro mini, taking user input from a 4x4 keypad to set starting values, scale etc and with everything displayed on a 16x2 LCD.
  2. A Python app running on a PC in which one manually enters certain sensor readings from the unit in 1, the app takes some additional user inputs, and then based on these the app fetches more data from remote DBs through various libraries, processes everything and outputs a final result on the screen.
    This combo has been working just fine, but I’m looking to consolidate 1 and 2 into the ONE self-contained handheld unit. Any advice as to how to go about this please? Initial thoughts:

A Raspberry Pi Zero W with a Waveshare 2.8/3.5 inch touchscreen (I believe it would be connected SPI through PI GPIO pins?) replaces the PC in 2, and the keypad and LCD display in 1. The device then won’t be much larger than the existing handheld unit. The Mega still takes the sensor readings, but passes them serially USB Mega->USB Pi, for display on the touchscreen. The starting values and scale settings that were previously all done on the Mega, will now go touchscreen->Python->USB Pi->USB Mega. The Python app in 2 runs on the Pi, and it takes what it needs from virtual keyboard user input, sensor readings from the Mega, does remote database lookup through the Zero W’s wifi connection, and displays the final result on the touchscreen.
Does this seem viable enough to give it a try? Would the Zero be up to the job? Any other considerations? A few millisec delay in the ‘realtime’ between the float sensor readings from the Mega and presentation on the touchscreen, is fine. And currently the remote DB requests from the desktop app can take anywhere from instant response to a couple of seconds to fulfill, from what I’ve seen.

Hi Jim,

Welcome to the forum, sounds like an excellent project!

A screen such as the one you described would be perfect for your project!

As for communicating between the Pi and the Arduino, I would recommend this tutorial here:

(Another rabbit hole you could dive down for future projects could be I2C to communicate between the two)

It sounds like it would be a perfect implementation!
Look at it from an outsiders perspective my only concern would be the clock speed and RAM on the Zero, that’s an easy fix though, you could upgrade to the Pi 3A+ or the 3B+.

As for power were you still looking to power them both through a cable? A PiJuice’ might be a good solution to make it a portable solution.

Core also has a page where you can get your project published, check it out here: Create a Project Australia

Let me know if you have any other questions.

Liam.

1 Like

Thanks Liam for your response! So there’s a chance the Zero may be short on grunt for this application. That would be unfortunate as otherwise its form factor is perfect and it is not power hungry. All the devices in the current handheld unit are powered by a 5V boost board fed by 3 AAA batteries, and the unit is only used for 1-2 hours in the field at a time, then the batteries are recharged.
These units need to be under a certain cost, and relative to the aforementioned simple power supply, a piJuice will be an order or magnitude higher cost.
I was thinking perhaps might be able to get away something like one of your 1100mAh LIPOs that can deliver around 1A through a protection and 5V boost board? (am assuming all devices in the new config will still be at 5V rail)

1 Like

Hi Jim,

I apologize for the delay in getting back to you, the simplest way to set that up would be to use one of the UPS HATs, that way once setup you can charge the battery, run the Pi wirelessly, and still power the Pi via USB when not in use (the 1100mAh cell is currently out of stock, but a battery with a 2-pin JST-PH connection around that capacity should do nicely)

Thanks for the advice Bryce re the UPS HAT.
Re the Zero, would it be true to say that most folk run it with Raspbian Lite? It’s just that I see reports in various forums of it running slow with the full OS, and if that’s the case, then presumably I won’t be able to run my tkinter-based GUI on the Lite OS because a window manager is needed for such an app, correct?
So I’m leaning more towards the 3A+ now, as it seems the Zero might be a bit of a gamble (and if the boot time/ GUI responsiveness/transfer speeds do fall short with it, I don’t have an alternative project use for the board currently). Although it seems the 3A+ has the same amount of RAM as the Zero, the chances of project success appear to be better thanks to the beefier processor, with the added bonus that it is still reasonably compact compared to the other Pi models, doesn’t have connectors that I won’t be using for the project, and consumes less power than the 3B+ (i see that the UPS HAT you’ve pointed out is still fine for the 3A+)

Hi Jim,

You could, and that would certainly help with performance and minimizing the footprint of your OS. However, I personally find that you can run either OS on a zero, and you’ll still notice the fact when in the GUI that you’re on a Zero :rofl: Whenever possible I try to use terminal interface only on those board if you’re looking to increase the speed within your project, although I completely understand if that’s not practical in this case.

Sounds like an interesting system using some fairly alternative design to the norm with these kinds of boards. Be sure to let us know how you end up going with it!