Giter Club home page Giter Club logo

plant-health-probe's Introduction

Plant Health Probe

Plant Health Probe

A personal project by Michael Hogue.

Introduction

This repository contains all of the source code (and gerber files for the PCB) written for a system which monitors plant health-affecting conditions via 3 on-board sensors. The system monitors soil moisture, light intensity, and temperature. A re-purposed Nokia 5110 LCD is used to output details on conditions sampled by the sensors. A button is included on the board to cycle through 3 views. The first view shows 2 percentage bars for the current amount of soil moisture and light intensity. The second and third views show more details about the soil moisture and light intensity, respectively.

I started this project in order to introduce myself to building software for embedded systems. My goal was to create something that was relatively simple to complete, but was enough to challenge me in an area I haven't worked in before. The challenge was to write a bare-metal program in C that would be efficient and achieve the goal I had in mind for the end product. I chose the RP2040 microcontroller on the Raspberry Pi Pico development board for this project as there is a great C SDK that provides many useful tools, while still staying close to the metal.

Demo

(Click to watch)
Demo Video

Hardware Components

Challenges I Faced

One major hurdle I had to overcome was dealing with hardware. I had never before read a datasheet or designed a PCB and I had only ever soldered a few times. However, in order to communicate with the sensors and the LCD, studying the datasheet was necessary. In particular, the datasheet was extremely important when writing the driver to communicate with the DS18B20 temperature sensor as I not only needed to know which commands to send it, but also the timing of communication over the 1-wire bus. The RP2040 also does not contain any dedicated hardware for the 1-wire protocol, so I had to program one of the PIO state machines on the MCU using PIO assembly. This was a much more elegant solution than bit-banging the temperature sensor.

In addition, I made a couple of mistakes when designing the PCB.
First, I drew a trace from the LCD's SPI enable pin to the incorrect pin on the Pico. The pico has dedicated pins for each SPI function which route to one of the on-chip SPI blocks. The solution to this problem was simply to solder a wire connecting the incorrect pin to the correct pin on the back of the PCB.
Second, I incorrectly wired the 1-wire bus for the temperature sensor. The 1-wire bus requires a 4.7k pull-up resistor connected to VDD. However, in the PCB design, I have the resistor directly wired between the temperature sensor and the Pico. The simple solution to this design error was to use the RP2040's internal pull-up on the 1-wire data line.

What Could Be Improved

  • Device could include more sensors, such as a soil pH sensor.
  • New PCB design could fix the issues mentioned above.
  • My soldering...

Contributing

I strongly encourage anyone to open an issue if you spot anything in the code which I could have done better. I am open to all constructive criticism!

Credit

Inspiration for using the on-chip PIO for the DS18B20 driver came from:
https://www.i-programmer.info/programming/hardware/14527-the-pico-in-c-a-1-wire-pio-program.html?start=1

ALL other code written for this project was done only by me.

plant-health-probe's People

Contributors

michaelhhogue avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.