3

This question doesn't quite fit a category perfectly, but IoT seemed like the best fit.

Conceptually, what approach would you take to address the following?

I'm looking to build a device that needs to be able to:

  • accept IR input from several sensors. Could be any of the sensors at almost any time.

  • keep an eye on any instructions received from a server via Wi-Fi, either by polling the server every couple of seconds or allowing the server to send a packet direct to the device.

  • when IR signal is detected, translate the code and report back to the server over Wi-Fi + perform a local action.

  • run a lightweight display. RGB is better.

  • react to a local user button input

The conceptual question I'm facing is both around a programming strategy and hardware. If I were to use something like an Arduino then I'm limited to one core, and I'm not sure how I can do all of these things concurrently. But the network and IR watching are important. A round robin style scheduler runs the risk of missing these inputs. Using a Raspberry Pi (or variant, i.e. Orange Pi Zero) opens up quad core processing, meaning that threading becomes available, but would this solve the issue of potentially having multiple inputs/outputs happening at the same time and causing a clash?

What methods would you suggest I consider to tackle this? The issue here is that I have some programming ability, but this is my first time playing with smaller hardware, and I don't know what I don't know yet.

closed as too broad by hardillb, Chris Stratton, Helmar Nov 16 '17 at 8:43

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 2
    This is quite a bunch of questions tugged in there. If you can provide a clearer view on what your current obstacle is in reaching what you want to achieve you could get a lot more focused answers which would in return be a lot more helpful to you. – Helmar Nov 16 '17 at 8:47
  • 1
    Helmer, my question opened with a note that this was a conceptual issue involving multiple variables. Seeing individual pieces of the puzzle individually is no help to working out a first approach to tackling it. I've not asked for hardware specifics, or code, or any of the sort, but more of a "what direction would experienced lead you to take?". Once I have some direction I'll be mostly fine nutting out the rest. Choosing incompatible approaches from the outset will be more frustrating and be cause to ditch the project. – anakaine Nov 17 '17 at 5:27
2

I am going to assume you are purchasing breakout boards for sensors here because the hardware design for what you have posed can come in many forms, requiring varying skill levels. That said, this hypothetical requires a multistage solution and does dip into a typical IoT use case which I have seen before so here we go:

  1. Accept IR input from several sensors. Could be any of the sensors at almost any time.
    • Depending on how quickly you need to poll these sensors (truly simultaneously sampling vs simply polling sensors very quickly) you can choose something along the lines of a Pi board which can poll these sensors very quickly and catch every signal or use some FPGA to truly sample these sensors in parallel. Either is totally doable, but the parallel FPGA solution is not going to be easy if you have never used one before (but a great tool to learn). If you have not picked an IR sensor yet, I would suggest you try this one for starters:
  2. Keep an eye on any instructions received from a server via wifi, either by polling the server every couple of seconds or allowing the server to send a packet direct to the device.
    • I would suggest you move to a LPWAN network to manage your connected devices such that you are not attempting to integrate into an existing WiFi network. There are range, device number, and connectivity issues present when using a router that are easily and inexpensively mitigated by deploying a LPWAN implementation. This will work around your WiFi network, connecting devices over a larger area than your WiFi network, and reaching your backend service via a single ethernet connection or cellular backhaul. There are good connectivity solutions for you already available so you can focus on the sensors and your backend service. I suggest this one:
  3. When IR signal is detected, translate the code and report back to the server over wifi + perform a local action.
    • This is also an easy solution. Depending on the IR sensor you are using, the IC may have an interrupt port which you can access to trigger the MCU you are using to begin a process which transforms the incoming data on interrupt and sends it to your backend service. If it does not, you can create a case statement or check against a known sensor reading to determine if the IR sensor has "seen" something. Different sensors will have different refresh rates so I would read into your available options and pick one that is to your specifications.
  4. Run a lightweight display. RGB is better.
  5. React to a local user button input
    • I would bundle this button into the display you are using. Kill two birds with one stone.

Given all of these issues and the suggested solutions, I would recommend using the Raspberry Pi to take advantage of the multi-core processor, the Linux OS, and Python. If you find you need the FPGA to run your sensors there are adaptors for Spartan 6 FPGAs readily available which should more than satisfy your peripheral driving/monitoring needs. Here are a few links:

I hope this is helpful and happy prototyping!

  • 1
    Rob, thank you very much. Some of your answers were along the lines I had been exploring, including a small dedicated sensor that can be polled intermittently to see if a signal has been received. Thank you also for the hardware recommendations. – anakaine Nov 16 '17 at 5:53

Not the answer you're looking for? Browse other questions tagged or ask your own question.