Use Add-On Boards to Quickly Build a Powerful IoT-Based Greenhouse LED Lighting and Sensor System

By Stephen Evanczuk

Contributed By Digi-Key's North American Editors

In horticulture, the Internet of things (IoT) can play a key role in both monitoring and ensuring plant health using a combination of sensors and specialized horticulture LEDs. However, adapting and implementing the right IoT computing platform with the required peripherals, sensors, LEDs, and connectivity options can be time consuming and put both budgets and schedules at risk.

To reduce this risk, a combination of board and device solutions from Cypress Semiconductor, SparkFun Electronics, and Wurth Electronics, among other components, can be used to greatly simplify the design process while at the same time allow the rapid development of sophisticated greenhouse control systems.

This article will explore the relationship between LEDs and plant health before introducing and describing these solutions, and how to use them together.

LEDs and plant health

Plant health depends on a wide range of external factors including light, temperature, soil moisture content, and pH levels. They respond to various combinations of these factors in aggregate, as well as to the specific characteristics of each factor. For example, a plant depends upon light received within a photosynthetic active radiation (PAR) region lying between 400 nanometers (nm) and 700 nm. Yet, the illumination they require across that region is by no means uniform. Instead, plants require light at specific wavelengths corresponding to the absorption spectrum of the multiple photopigments involved in photosynthesis.

For example, chlorophyll A has absorption peaks at approximately 435 nm and 675 nm (Figure 1).

Graph of illumination at wavelengths corresponding to the absorption spectra of various photopigments

Figure 1: Plant growth depends on sufficient illumination at wavelengths corresponding to the absorption spectra of various photopigments active at different segments of the overall photosynthetic active radiation (PAR) region. (Image source: Wurth Electronics)

Other photopigments, including chlorophyll B, beta carotene, and other photochromes, also serve vital roles in photosynthesis. As a result, optimal illumination for plants requires the ability to deliver illumination at multiple wavelengths in the PAR region.

As with any living organism, the factors that influence health in plants are not limited to a simple set of wavelengths or static illumination levels. Plants require different levels of light intensity, varying light/dark cycles, and even different wavelength combinations, all at each stage of the growth cycle. Similarly, temperature and soil moisture content can cause variations in root length.

This optimal combination of characteristics for each factor can vary across different species, or even across different stages of growth within a single species. For example, many flowering plants require day length less than about 12 hours. In contrast to these "short day" plants, "long day" plants such as beets and potatoes only flower after exposure to more than 12 hours of light.

Greenhouse environments enable farmers and backyard gardeners to control most of the factors. Yet, the lack of cost-effective system platforms, peripherals, and even suitable light sources has remained an obstacle to development of greenhouse control systems. Building a system capable of monitoring and managing these various factors has required complex systems akin to complex industrial programmable logic controllers.

The availability of off-the-shelf boards and specialized horticulture LEDs offers a simpler alternative. Developers can easily create sophisticated greenhouse automation systems by combining boards based on Cypress Semiconductor’s PSoC microcontroller, specialized horticulture LEDs from Wurth Electronics, and an add-on board from SparkFun Electronics. The latter ties in the broad set of sensors and actuators needed in these systems.

High-performance platform

Designed for embedded applications, the Cypress PSoC family of microcontrollers integrates an Arm® Cortex®-M0 or Cortex-M3 core, and a full complement of programmable analog and programmable digital blocks called universal digital blocks (UDBs). Using the Cypress peripheral driver library (PDL), designers can use UDBs to implement a wide range of functions, including standard serial interfaces and waveform generators. Similarly, programmable I/O blocks called Smart I/O, support logic operations on signals passing to and from the GPIO pins, even while cores are in a power saving, deep sleep mode.

The latest PSoC device, the PSoC 6, extends the family with dual-core devices that combine the processing performance of a Cortex-M4 core with the low power capabilities of a Cortex-M0+ core. Along with the 1 megabyte (Mbyte) of flash memory, 288 kilobytes (Kbytes) of SRAM, and 128 Kbytes of ROM found in PSoC 62 devices, the PSoC 63 devices add additional capabilities, such as Bluetooth 5.0.

