All posts by Lucky Resistor

Long-Term Test Finished

I finished my long-term test of the minimal version of the data logger project after a few days. To simulate the situation for the actual usage, I setup the data logger to record data in 1 hour intervals.

The test answered these questions:

  • Does the data logger function properly over several days?
  • How much battery does the data logger use?

I could not answer the first question until I stopped the data logger and read all values over the TTL cable. I found this is a little bit tricky, because the microcontroller did reset as soon I attached the TTL cable. This automatically restarted the logging and logged some additional value, visible in the chart.

The battery life is hard to measure. I used a multimeter and measured the voltage on the battery. At the end, the voltage was still over 4.0V, which means the battery pack is almost full charged.

I would need to connect the battery to an analog input of the microcontroller, using a MOSFET as a switch. So I could measure the battery voltage over time.

Importing the Data

Working on Mac OS X, I am using the screen command as serial console. If you add the parameter -L to the command, the whole output is automatically logged in a file.

LR: ~lr$ screen -L /dev/cu.usbserial-FTHXXXXX 57600

I opened the file using BBEdit and removed any lines before and after the actual data. After the edit I saved this edited file as “data.csv”.

Temperature Humidity ChartTo get a little bit more options for the diagram, I used Microsoft Excel. After the import of the data, I formatted the columns, added a title and created a X/Y chart from it. After fine tuning all the titles, formats and lines I created a nice chart and could export it as PNG file.

You can see the chart as feature image of this article, or click on the thumbnail on the right side to see the full resolution version.

Conclusions

If you look at the chart you can clearly see the problem of the minimal version. It logs just integer values without fractions which is clearly not enough for the temperature. The sensor is capable of a higher precision, but not accuracy. But the higher precision will make trends better visible in the data.

What is Coming Next?

Next I will implement the simple version of the data logger. This will add additional 32KB of storage to the device, using the Non-Volatile FRAM Breakout from Adafruit. With this “vast” amount of storage, I can use a 14 bytes record which stores the date and time as unix time-stamp, using a float for humidity and temperature and a real CRC-16.

Date/Time    4b
Humidity     4b
Temperature  4b
crc          2b
---------------
total       14b

This will allow 2340 records in the FRAM, which sums up to 97 days recording time at one hour intervals.

Data Logger Documentation Online

I just published the minimal version of the data logger project. The minimal version uses the built-in EEPROM of the microcontroller to log sensor data. I decided to create this additional minimal version because it works for very simple cases and does not need any external memory.

Data Logger Wires

The data logging mode is controlled using a BCD DIL switch. Using this switch you can select logging mode, read mode and format mode.

Data Logger Mode Select

The documentation is explaining how to create this data logger in detail. All about the parts, how to build the hardware, how to build the software and a detailed page which explains the software in detail. There is also a short overview of the project and how to use the final device.

Start reading the detailed documentation here:

The Data Logger Project

If you have any questions or feedback about this project, feel free to leave comments on these pages.

Are My Documents Safe in the Root Cellar at ~80% Humidity?

Update 2015-08-21: Added the wiring diagram.
Update 2015-08-24: The documentation for the minimal version is online here.

There is a large cellar where I could store unused items and documents, but the catch is the humidity there. It is a root cellar near a small brook and the humidity varies between 75% up to 90%.

Archived material should never be exposed to humidity greater than 65%, therefore I have to isolate all documents in boxes from the air of the cellar. But are this boxes safe? Do they keep the humidity away from the documents – even for years?

To have a look into the box environment, I need a data logger. It would be simple to buy one, but much more fun to build one. So a new project is born: I call it the “Data Logger” project.

There are a few phases to realise this project:

  • Prototype (done)
  • Simple Version (in work)
  • Deluxe Version with Display and Case

The Prototype

For the prototype I used a large solderless breadboard from 3M. There I actually just tested the components for the simple version, especially if the protocols are working and if I can use them in the way intended. I will keep this section short and explain everything in detail in the next section. Just to remind you, I tested everything on a breadboard before I soldered the components to a stripboard.

Parts of The Simple Version

