Arduino based Plant LED Lighting – Iteration 1

After years of procrastination, the itch to get into hydroponics needed attention. Before jumping headfirst into the unknown, a quick experiment to see how the plants responded to neopixel LED strips was in order. As such, I’ve put the MEAN stack exploration on hold.

Objective

Can the neopixel LED strips provide enough lighting to grow herbs and other leafy vegetables?

Materials Used

Putting it Together

The following diagram illustrates the wiring.  The LM35 when used with other analog inputs leads to erratic readings. The capacitor stabilizes things.

The software is straight forward with the xbee operating using AT mode rather than API mode.  For now, I used modbus to communicate to Mango and for giggles VT-Scada. More on that in a future post as the IIoT speak I hear from certain vendors — not the two mentioned–make me cringe knowing what they have under the hood.

Software Feature List

  • set time from host via modbus  or terminal console
  • set lights on time via modbus or terminal console (default 18 hrs on)
  • set lights off time via modbus or terminal console (default 6 hrs off)
  • set duty cycle via modbus or terminal console
  • set duty cycle period via via modbus or terminal console
  • get temperature via via modbus or terminal console
  • get soil moisture via via modbus or terminal console
  • force the lights on or off via modbus or terminal console
  • save/load/restores settings to/from EEPROM

Modbus was used as I already had a SCADA host running. It could have been xbee API or bluetooth. Having done both, this is relatively easy to refactor the code later.

The code can be found at https://github.com/chrapchp/PlantLEDLighting. Not the prettiest code yet it it does the job for this experiment.

Periodically changing the red/blue ratio aka duty cycle between 70-95% red with the remaining in blue light tainted the experiment. Regardless, it is logged in the SCADA/HMI host for further analysis.  Interestingly, the research around  LED-based plant lighting is growing along with plenty of do-it-yourselfers experimenting.

Lessons Learned

On the Mega front, the Chinese knock-off ended up with causing more trouble that they’re worth. Problems included the following:

  •  voltage regulator fried
  • TX1 via the header pin did not work
  • headers were loose
  • finding a driver took extra goggling

Needless to say,  I ended up purchasing the real one.

Wiring xbees on breadboards gets old fast. The current setup consists of switches to commission/reset and  a potentiometer to vary the input voltage for testing a device. Nevertheless, I  purchased the wireless connectivity kit  (S2C) and the pro version of the xbee  to facilitate the configuration and program some custom functionality in the xbee in the future. Highly recommended if xbee development is on the radar. BTW, digikey Canadian or US site offer great service and fast delivery. I’ve ordered from them several times.

Observations

Herbs

The basil and oregano took a couple of weeks to germinate followed with a slow growth rate.  In contrast to what others are doing, the growth rate falls far short with expectation.

Leafy Vegetables

The kale and arugula germinated in 3 days and grew relatively fast. The weak stems could be attributed to the LED’s . I’ve planted some outside as well and will compare the stem sizes with the indoor ones.

Minor Changes

The addition of a fan to create a light  breeze led to stronger stems. After a couple of weeks of circulation, the arugula and kale stems seemed stronger. The basil grew and looked healthy yet remained small. When compared to their outdoor counterparts, the healthier looking indoor basil prevailed.

Next Steps

There seems to be some confusion out there between lumens and pars. I read about people only measuring lumens for plants and scratch my head.  Consequently,  I like ChilLED‘s pitch in positioning their lighting products as well an intro-101 from Lush Lighting.

Incidentally, a buzz exists stating the effects of UV could lead  to ‘certain’ plants to produce more THC. Note, I am not interested growing those plants and just want to grow edibles all year round.  At any rate,  I think the root cause revolves around the low LED pars and power rather than the effects of different soil, nutrients, and seeds.

In short, I’m considering using ChilLED for sourcing my lighting needs provided that  controlling the output of the various channels without using their controller remains feasible.  Note  growmay5 provides some interesting vlogs on this as well as other topics around LED plant lighting.

Altogether, I’m satisfied with experiment and how quickly I could mash up a solution. Hydroponics is the next step with better LED lighting and queued for later this year as a project.

 

