Unsure of the right platform... Need Advice from The Pros.

Ok,

So I have an interesting project that I need to determine if Arduino is the right platform for.

I am going to lay out my requirements, and you guys help me determine if Arduino or an SoC like a PI3 or Odroid Xu4, etc would be better... Please :slight_smile:

My Programming experience is limited to tweaking others code samples. I have only ever written hello world programs, and a tiny bit of HTML. I have just never been very good at it.
Though I have been in IT service and repair for 25 years and have a GOOD grasp of electronics. I have built many of my own circuits and used arduino to make led arrays, and simple projects before. Plus having some experience with the Mega from my x2 Prusa i3, 3D Printers.

So I need a programming language that is as forgiving as possible, with the LEAST learning curve. I am not sure if that is Python or Arduino or what. To be honest, I just don't know which way I should go.

And Here is why...

My Project is a control unit for Greenhouse operations. Open Source. That can do the following...

  1. Use 8x or 16x Relay module to control Fans, Water Pumps, Air Pumps, Servos for Opening Vents, and to control the on/off switches of several power Strips for Lights, heaters, chillers, or whatever 110v devices might be employed in the greenhouse.
    (Needs to be expandable to 64 relays if possible. And still be able to handle the other items on this list)
    Example Relay Board =
    https://www.gearbest.com/relays/pp_530463.html?wid=1433363&currency=USD&vip=4264393&gclid=Cj0KCQjw0a7YBRDnARIsAJgsF3PgeCUAuNMvBb2MCweg1Y1BJPIg-kPF_OPIfil7bxixabgS2kvAbU0aAgIcEALw_wcB

  2. Take in Data from a PH probe, using the circuit from American Scientific.
    Found here: EZOâ„¢ pH Circuit | Atlas Scientific

  3. Take in Data from a hall-effect flow meter
    Found here: https://www.ebay.com/i/252702675781?chn=ps

  4. Take in Data from a Selenium PhotoCell/resistor to report light levels
    Like this one from Adafruit or wherever.
    Photo cell (CdS photoresistor) : ID 161 : $0.95 : Adafruit Industries, Unique & fun DIY electronics and kits

  5. Take in Data from a Temperature and Humidity Sensor
    Like this one.
    DHT11 Temperature & Relative Humidity Sensor Module for Arduino - Newegg.com

  6. Take in Data from a Barometric Pressure Sensor
    Like this one.
    Adafruit BMP280 I2C or SPI Barometric Pressure & Altitude Sensor [STEMMA QT] : ID 2651 : $9.95 : Adafruit Industries, Unique & fun DIY electronics and kits

  7. Take in Data from a Water Level Sensor
    Like this one.
    Liquid Level Sensor - RobotShop

  8. Measure 12VDC Battery Solar Charging Current
    Like this one.
    https://www.amazon.com/dp/B01HXI1RBC/ref=asc_df_B01HXI1RBC5490699/?tag=hyprod-20&creative=395033&creativeASIN=B01HXI1RBC&linkCode=df0&hvadid=216538221087&hvpos=2o3&hvnetw=g&hvrand=4916202432833453067&hvpone=&hvptwo=&hvqmt=&hvdev=c&hvdvcmdl=&hvlocint=&hvlocphy=9012324&hvtargid=pla-351987843025

  9. Measure 12VDC Battery Voltage with a Sensor
    Like this one.
    https://www.amazon.com/Diymall-Voltage-Sensor-Dc0-25v-Arduino/dp/B00NK4L97Q/ref=pd_lpo_vtph_23_lp_t_3?_encoding=UTF8&psc=1&refRID=7PAZ7VWZ42AJ4M0ETP09

  10. And finally, Co2 Levels with a Sensor
    Like this one.
    SainSmart MG811 Gas CO2 Carbon Dioxide Sensor Module Sensor Module – SainSmart.com

Additional requirements for the system I am building are:

  • Needs to be Wifi or Cat5 Connected to my network on the Farm
  • Needs to be able to push all collected data into a web server and report it to a visual dashboard.
  • Needs to be able to alert via email or sms based on the values of the data. (too little light, no flow, etc)
  • Needs to be able to report to the dashboard the status of the Relays
  • Needs to be able to Schedule and set timers on the Relays, and the rate of data logging for each sensor.
  • Needs to be able to operate in an environment alongside many others of itself. Up to 128 units at a time.
    (So Wireless may or may not work here, I am not sure... I want the MOST stable. So maybe wired networking would be better here?)
  • Needs to be Expandable for more sensors as needs arise