The simple version should be a data logger which automatically starts logging temperature and humidity values it it is powered on. Using a small switch, I can select between logging, reading and erase. In the reading mode, the logger will send all logged values to the serial interface.

Because I need quick results, I will build the whole device using components from Adafruit. Here a list of components I will use for the simple version of the data logger:

Continue reading Are My Documents Safe in the Root Cellar at ~80% Humidity?

Lucky World – A jump’n’run game for MeggyJr RGB

Today I release a full featured jump’n’run game for the MeggyJr RGB platform. It has an intro, a level map with more than 16 levels packed with obstacles and even a end scene. This game uses most of the flash of the ATmega328P and it was an interesting challenge to keep everything as compact as possible. In the past, when I learned to develop software, a very limited RAM was normal. Creating this game for this platform brought back a little bit of this nostalgia.

I release all sources of the game under the GPL v2 license. Feel free to create your own fork and improve this game even further. You can download a ZIP with the sources for version 1.0 here:

https://github.com/LuckyResistor/LuckyWorld/archive/v1.0.zip

To give you a quick impression of the gameplay, I created the following video.

Read more about the requirements for the game in the sections below.

Continue reading Lucky World – A jump’n’run game for MeggyJr RGB

Source Code for Xmas Decoration on GitHub

Today I found some time to document the source code for the xmas decoration and push it to a GutHub repository. I added some comments to explain some of the cryptic calculations and added warnings what you should not copy from this code.

The link to the repository is: https://github.com/LuckyResistor/XmasLights

Have a look in the complete project description how to make your own color changing xmas decoration.

How to Create Color Changing Xmas Decoration

Update: Read the full project description here.

The days are getting shorter. You do not have to fear the dark, this is the right time to create a fancy color changing Xmas decoration. This is a very simple project and is quickly done.

Required Parts

  • “Silver” laminated paper and/or half transparent paper.
  • NeoPixels from Adafruit (Flora RGB smart Neo Pixel version 2).
  • Arduino Uno
  • AC/DC power supply 9V, >500mA
  • Thin multi conductor cable with 4 wires, or 3 wires plus shield.
  • Eyelets and screws with nuts

Continue reading How to Create Color Changing Xmas Decoration

All Meggy Jr RGB Colors

I created a complete color table with the impression of all possible 4096 Meggy Jr RGB colors. The green LED is much brighter than the other two LEDs, the first tables used blue as base which does not make much sense. So I created a second set of tables which use the bright green as base.

If you like to create own tables or if you try to create something like a simulator or color lookup, here a ZIP file with all colors as individual PNG images: MeggyJrColorLEDs.zip

MeggyColorGreen_0

Continue reading All Meggy Jr RGB Colors

How to Debug Time Critical Code using an Oscilloscope

From time to time you have to debug time critical code. If you are using interrupts, you are interested in the actual performance on the code. This is especially true, if you are using timed interrupts.

In this cases, using the serial interface is impossible. If you write to the serial interface, the whole timing of your application changes and you will get no usable results.

If you own an oscilloscope, there is a really simple way to debug many applications. I used this technique many times, for example with projects featured on these pages: For the timing of the sound output of the cat protector, or the timing of the display interrupt of the Meggy Jr library.

This technique is obvious ans simple. Nevertheless I hope this article will give some inspiration to help solving timing problems.

Continue reading How to Debug Time Critical Code using an Oscilloscope

A New Library for Meggy Jr RGB

I planed to create a game as a gift and use the really great Meggy Jr RGB platform for it. See the picture above, it’s a great game machine powered by the ATmega328P (buy it here). You can use the Arduino IDE to program it.

After assembling the device, I played a little bit around with the provided library — but was a bit disappointed by the library. This is a game device after all, but the library lack in my opinion some important things a game library need.

So I wrote a new library from scratch, using the provided schema and documentation (you can see the printed out schema in the background of the picture). Sometimes its better to start from scratch and learn from the mistakes of other libraries.

Today I release the first version of the library at GitHub here: https://github.com/LuckyResistor/LRMeggyJr. It has a proper API documentation and a few examples. I release this early, but hope to improve the documentation and add examples while I develop the actual game.

Download the release v1.2 as a ZIP

Continue reading A New Library for Meggy Jr RGB