The PSoC 63 devices integrate a complete Bluetooth 5.0 subsystem including hardware physical and link layers, as well as a protocol stack with application programming interface (API) access to the generic attribute profile (GATT) and the generic access profile (GAP) services at the heart of Bluetooth protocols. Within each series, devices such as the CY8C6347FMI-BLD53, include dedicated hardware crypto accelerators.

With their extensive capabilities, PSoC 6 microcontrollers are able to support the performance requirements of an emerging class of complex embedded applications. At the same time, their power efficiency enables them to support the tight power budgets typically found in these applications. With its user-selectable 0.9 or 1.1 volt core operating voltage, the PSoC 6 microcontroller requires minimal power, consuming 22 microamps (μA) per megahertz (MHz) for the Cortex-M4 core, and 15 μA/MHz for the Cortex M0+ core.

To simplify development of applications based on these devices, Cypress provides versions of its Pioneer kit line for both PSoC 63 and PSoC 62 devices. Based on the PSoC 63, the PSoC 6 BLE Pioneer Kit includes a 512 Mbit NOR flash, Cypress's KitProg2 onboard programmer/debugger, a USB Type-C™ power delivery system, and multiple user interface features. The PSoC 6 Wi-Fi-BT Pioneer Kit combines a PSoC 62 microcontroller with a Murata Electronics LBEE5KL1DX module, which is based on the Cypress CYW4343W Wi-Fi/Bluetooth combo chip.

Hardware extensions

Using the Cypress Pioneer boards to develop process control applications becomes easier thanks to an add-on board developed through a collaboration of SparkFun Electronics and Digi-Key Electronics. The PSoC Pioneer IoT add-on shield is an Arduino R3-compatible shield with Qwiic and XBee-compatible connectors (Figure 2). Plugged into a PSoC Pioneer board, the add-on shield lets developers easily extend the board set with devices such as sensors for monitoring air and soil quality in a greenhouse.

Image of PSoC Pioneer IoT add-on shield (red board) extends the capabilities of Cypress Pioneer boards

Figure 2: The PSoC Pioneer IoT add-on shield (red board) extends the capabilities of Cypress Pioneer boards such as the PSoC 6 BLE Pioneer Kit (blue) with its multiple connector options for adding off-the-shelf Qwiic and XBee-compatible boards. (Image source: SparkFun Electronics)

For monitoring greenhouse ambient conditions, a Qwiic-compatible board such as the SparkFun SEN-14348 Environmental Combo Breakout board uses the onboard Bosch Sensortec BME280 and ams CCS811 sensors to provide data for multiple environmental variables (see, “Add Compensated Air Quality Sensors to the Internet of Things”).

The Bosch BME280 combines digital sensors able to deliver accurate readings on temperature, pressure, and humidity while consuming as little as 3.6 μA at a 1 Hz update rate. The ams CCS811 provides equivalent CO2 and total volatile organic compound (VOC) measurements.

Gas sensors such as the CCS811 need to heat an internal hotplate to perform gas measurements, causing power consumption to rise accordingly, reaching 26 milliwatts (mW) from a 1.8 volt supply in its operating mode 1. This mode provides the fastest available update rate of 1 Hz. Developers can choose other update rates such as mode 3, which performs measurements once a minute and reduces power consumption to 1.2 mW.

Developers simply use a Qwiic cable to connect the Combo board to the add-on shield to program the Combo board's Bosch BME280 and ams CCS811B sensors based on sample software available in the SparkFun github repo.

Soil quality

Besides ambient conditions in a greenhouse, proper soil pH and water content are essential for plant health. Most plants require soil pH levels that are neutral or only slightly acidic, but the optimal pH range can vary significantly. For example, potatoes grow best in acidic soils with a pH of around 5.5, whereas this level can damage plants like spinach that prefer slightly alkaline soils.