I wish to standardize the sensors, and the platform as a whole. Then do a detailed write up step by step on how it was all put together, including the web portal/dashboard, and backend, then open source the lot of it for small organic and aquaponic farms across the country. As well as produce a youtube series around it.

The Existing systems are still far too limited, and far too expensive.

But the limitation here will be MY programming inexperience.

So, the way I see this I can do it one of two ways....

  1. Contract a programmer and spend a ton of cash for an open source idea that I intend to give away to small farmers and techies like myself
  2. Bite the bullet and learn to program well enough to complete this project and turn it over to the community when I have it in a usable form

But I have time constraints to contend with. So I need the FASTEST route to success here.

Based on the conditions above, and the Equipment I intend on using, what would be the best direction to go to accomplish the goal of a prototype setup, that can be easily cased for outdoor use and employed long term on a small farm...?

Any help would be most appreciated.

I have worked on several projects here before, and the users were EXTREMELY helpful.

So, hopefully, I'll strike gold twice :slight_smile:

Thanks!

-Z-

zurkeyon:
But the limitation here will be MY programming inexperience.

....... So I need the FASTEST route to success here.

A Mega will do the job - including the items you forgot to include. The speed on your route to success is down to you, and probably depends on your programming experience. Just take it one sensor at a time.

Mega is what I was thinking so far as well.

Because, Pi and SoCs don't have that many inputs and outputs do they?

I mean, isn't this going to take something like the mega to accomplish?

And thank you for the reply.

:slight_smile:

I have never heard of SoCs and I don't know anything about Raspberry Pi, although I understand it is a lot more powerful than a Mega. The thing about the Mega is the memory. On a Uno for this sort of thing, you can run out of memory before you run out of pins. In your case, it looks like you will need the pins as well. I have no idea how you would drive 64 relays, but I bet it can be done, particularly if you use mosfet or the like.

Thank you. Mega is looking like the way to go. Even if I had control of only 32 relays, I think that would be More than enough to cover my needs.

And for SoC, I am just referring to any PI or Odroid or other "System On a Chip" Mini Computer of that type.

I was just wondering if going with a small pi or the like with an OS on it, remote-able, running python scripts, would have enough inputs and outputs to do the job, and if having a remote capable OS on it would be better than a mega.

I really don't know much about the differences in code complexity between the IDE or Python for example.

Is one easier to learn than the other, and would something like a Pi even have enough I/O to do what I propose?

Again, thank you.

I think if this was my project I would use an RPi (or a cheap laptop) and an Arduino. The Arduinos are great for controlling things and collecting data from sensors but building a web interface would IMHO be a great deal easier using Python on an RPi or PC.

A simple serial interface between the Arduino and the PC will allow a two-way flow of data and instructions.

If you are interested in using Python have a look at the Bottle web framework. It makes the creation of a simple web server (or client) very painless.

...R
Python - Arduino demo
Serial Input Basics - simple reliable ways for an Arduino to receive data.
Planning and Implementing a Program

Hmmm, with a mega attached to it, that would kinda kill all the birds with one stone wouldn't it?

Never considered using both.

But now that I think of it, that would pretty much guarantee success.

And give me access to both coding methods.

Plus it adds bluetooth and wifi to each unit without additional modules.

Sounds like a good solution to me.

Gonna start there.

Thanks!

-Z-

Just my opinion, but I wouldn't want to use an AVR for anything that connects to a network and with all the requirements you have stated.
Yes it could possibly be done with an AVR based processor, but due to the internal design of the AVR you really have to wonk up your code to use const data since the AVR processor cannot directly access the flash.

You also say:

  • Needs to be able to operate in an environment alongside many others of itself. Up to 128 units at a time.

You are now talking about a very large system.

For something that connects to network, i'd be looking at something that easily interfaces to a network and has lots of network based tools already available.
The AVR, IMO, is not good at doing network stuff since often network stuff can involve const data or things like html pages or possible files.

