This repository contains various projects on the STM32H745ZI-Q NUCLEO dual-core development board which will form the foundation of my automated indoor farm project. The main goal is to present the various projects, the steps taken, along with any challenges that were overcome.
- Parallel 4-bit LCD
- Serial Temperature and Humidity Sensor
- DMA Soil Moisture Sensor
- Water Pump I/O 120V Relay
- Bluetooth Low Energy (BLE) RF
- PWM OP-AMP LED Growlight
- CMSIS - RTOS task and scheduling
- Altium Custom PCB
The first project consisted of implementing a parallel 20x4 LCD display. The LCD communicates with the microcontroller using 8-bit data and command instructions sent through the bi-directional data bus. Using the timing diagram and online resources, I created an initialization function that uses the necessary 8-bit commands along with an enable pin, and a register select pin to interpret the type of data (data/command). I was able to split the data into two 4-bit nibbles which allowed me to initialization the LCD in 4-bit mode saving 4 pins on the microcontroller. Some challenges arose when writing to the correct location on the display, timing the initialization sequence, and determining the order to send the two 4-bit data nibbles when in 4-bit mode. In the future, the plan is to switch to an UART/SPI/I2C LCD for the final implementation of this project in order to simplify the schematic by minimizing the pin requirements.
The next project was implementing the DHT11 sensor using single-wire serial communication. This was done using a 10KOhm pull-up resistor between the signal line and Vdd(+3.3V). Had issues with: implementing the timer to have an accurate delay, used ossciloscope to debug the signal line and determined timer delays were not correct. Then used PWM and the osscilloscope to measure the actual period and corrected it through the internal clock configuration. Also had issues with displaying the decimal values of the temp and humidity readings. Had to convert the 8-bit decimal value to float by dividing by 10 then I added it with the tens and ones value to get full value.
Next project I set up the analog capacitive soil moisture sensors, I want to have multiple sensor read using only one ADC, this will be implemented using the DMA to pipe multiple inputs to memory. Tried to set up the DMA1 to transfer adc values to memory but ran into issue with implementation. No data gets passed through dma. Tried using different dma streams, with ADC1 request multiplexed on DMAMUX1 using address 9U. Everything found online points to system level driver issues. Going to implement the adc individually for each soil sensor for now. Researched possible issues relating to the DMA. Found that the STM32H7 has dCache coherrency issues. Have to run cache cleaning and invaildation routines for the MPU to accept new data values in RAM.
This project is licensed under the terms of the MIT license and protected by Udacity Honor Code and Community Code of Conduct. See license and disclaimer.