At the same time, small changes in pH level, even within the optimal range, can directly affect the availability of nutrients needed to sustain growth (Figure 3).

Image of small changes in pH level affect plant physiology directly

Figure 3: Small changes in pH level affect plant physiology directly, as well as indirectly through its impact on nutrient availability in soil. (Image source: Wikimedia Commons)

Developers can easily add pH sensing to their greenhouse systems using the SparkFun Electronics SEN-10972 pH Sensor Kit. The kit comes with a pH probe, interface board, and buffer solutions for calibration. For communicating with the PSoC microcontroller, developers can use the default UART output from the pH board.

Alternatively, the pH sensor board can be used in I2C mode and connected through the SparkFun DEV-14495 I2C Qwiic adapter. The SparkFun Qwiic adaptor breaks out the I2C pins from the Qwiic connectors and provides solder points allowing developers to easily use existing I2C devices with the Qwiic connector system.

Measuring soil water content is just as easy. The SparkFun SEN-13322 Soil Moisture Sensor provides two exposed pads designed to sit directly in the soil and serve as a variable resistor between a provided voltage source and ground. Higher moisture content increases conductivity between the pads, resulting in a lower resistance and higher voltage output.

For this sensor, the PSoC microcontroller's integrated digital-to-analog converter (DAC) can be used as the voltage source, and its successive approximation register (SAR) analog-to-digital converter (ADC) can be used to digitize the voltage corresponding to the soil’s moisture level. Also, the microcontroller's internal op amps can be used to buffer both the DAC output and the ADC input.

Developers can further extend their soil management capabilities with this same approach. For example, the PSoC 6 microcontroller supports multiple channels on both the DAC output and the ADC input, making it feasible to add multiple pH sensors. In addition, some applications may require greater resolution measurements that require a voltage range beyond the microcontroller's 3.6 volt (max) VDDA analog supply voltage. In these instances, the solution lies in adding external buffer op amps and a voltage regulator.

Along with measuring soil water content, ambitious developers can use the same approach to automate water irrigation by using the PSoC's GPIOs and pulse width modulation (PWM) functionality to control a DFRobot FIT0563 water pump with a DFRobot DRI0044-A driver board.

For additional components, such as these or others, use the SparkFun DEV-14352 Qwiic adaptor. This provides Qwiic connectors and a large prototyping area (Figure 4).

Image of SparkFun Qwiic adaptor

Figure 4: With the SparkFun Qwiic adaptor, developers can easily add custom circuits through Qwiic connections with the Pioneer add-on shield, or by using the provided headers to stack the adaptor with the add-on shield on Pioneer boards. (Image source: SparkFun)

As the Qwiic adaptor conforms to the Arduino R3 shield layout, developers can use the headers included with the Qwiic adaptor kit to stack their own circuits between the Pioneer kit board and the SparkFun IoT Pioneer add-on shield.

Horticultural lighting with LEDs

As noted earlier, plant health depends on light illumination delivered at specific wavelengths. Although advances in LED lighting have delivered solutions for industrial lighting, vehicle headlights, and more, conventional LEDs have lacked the spectral characteristics required for photosynthesis. The Wurth Electronics WL-SMDC series of mono-color ceramic LEDs addresses the need for illumination at wavelengths ranging from deep blue to hyper red (Figure 5).

Graph of Wurth Electronics WL-SMDC series

Figure 5: Individual members of the Wurth Electronics WL-SMDC series of mono-color ceramic LEDs provide illumination at specific wavelengths required for plant growth and development. (Image source: Wurth Electronics)