I'd go with Wifi vs cabled ethernet since ethernet requires lots of wiring. With Wifi, all you need is power and drop things where ever you need them but when talking about 128 units doing all that you mentioned, that may be quite a large area and need repeaters but even using repeaters is still simpler than wiring up ethernet cabling and all the needed associated hubs and/or switches.
Also, long runs of ethernet can potentially induce voltage from things like lightning so that must be taken into consideration.

In terms of how to pull it all together, I'd look at some existing Automation platforms like openHAB, IFTT, MSQTT etc.... That will provide a good starting point and there are literally thousands of plugins for lots of devices and interfaces that already exist. So you don't have to write all the glue or user interface stuff to tie everything together. You can even interface it to alexa.

Things like the Raspberry Pi zero W would be great for higher level functions/features since you have a full linux OS and all its development tools (including python if you want to go that route) available along with built in wifi.

Things like the esp8266 based boards are nice because they have megabytes of flash, and tons of ram along with wifi to provide plenty of room for code. There are even boards like the Linknode that are UNO form factor which in some cases is beneficial
as it can use many UNO shields. One issue with shields is that many are 5v while the esp8266 is 3v.
The esp8266 can even use part of the flash as a file system for things like web pages, configuration storage, icons, etc....
There are lots of example projects out there using the esp8266 including many automation projects and web based automation.

Neither types of boards of those have tons of pins but you will likely need some kind of separate boards for the i/o and power control anyway.
If those add i/o boards are using SPI, i2c, or modbus, etc... you may not actually need that many i/o pins.

I think at this point you really need to carefully define your actual requirements and think about the overall design.
What you have now seems pretty lofty and you may be able to eliminate some things.
I.e. make sure to distinguish be the needs and the wants so that if necessary you can pair things back.

You also need to consider the overall design and architecture and how it needs to work in your environment.
i.e. you could have lots of very simple/dumb little devices that only do what they are told and can report status for a sensor when queried or you can have more intelligent devices that are designed for specific functions or have to be configured.

Personally, I'd tend to lean to the many simple/dumb devices but that is not knowing your specific needs.

You then have to think about real life things like power outages and/or communication issues.
i.e. if the power goes out, or you lose communication, do bad or even potentially life ending or fatal things happen?
This can affect your design as well.
For example, if you loose communication to a device that turned on a heater does the heater keep running and potentially create an issue?

Lots of things to think about.

--- bill

Bill,

Thank you for your input. Very Helpful.

I am thinking that 32 Relays, or x2 of the 16 channel relay boards, should cover the on and offs I need to accomplish.

If I can control those relay boards with an RPI3, and Still pump in my sensors, that seems more reasonable.

Hence why I am thinking an RPI3 paired up with a Mega.

That solves all my issues as far as connectivity, control, and reading sensor data.

I will have these connected to a somewhat large solar system, with some redundancy, so power should not be an issue.

My Solar Charge controllers all have a 5v 5Amp output on them that I intend to use to power the PI and relay boards. I'll power the sensors off of a separate 5v 5Amp supply.

I really need a single unit, as I am attempting to keep things to a single point of failure. Or as few as possible.

This would also allow me to use something like Unify Mesh Wireless on the farm, and connect the RPI3's up with a nice USB Wireless Card to Guarantee good connectivity.

Not only do i want to monitor my conditions throughout the year, but I also need the alerts.

With aquaponics, since the environment is artificial, a water flow failure or pump failure for example, can kill the entire crop within 2 hours. By allowing the pipe to run dry, the roots completely dry out as well.

So they are not very forgiving.

I need something that will allow me to step away from the farm, as this will be a primarily automated site, and be notified if things go wrong. So that i can drop everything and correct failures of the environment before they cost me a whole crop.

This will be mostly lettuce, so I only need certain variables.

But I am afraid of running out of pins in case I want to add sensors later on.

The RPI3 + Mega option seems to ensure that this wont happen.

As it should be capable of dozens of sensors per mega/RPI and cover my 32 relay switching as well.

It can also host the web page that all of this would report to.

It can be internal, and I would just VPN into it when I need to review information or see the dashboard.

Its starting to look like my all around solution.

It gives me the AVR and Python options, as well as others.

While seeming to meet the other requirements.

