Another greenhouse/weather station project (off-grid, very custom); MQTT; Node-Red

This is yet another greenhouse project with cobbled together components. The main goal is to have a semi-automated system to water plants in a greenhouse as needed. We are completely off grid.

The first iteration of the controller will be more or less a Frankenstein - I have a lot of old acquired parts that were never put to full use. So, hopefully, I will make all the mistakes so you don’t have to.

Maybe there will be a multifunction controller in the future. This project is also attempting to solve a data flow / notification problem I currently have in my current off grid system. I am hoping this is solved with use of MQTT and Node-Red.

Designing a Multifunction (Greenhouse) Controller

I’ve always wanted my own weather station too. So, when I started in on Arduino, I picked up a SparkFun Weather Shield (DEV-12081) a while ago. This part was designed for the Red Board / Uno. We will be remapping the pins so this shield works with the Mega 2560.

This project will use an Electron in the greenhouse more for backup communication over the cellular data airwaves. The primary data pathway will be greenhouse/Xbee to Xbee/Photon which will attach to the home wireless. The house wireless is too far from the greenhouse otherwise I could make this simpler.

I will provide a complete component list later. A general component list for now:

  • Solar panel; MorningStar TS-45; 12VDC battery for the greenhouse (main power source)
    • B00Q48BRFO: DROK® LM2596 Adjustable Voltage Regulator DC (power to Mega 2560)
    • Particle Relay Shield; provides power to Particle Electron
  • Some sensors from the Particle Electron Kit (in particular soil moisture)
  • SparkFun Weather Shield (DEV-12081) + sensors
  • Arduino Mega 2560
  • DripWorks: Individual Plant Irrigation Kit - Medium (Without Timer) (KIP2)
  • WHALE FW0814 WaterMaster providing the 30 PSI to the drip irrigation (12VDC pump)
  • Particle Electron to allow access/monitoring as needed by cell data
  • Particle Photon to provide the bulk data flow to the internet instead of using cell data
    • The backup data path here would be to go I2C from the Photon to a Beagle Bone Black or Raspberry Pi.
  • XBee 2mW RPSMA - Series 2 (ZigBee Mesh); to provide communication between the greenhouse and the house
  • I2C(Wire) will be used to pass data between devices as needed

Should be fun and hope to share code, libraries and experiences along the way. All the hardware is here and the code is slowly coming together. Time is the issue! The first part is to get the pump automated. The second part is how to optimize the data flow/notifications.

2 Likes

Github repository; Most of the traffic will be out there until things become functional and I can post some more results.

There is a lot more stuff that @Webb.Peter provided a link to in a separate post. It is going to take a bit of time to cruise through this Github repo for the Personal Food Computer v2 (beta).

Looks like a good sandbox environment for Node-Red and MQTT in the cloud.

https://docs.losant.com/getting-started/what-is-losant/

Will investigate later. Still hammering on the wiring and programming.

Let us know how it goes! :sun_with_face:

At least two things to consider on the OpenAg front:

Not necessarily designing a product, but if I am rewriting any libraries, these might be some good considerations. The MVP might be the using smaller Arduino devices like the Uno in which a complicated library just won’t fit in 32k. Do you create a complex library to cover 5.0V vs. 3.3V references, interrupts, I2C vs SPI vs. plain Serial? or do you create many separate libraries to keep these small and compact? There are many copies of sensor libraries to choose from…

There is a wind direction sensor that claimed to have a very linear scale. It may be an old sensor too. Doing a calibration test shows that it is not so quite linear. The code is quite simple between the two, so one could write the library in two ways with linear or nonlinear as #define definitions. That may get too complicated for the MVP types.

Time to sleep on it.

1 Like

On the Particle side the general guidance seems to be:

Are there any format preferences?

  • Tabs vs. spaces
  • Spacing? 2, 4, …?

Braces format preference?

void function () {
  // code
  if (a == 0) {  }
}

or

void function ()
{
   // code
   if (a == 0)
   {
   }
}

Just took a spin on the Particle Dev for the desktop and it is very nice. I particularly use vi/vim.

A question on the Particle Dev is there a way to have it save to a particular target name like Particle CLI can with --saveTo?

Very minimally installed and is working and publishing to Ubidots. Relay shield works too with the Electron. Looks a bit funny with the front hanging over the edge.

Had a brief hit to 57C which is near the top of the suggested operation range. No dropout reported. Will get things shielded or more protected shortly.

Still a long way to go.