Close

First Log Entry

A project log for Environment Monitor

Monitor temperature and light levels. More features to come!

peter-mowenPeter Mowen 02/04/2019 at 16:460 Comments

As an introduction to programming an Arduino, I decided to purchase one of the Arduino starter packs. It sat on my shelf for a few years, but I finally got around to exploring it…

One of the projects in the starter book is called the “Love-O-Meter.” In this project, the reader builds the “Love-O-Meter” using a thermistor and a few LEDs. A user squeezes the thermistor and the “Love-O-Meter” lights up LEDs depending on the temperature reading from the thermistor.

I thought it would be a cool idea to use this project as the basis for an environmental monitoring system so started designing a thermometer based on the “Love-O-Meter” code and schematic.

One of the major concepts introduced in this project is printing to the serial port. However, the Arduino IDE only displays the data on the serial port and does not have a way to automatically record and store it. To overcome this shortcoming, I looked-up how to communicate with an Arduino using Java. I found the jSerialComm library and wrote a Java program to record incoming data.

One of the “features” of the Arduino Uno is that it restarts its sketch whenever the serial port is open. At first, I thought this was kind of annoying, but I figured out how to make use of it in the Java program. After the Arduino Uno restarts, it prints random substrings from whatever sketch was loaded to it. To ignore this junk, I inserted a start phrase into the setup method that prints “Arduino Starting Up…” to the serial port. The Java program looks for this start phrase before it starts collecting data. Once the program finds the start phrase, it looks for substrings that start with an “@” sign and end in a newline. In a later version, I plan to implement regex to scan for specific patterns.

At this point in time, I have fabricated a thermometer that reports the temperature in Celsius representing the temperature using binary and 7 LEDs, one LED indicates whether the temperature is positive or negative and the other six are used to represent the temperature. The Arduino checks the temperature every so often (the user can tweak how often it checks), prints some data to the serial port, and updates the LEDs to display the temperature.


Some future updates to the environment monitor device:

Arduino Hardware/Software

Discussions