Kale

Temporary setup

 

Slapped together hardware

 

 

Empowering the Many

Hello MEAN stack

A few years ago I had boat loads of temperature envelop data of my house and outside temperature. When I was looking for quotes to re-insulate my old house, an insulation vendor expressed interest in purchasing my before and after analysis and results. I did not proceed with a full re-insulation of my house but did end up loosing my data which was 100% my fault. I did not back up to a NAS and experiences a hard drive failure.

Fast forward today. There is lots of talk of IoT, Analytics, and cloud services. Many, I feel are putting lipstick on their outdated products so buyer beware.  That said, the various IoT ecosystems provided through services such as Microsoft Azure, etc. are making it easier to mashup, collect, aggregate, and analyze data. Alarm Management, historians may become moot at some point unless vendors provide added value services such as predictive analytics and performance management solutions.

My interests these days revolve around machine learning and visual analytics but I do like to keep on top of some technology that can be used to marry IoT with the enterprise. With the handful of XBee devices lying around, I’ve set my eyes to ramp up on the MEAN (MongoDB, ExpressJS, Node.js, AngularJS stack and see what I can come up with for my own use at home. I chose a Typescript/Javascript environment as I can get by with basic open source tools and decent editors without having to get something like visual studio.

Key System Architecture Components

 

1-configure XBee end devices to sleep and send to coordinator AI/DI data. (I’ve tested this a few years ago so I know it works) (Temperature, ambient light, etc) Mesh network using API mode.

2. 0 or more routers to relay the messages from the end devices to the coordinator

3. 1 coordinator that feeds into the system via serial port

4. Node.JS+ Express to handle the configuration of the I/O wired to the XBees. e.g. scaling, tag name, etc. MongoDB to persist the data, and angularJS to render the UI.

5. There are three IoT platforms ( GE Predix , XivelyThingSpeak, and Azure IoT )  that I have accounts with that I would like to push data to to test it out. I have two SCADA and one HMI system that I am also going to test out the IIoT readiness.

6. My home power monitoring has been running for 8 years on arduino and XBee. The next step is to push data rather than poll from the host to see what that SCADA system can do.

Further down the horizon the inclusion of some  MQTT flavour and and node.js integration.

Pin Sleep Xbee with Arduino Host

Making it work.

I got everything to function with a rather messy board setup as shown below.

The output from the Arduino shows the delta T between messages received from the end-devices.  It is pretty close to the calculated ones. I will change the duration to be 15 minutes later on but for debugging purposes 10s intervals for pin sleep is tolerable.


Continue reading

Sleep Mode

I opted for hardware driven sleep mode (SM=1) in the XBee. I felt that that cyclic sleep mode (SM=4) to be a pain to setup. I felt that that keeping the XBee asleep for extended durations, the device would be MIA from host. With a hardware based sleep, I could use a swith to to force  it awake, configure remotely with the software tool I wrote, flick the switch back to the timer based sleep. Simple in my mind.

Continue reading

New Project – Xbee Mesh Network and Data Collection

I needed a project to dabble and distract me in a constructive manner.  The goal for this project is to build a low power data collection network to sample  slow changing analog data such as temperature, ambient lighting, among other things. The constraint given was to use XBee Series 2,  run in API mode, and operate on batteries.

I purchased 5 XBee Series 2s to experiment with. I used X-CTU software to configure the Xbee chips as per the last project I did. The difference this time is I did not want to use AT mode but API mode to give me more control over XBee interactions from the Arduino host software. The  project context is as shown below.

Arduino to-be
Continue reading

xBee, Debugging, et al

Relatively Easy

I’ve been busy with work and never have the time to get back to this project. Anyway, I penciled in a few hours to wire up the xBee transmitter/receiver to the arduino. The xBee explorer is a time saver. What I wanted to do is to program the arduino over wireless as well. Given that time is limited, I opted to just send data over wireless to simplify connectivity.

The xBee explorer had 4 connection points that made it easy to hookup:

  • +5 to arduino +5
  • gnd to arduino ground
  • dout to rx (pin 1 of ardiuino)
  • din to tx (pint 2 of arduino)

That is pretty all that is required to wire up the xbee. The explorer takes care of the 5v to 3.3v level shifting.  Remember I am using the Duemilanove as the reference board. Note that you can’t plug in the USB in the Duemilanove and xBee in the explorer at the same time. The two will conflict with each other. This is rather trivial to hook up so no wiring diagram other than pin connection mapping is provided.

On the host side, I used the USB explorer which is basically leads to a plug and play model which I like.  Rather than regurgitate xBee configuration, I found that it is well explained here. (Xbee Configuration tutorial)  I tweaked the PAN, Baud rate, and type. I made the host a coordinator and the slave device a routing type. Again, explained well in the tutorial.

Just like the other parts of this project, I found soldering and wiring it up the hardest. I used left over wire wrap wires (I think the stuff is 20 years old) to connect things. I don’t wire wrap them and still solder. I like it because it is not tot bulky. It does break easy though.   Anyway, I have a renewed appreciation for those who package hardware. Although mine works, only a mother could love the way it looks. Alas, it is for my own use so prototype mode is good enough.

xbee

Current Transformer Revisited

I revisited the current transformer wiring in the context of safety. Rather than use terminal blocks, I should have used simple audio jacks to simplify the wiring. Either way, there was a safety issue that loomed in the back of my head and I wanted to address it before wiring the sensors to the power mains. The secondary in an open circuit mode of a transformer (not connected to anything) can reach a high voltage and should it come in contact to a person, guess who is going to be the resistor for that voltage to close the circuit. You.  It does not take much to kill you.

What I did was add a switch that shunts (shorts) the secondary of the transformer that I flip to “field work mode” before handling the terminals.  This is not like shorting a 120 AC line. The voltage on the secondary is the function of the reflection of the impedance on the primary. This can get mathematical so I will spare the math. Suffice it to say that shunting the secondary won’t hurt the current transformer and will add another level of safety.

Hardware

Measuring Current

There are two ways I am willing to entertain for measuring current. One is via a current transformer and the other vial hall effect.

I combed the web to look for affordable devices in North America. It seems that Europe has access to cheaper current transformers.  I ended purchasing three  (3) current transformers and two(2) hall effect chips.

Two (2) revenue Grade Current Transformer Two from CR Magnetics to install on each side of my 200A pannel per each side  (CR8459-2000-N)

One (1) general purpose 0-20A for experimentation CR Magnetics  (CR8410-1000)

Two (2) Hall effect bases chips from Allegro ACS712ELCTR-20A-T

I ordered on-line via Digi-Key and found to have an excellent customer experience. I opted for one stop shopping for other goodies such as zigbee chips and other odds and ends. I also wanted something Canada friendly so I picked a place that operates in both Canada and US.

I entertained the idea of spit-core transformers to facilitate wrapping around the wire. I could not find some at a cheap rate and figured some higher quality ones could be used for permanent installation. I’ve done enough wiring to feel comfortable inside the panel box. I would not recommend venturing in high voltage areas without a good understanding what can harm you. Get an electrician to wire those if you have any doubts.

Measuring Voltage

I have a bunch of AC transformers lying around so I plan on using those to measure the AC voltage.  120:10 volts p-p will do as that is all I have in stock.

Embedded System
I entertained the idea of using a multi-tasking OS such as The FreeRTOS Project and finding a board to host it. The KISS principle forced me to focus on deploying hardware to perform specific tasks and avoid creeping elegance. I only want a device that at will feed into the mesh network. No sense over engineering things. I can use the FreeRTOS for a data concentrator later on. There were many choices out there e.g.  PIC and Micromint. I opted for simplicity and went with the Arduino Duemilanove.

I purchased my Aduino from spikenzielabs along with the following to help me get ball going.

  • Arduino Duemilanove w/ Atmega328
  • XBee Explorer USB
  • Adafruit Proto Shield for Arduino
  • Basic 16×2 Character LCD – White on Black 5V
  • Breakout Board for XBee Module

power parts

Time to plug things in and see what happens.