300$ - 600$ is still WAY less than the systems I am finding to monitor these variables that come pre-manufactured.

Its like 30,000$ for a monitoring and dosing system for a hydroponics greenhouse.

But with my setup that I am proposing, paired up with This:
https://robogardens.com/?page_id=943

Which is a simple assembly for testing water quality in a more detailed way.

These 2 in concert with a small surveillance system in each greenhouse, will allow me pretty good control and monitoring, for FAR less than places like Cropking.com are charging.

Plus I can do a full youtube and instructables series on it and show others how to get to a useful system more quickly.

Does that sound like an attainable goal as I have described above?

Forget about 16-channel relay boards.
They don't have opto isolation (in case you need it).
Leo..

Now that I have had my breakfast and seen all this, I would like to qualify what I said - I didn't pay attention to all that webserver stuff. I read it, but I'm afraid I dismissed it. A Mega can do all the heavy lifting, and indeed handle the emergency comms, but I don't know anything about webservers and, pardon my bias, I think it is just peripheral fluff anyway. If you are serious about using the web, the simplest approach is to use an Internet of Things facility, whereby you can keep track of things down on the farm live while on that business trip selling your produce in Vladivostok. IoT takes half a dozen lines of code, and is fed with the same plain data as is sent to local display, SD, bluetooth, Excel, etc. - all well within the realm of a Mega. IoT can entertain two-way traffic, but I have only used that to download some historic data.

If you are OK with being hooked up to a laptop, you might look at feeding a plain data stream to Processing. This ought to impress you:...
http://forum.arduino.cc//index.php?topic=194174.0

I really need a single unit, as I am attempting to keep things to a single point of failure.

You might want to re-think that. There can be advantages in spreading things about. I was going to mention the NODE-MCU which has heaps of grunt, built-in WiFi but a dire shortage of pins. This is something I have never understood, but it is not necessarily a disadvantage, and they are very cheap.

Wawa.

This one appears to have opto-isolation, and is very inexpensive.

With x2 of these, I can quickly control 32 devices+

Pairing this up with my Mega, Pi3+, and my sensors, should provide me with the intended platform.
While being wireless, expandable, and capable of running an internal web page / database to log and chart the data into my dashboard.

That can then be PHP, HTML, Java. As far as I understand it.

But I Will likely pay someone to write the dashboard portion.

All I need to learn will be the IDE/Python.

Its a task, but I need this unit, and I can only get exactly what I need here If I make it myself.

I'm still thinking that a PI and Arduino Mega are the way to go.

I understand what Nick is saying about a lot of smaller sensor specific devices.

But that leads me to being the only one who can really work on or troubleshoot the system.

If its centralized, I can teach my employees how to identify most common failures, and there is really only one place to look for them. In the control box.

Or if a sensor is triggering there, and simply not working, then there is only one other thing it can be... The sensor itself.

This will make troubleshooting VERY simple.

Now there is only ONE wireless connect per Greenhouse, one IP, one Mainboard, one Relay Center, one Control box, etc.

Reducing the troubleshooting variables and simplifying the configuration is highly desirable in my circumstance.

Thank you both for your input though.

All of this has been very valuable.

Pi3+ Mega is still winning so far.

:wink:

zurkeyon:
https://www.amazon.com/gp/product/B0057OC66U/ref=ox_sc_act_title_2?smid=ATVPDKIKX0DER&psc=1
This one appears to have opto-isolation, and is very inexpensive.

Correct.
Appears to have, but doesn't have.
The optos on there are just for decoration.
Leo..

Ahh,

I see from the reviews. It appears to share a common ground with the host.

Bad mojo.

Thanks!

8-channel relay boards have a JD-VCC jumper, so you can choose.
That makes it also easier to power the relay coils separately.

8-relay boards also come in the 12volt coil variety (35mA/relay instead of 75mA/relay).

If you use a 74HC595 breakout board with each 8-relay board, then you can control as many relays as you need with just three Arduino pins. That could make wiring a lot easier (relay boards separate from the Arduino).
Leo..

So you are saying to use Shift registers?

I see tutorials about using a 74HC595 on a breakout board and using shift registers to perform multiplexing.

Is this multiplexing serial communications?

It looks like the answer, but I will need to study it more to better understand it.

But again, Thank you!