Used in combination, the SL-SMDC series provides the wavelengths needed to promote numerous aspects of plant growth:

  • The 150353DS74500 deep blue LED (450 nm peak wavelength) and 150353BS74500 blue LED (460 nm dominant) provide illumination in the range of wavelengths associated with regulation of chlorophyll concentration, lateral bud growth and leaf thickness.
  • The 150353GS74500 green LED (520 nm peak) and 150353YS74500 yellow LED (590 nm dominant) provide illumination in a range of wavelengths once considered unimportant, but now known to play a part in shade avoidance responses in plants.
  • The 150353RS74500 red LED (625 nm dominant) and 150353HS74500 hyper red (660 nm peak) provide illumination at the wavelengths most involved in photosynthesis, but also involved in different plant stages including flowering, dormancy, and seed germination.
  • The 150353FS74500 far red (730 nm peak) provides illumination at wavelengths associated with plant germination, flowering time, stem length, and shade avoidance.
  • Finally, the 158353040 daylight white not only augments blue wavelength coverage, but also contributes to the overall daily light integral (DLI) levels needed for overall plant growth.

Developers can find a number of LED drivers such as the Wurth MagI3C 171032401, or the Allegro MicroSystems ALT80800 to drive strings of the LEDs. Many of these devices support dimming regulation using PWM and/or analog voltage, reducing LED driver implementation to only a few additional components (Figure 6).

Diagram of advanced LED drivers such as the or Allegro MicroSystems ALT80800

Figure 6: Advanced LED drivers such as the or Allegro MicroSystems ALT80800 require only a few additional components to drive LED strings with dimming controlled by PWM or analog input. (Image source: Allegro MicroSystems)

In designing a dimming feature, however, developers should be wary of very rapid changes in instantaneous illumination level. At high PWM rates, the human pupil may respond only to average light intensity, permitting pulses of light at harmful intensity levels to reach the retina. The use of constant current LED drivers, such as the Allegro ALT80800, help mitigate this effect.

Software design

Used in combination, the PSoC Pioneer board, add-on shield, and additional boards mentioned earlier, enable developers to physically build a greenhouse control system largely by plugging the hardware boards together. Development of software for managing sensors or driving LEDs is nearly as simple with the availability of components in the Cypress peripheral driver library (PDL).

PDL components abstract the functionality of PSoC features such as programmable analog, UDBs, and Smart I/O peripherals. Developers can quickly implement a software feature that causes the microcontroller to wake when the sensor output reaches a particular level. For example, when the output voltage from the soil moisture sensor indicates drier soil, using Cypress PSoC Creator, developers can configure one of the PSoC microcontroller's integrated low-power comparators to generate an interrupt when the level on the specific analog pin falls below (or above) a reference voltage level.

Cypress demonstrates this functionality with sample code that illustrates the basic design pattern for using the low-power comparator (LPComp) block (Listing 1). Here, when an interrupt wakes the processor from hibernate mode, the code checks the LPComp value. This sample code uses a GPIO to toggle an LED if the comparison result is high every 500 ms. When the result finally goes low, the code returns the processor state to hibernate mode.

int main(void)
        /* Enable the whole LPComp block */
        /* Configure LPComp output mode and hysteresis for channel 0 */
        Cy_LPComp_Init(LPCOMP, CY_LPCOMP_CHANNEL_0, &myLPCompConfig);
        /* Enable the local reference voltage */
        /* Set the local reference voltage to the negative terminal and set a GPIO input on the 
           positive terminal for the wake up signal */
        /* Set channel 0 power mode - Ultra Low Power mode */
        /* It needs 50us start-up time to settle in ULP mode after the block is enabled */
        /* Start the LPComp Component */ 
    /* Check the IO status. If current status is frozen, unfreeze the system. */
    {   /* Unfreeze the system */
        /* Do nothing */    
        /* If the comparison result is high, toggles LED every 500ms */
            /* Toggle LED every 500ms */
            Cy_GPIO_Inv(LED_0_PORT, LED_0_NUM);
        /* If the comparison result is low, goes to the hibernate mode */
            /* System wakes up when LPComp channel 0 output is high */

Listing 1: Cypress sample code demonstrates key design patterns, such as use of the PSoC 6 low-power comparator to wake the microcontroller from a low-power operating mode. (Code source: Cypress Semiconductor)

For a greenhouse control system, the same design pattern could be used to turn on a water pump in response to low soil moisture, turn on fans in response to high ambient temperature, alert the greenhouse owner if the pH level falls outside a desired range, or respond with the many other actions typically required to restore the greenhouse environment to optimal conditions for plant growth.

Developers can similarly employ other PDL components to support other interface and control requirements with minimal code development. For example, to use the PWM component to control LED intensity, simply drag the PWM component onto the PSoC Creator design canvas and use the related configuration popup to set specific PWM parameters such as run mode, period, and resolution (Figure 7).

Image of Cypress Semiconductor PSoC Creator

Figure 7: The PSoC Creator can be used to schematically build functionality with the Cypress peripheral driver library (PDL), or the PDL application programming interface can be used to work solely at the code level. (Image source: Cypress Semiconductor)

After configuring the component and completing the design, the PSoC Creator is used to generate the basic code framework, adding custom code as needed. Alternatively, developers preferring to skip the schematic entry phase can use the Cypress PLD API for direct access to the underlying functionality. Developers can also mix the approaches, using code generated by PSoC Creator to gain a deeper understanding of the PDL before developing their production code using the PDL API.

Using this approach, it’s possible to quickly implement the code necessary to support each feature described in this article. In deploying the resulting control system design in a small greenhouse, developers could conceivably use a single Pioneer board and PSoC Pioneer IoT add-on shield to support the necessary sensors, actuators, and LEDs.

For deployment in a larger greenhouse environment, a cost-effective approach would distribute features such as soil pH measurement and ambient temperature measurement in ground-level board sets, using separate board sets to control the horticulture LED strings. Developers could further reduce cost by using the PSoC 4 BLE Pioneer board to support peripheral sensing and control features.

Because the PSoC Pioneer IoT add-on shield is also compatible with this board, it’s easy to reconfigure each board set with the appropriate complement of devices. In this situation, the PSoC 4-based board sets would link via Bluetooth to one or more PSoC 6 boards, or take advantage of the Wi-Fi connectivity of the PSoC 6 Wi-Fi-BT Pioneer Kit to connect to cloud-based services such as ThingSpeak for data analysis and display (Figure 8).

Diagram of PSoC-based systems including the PSoC 4 BLE Pioneer kit and PSoC 6 Pioneer kit

Figure 8: Developers can combine multiple PSoC-based systems including the PSoC 4 BLE Pioneer kit and PSoC 6 Pioneer kit to support complex applications linked to cloud services such as ThingSpeak. (Image source: Cypress Semiconductor)

In this case, developers can take advantage of the Cypress Bluetooth support for the full complement of secure connectivity capabilities, (see, Build a Secure, Low-Power Bluetooth Hub and Sensor Network).


Automated greenhouse control systems used to require industrial-grade controllers linked to complex lighting systems, sensors, and actuators. As shown, developers can now take advantage of low-cost microcontroller boards and add-on boards to build cost-effective platforms able to leverage a broad array of available sensors and actuators.

Combined with the IoT and the availability of specialized horticulture LEDs, developers have a full complement of components required to implement sophisticated applications able to remotely monitor and control many of the factors associated with healthy plant growth and development.


  1. LEDs – The Future of Horticultural Lighting

Disclaimer: The opinions, beliefs, and viewpoints expressed by the various authors and/or forum participants on this website do not necessarily reflect the opinions, beliefs, and viewpoints of Digi-Key Electronics or official policies of Digi-Key Electronics.

About this author

Stephen Evanczuk

Stephen Evanczuk has more than 20 years of experience writing for and about the electronics industry on a wide range of topics including hardware, software, systems, and applications including the IoT. He received his Ph.D. in neuroscience on neuronal networks and worked in the aerospace industry on massively distributed secure systems and algorithm acceleration methods. Currently, when he's not writing articles on technology and engineering, he's working on applications of deep learning to recognition and recommendation systems.

About this publisher

Digi-Key's North American Editors