Pro Mini Logger Project for the Classroom [ EDU v2: 2019 ]

Last year’s intense deployment schedule focused on getting more sensors into the field, which left little time for development of new approaches to the logger itself.  Now that everything is settling back into the school term routine, it is time to update the “classroom edition” with feedback from three years in the trenches. The build from 2016 focused on reducing construction time, so students could focus on sensors and programming for their final projects. While that design achieved it’s goal, it was low on some other important skills like soldering.  But limited lab time meant that something else had to give if we want students to “pay the iron price” for their data: 

This new configuration uses a pre-made box which does provide more elbow-room inside the housing, even though it is not as rugged as the round 4″ PVC housings. Several of the student projects required de-bounce circuits, or ADS1115 amplifier modules, and the addition of a small proto-board will make it easier to integrate those types of additional components with the logger.   

PARTS & MATERIALS

 

TransparentSinglePixl
Bill of Materials: $16.40
Plano 3440-10 Waterproof Stowaway Box
Much cheaper at Amazon as “add-on” items, so you need to reach $25, before you can order the boxes for $3. Fortunately they sell lots of other useful things like silicone wire, double sided tape, conformal coating, or even the Pro Mini clones. So it’s not hard to reach that minimum order requirement.
$3.25
4Pin 24AWG IP65 Black Waterproof Cable Connector OD 4mm
Better quality version is available at Adafruit for $2.50 each, wBL-RED-Wht-Yel colors used here for the I2C bus.
$1.00
M12 IP68 Nylon Cable Gland
Adjustable for 3mm-6mm diameter. You need two for the build. Make sure they include O-rings.
$1.00
3/4″ Schedule 40 PVC Cap
Diameter will depend on the size of your sensor breakout board. Get ones with FLAT ends.
$1.00
White 170 Tie-Points Prototype Breadboard $0.50
Pro Mini Style clone 3.3v 8mHz
Get the ones with A6 & A7 broken out at the back edge of the board.
$2.20
Nano V1.O Screw Terminal Expansion Board
Note: To save time, you can spend an extra $1 for pre-assembled boards by Deek Robot, Keyes, & Gravitech.  
$1.05
DS3231 IIC RTC with 4K AT24C32 EEprom (zs-042)
Some ship with CR2032 batteries already installed.  These will pop if you don’t disable the charging circuit!  
$1.25
CR2032 lithium battery  $0.40
4 poles/4 Pin 2.54mm 0.1” PCB Universal Screw Terminal Block Connector $0.40
SPI Mini SD card Module for Arduino AVR
Buy the ones with four ‘separate’ pull-up resistors so that you can remove them.
$0.50
Sandisk or Nokia Micro SD card 256mb-512mb 
 Test used cards before putting them in service. Older Nokia cards have low write currents in the 50mA range. This is less than half the typical write currents you see on larger size cards.
$2.00
3×1.5V AAA Battery Batteries Holder w Wire Leads
The Pro Mini regulator will handle battery packs holding from 3 to 8 AA or AAA batteries. 
$0.40
Common Cathode Bright RGB LED 5mm 
( & 4k7 limit resistor) 
$0.05
5 lb Double Sided Tape10MΩ resistors & 3MΩ resistors, 22awg silicone wireheader pins, etc… $0.50
Donation to Arduino.cc
If you don’t use a ‘real’ Pro Mini from Sparkfun to build your logger, you should at least consider sending a buck or two back to the mothership to keep the open source hardware movement going…so more cool stuff like this can happen!
$1.00
Comment:   You might need one of these to get started:                            (not included in the total above)
3.3V 5V FT232 Module
  ***Be sure to set the UART module jumpers to 3.3v before using it!*** and you will also need a USB 2.0 A Male to Mini B cable.
$2.75
Micro SD TF Flash Memory Card Reader
Get several, as these things get lost easily. My preferred at the moment is the SanDisk MobileMate SD+ SDDR-103 which can usually be found on the ‘bay for ~$5.
$1.00

Connection Diagram:

This logger uses the same three components described in the Sensors paper from 2018, but we now connect those core modules via a screw-terminal expansion shield, rather than soldering them directly to the Pro Mini pins:
 
COMPONENT PREPARATION

Screw Terminal board:

Don’t forget to measure the values of the resistors before soldering that voltage divider! You will need those numbers to convert the ADC reading on A6 into actual voltage later!

These screw terminal boards are designed for an Arduino Nano, but if you orient the board to the Tx/Rx pins, the labels on digital side of the shield will be correctly aligned with the Pro Mini:

The most common beginner errors at this stage are crooked headers & not heating the pad/pins long enough for solder to flow properly.  This is often because students are trying to use an iron tip that has “gone dry” so the heat is not transferring properly to the pins. You must protect soldering iron tips with fresh solder every time you put it in the stand to prevent oxidation. Tip Tinner can sometimes restore those burnt tips.   {Click images for larger versions}

Common soldering errors – which are easily fixed by re-heating with more solder & flux.

A Meg-Ω scale divider takes >1sec. to charge that cap. after the 1st power on.

Always apply conformal coating in a well ventilated space, such as a fume hood.

It is better to err on the side of using a bit too much solder, and a little too much heating time, because partial connections to the screw terminals will cause you no end of debugging grief later: Cold solder joins can “sort of” work “sometimes”, but cause mysterious voltage drops over those points because they can like high&variable resistors in your circuit. 

The Pro Mini Board:

About 10% of the cheap clones from eBay are flaky, and it is quite annoying to discover one of those that after you have assembled a logger. So test your Pro Mini with the blink sketch before you remove pin13 LED resistor.  These limit resistors move around from one manufacturer to the next, so you might have to go hunting for them on your particular board.  You also need to remove the RESET switch from the board, or that button will be compressed when you put the SD card adapter into place:

Test w blink sketch!

You can skip the reset pins at this stage, or you can pull those pins out of the plastic rails later with pliers, or simply cut them off.

SCL & SDA jumpers to the 2 extra pins on the digital side.

Connect A6-7 & GND to analog side pins with the leg of a scrap resistor.

(Note: Credit goes to Brian Davis for the idea of using “extra pins” to patch over to the unused to screw terminals.)                                                             {Click any images to see larger versions.}

The SD Card Adapter:

This SD card adapter comes with small surface mount pull-up resistors on the MOSI, MISO & SCK (clock) lines (removed from the dashed red line area photo 2 below).  The Arduino SDfat library uses SPI mode 0 communication, which sets the SCK line low when the logger is sleeping. This would cause a constant drain (~0.33mA) through the 10k SCK pullup on the module if we did not remove it.  I prefer to pull MOSI & MISO high using the internal pull-ups on the Atmel328P processor, so those physical resistors on the breakout board can also be removed. Leave the top-most resistor of the four in place to pull up the unused DAT1 & DAT2 lines.  This keeps those unused pins on the SD card from floating, which draws excess current.

Only remove the bottom three pullup resistors. keep the top one
The SPI connections:
RED:           3.3v regulated
Grey:          Cable select (to D10)
Orange:     MOSI   (to D11)
Brown:      SClocK (to D13)
Purple:      MISO   (to D12)
BLACK:     Ground

Attach SD adapter & Pro mini to the Screw Terminal Board:

Label the Vcc/GND connections with a colored marker, then insert the Pro Mini into the headers on the screw-terminal shield. Be careful not to bend the pins – especially the “extension” pins at the back of the board.

Label the Vcc and GND connection points.

Then affix the SD adapter board to the top of the Pro Mini with a slight overhang, so that the jumper wires align with the screw terminals below. Trim the wires about 1cm past the edge of the board to provide enough stripped wire for the terminal connection.

4k7 limit resistor on common cathode RGB

LED on pins D4-D6, & GND

Add layers until the tape extends beyond the pins.

The RTC Module:

The simplest modification to these DS3231 RTC boards is to remove the charging circuit resistor and power LED limit resistor from the circuit board (the red squares in the first picture).  A non-rechargeable CR2032 coin cell battery will supply the RTC with power for many years of operation. 

rtc1

Add an extra layer of foam tape over the smaller 4K eeprom chip, so that the thickness matches the top surface of the DS3231 chip.  The RTC board already has 4.7k pull-ups on the SDA (data) and SCL (clock) lines so you will not need to add them to the bus.  This module also has a 4.7k pull-up on the SQW alarm line.  (Adding the screw terminals to the small cascade port on the RTC module is another creative idea from Brian D.)

The Plano Stowaway housing:

In these photos, I’ve tapped some threads into the housing for the cable gland, but that is entirely optional. Glands much larger than PG7 (12mm) will not fit in the available space in that corner. 

ASSEMBLING THE LOGGER PLATFORM

Using double sided tape to hold the parts inside the housing (rather than traditional stand-offs) makes this stage of the build remarkably quick.  Adding male Dupont pins allows you to join internal and external wires via the breadboard.  Be sure to use wires that are long enough to reach all points on the protoboard. 

You can “reactivate” spent desiccant packs with a few zaps in the microwave.

Connecting external sensors to the housing:

It’s worth mentioning that you don’t have to use the breadboard for those external sensors. In fact the connections would be more robust if you brought those external sensor wires directly over to the screw terminals on the RTC or the Pro Mini. Put protective masking tape over sensor ports that need to remain open before potting those external sensor boards in epoxy!

Your Logger is ready!
Since they are electrically identical, you can follow the testing procedures described at the end of  the 2016 Dupont logger , but for this new build we’ve created a new Pro Mini datalogger starter script to help you get your project rolling. The updated version automatically generates any required data files on the SD card at startup, and tracks the rail voltage for those adventurous enough to try running without a regulator.

Once you have your logger together, you might want to review our beginners tutorial on adding sensors to your data logger. And there are plenty of other advanced sensor guides on this site (…and the list is constantly growing) We’ve also developed methods to add 5110 LCD & OLED screens to the Cave Pearl Loggers using the fewest system resources. These screens are easily accommodated on the proto-board in this build.

For people wanting to take their skills farther, you can explore the low-level details of this loggers operation, and read case studies of how we use these loggers for research, in the 2018 Sensors article (it’s free to download)

Addendum: Power Management

On the standard build described above, the Pro-Mini’s MIC5205 power regulator should deliver  sleep currents below 0.25 mA (Pro Mini ~0.05 mA + sleeping SDcard ~0.05-0.09 mA + RTC ~0.09 mA). That should reach several months operation on 3 AAA cells before reaching the regulators 3.4v input cut-off.  I usually have the standard loggers go into shutdown mode at ~3.6v to reduce the chance of leaks, because alkaline batteries often spill their guts when they get near 1v/cell.

There are a couple of relatively simple modifications to the basic logger that more than double the loggers operational time – but they both come with important implications you should  understand fully before adding them to your project. The RTC mod is relatively safe, but running a datalogger from a raw battery supply is not for the faint of heart. 

1) Cutting the VCC leg on the DS3231 chip forces the RTC to run entirely from the coin-cell Battery

2) remove the regulator: few LDO’s have reverse current protection and clone regs can draw 30-90 uA when back- powered from Vcc

2) Then connect the positive wire from a 2X LITHIUM AA battery pack directly to the Vcc rail on the Pro Mini

The DS3231 RTC was designed to handle power supply failures by switching over to the backup coincell battery, and it enters a special 3uA “timekeeping mode” to use less power in that situation. However the chip is still fully capable of generating alarms, and responding to the I2C bus at 400 mHz. So if you cut the main power leg on the RTC you reduce the loggers sleep current by almost 0.1mA (~40%). The trade-off is that your loggers operation is now entirely dependent on the 200mAh CR2032 coincell to keep the clock delivering logger wake-up alarms when you are also asking it to deal with pulsed loads in the 80 uA range every time you communicate over the I2C bus. Another quid pro quo here is that coin-cell holders occasionally lose contact very briefly under vibration, so if you cut the Vcc input leg add  a  0.1 μF capacitor (ceramic 104) across the coin-cell holder. That will give you about 80 ms coverage, which should be longer than the holder will lose contact. Otherwise a hard bump can easily reset the RTC back to its Jan 01 2000 default.  The wake-up alarms usually continue after that kind of reset, however fixing an entire years worth of time series data based on your (hopefully complete) field notes is a pain in the backside.  Real world deployments often involve this kind of rough handling, so I prefer a more advanced RTC modification that keeps two power supply’s on the RTC at all times. But for more “gentle” applications, simply cutting the chip leg & adding a cap should be OK.

For loads in the 0.1mA range, the MIC5205 is about 50% efficient. So the other modification is to remove the voltage regulator and run the entire system from 2x LITHIUM AA batteries.  Lithium batteries (like the Energizer L91) have two characteristics that make them well suited to this approach: 1) they have an extremely flat discharge curve, yielding >80% of their power before the voltage falls below 1.5v/cell and 2) a pair of brand new lithium cells gives a combined voltage just a hair over 3.6 volts. If you look at any of the SD card manufacturers’ specifications, such as Transcend, Toshiba, and SanDisk, they all specify the same voltage range: 2.7v to 3.6v.  At 8 MHz the ATmega328P processor on the ProMini  supports voltage levels between 2.7 V and 5.5 V. Both of these ranges overlap beautifully with the lithium cell’s discharge curve which spends most of it’s operating life above 1.5 volts/cell with low power loads like this logger:

Here I’ve done both modifications to the basic build, and brought the sleep current (with no sensors) from an unmodified 228μA, down to 80μA. Most of that remaining power is due to the sleeping SD card, since the Pro Mini only draws about 5μA in deep sleep mode. Using only 1/2 of the 3000 mAh capacity of a typical AA Lithium pack would keep a logger that sleeps at 0.1mA alive for more than a year, and my rough estimate is that the RTC mod will get you at least twice that much time from a new Cr2032 cell – with a typical 5-15 minute sampling interval.      [NOTE: I’m using an EEVblog uCurrent here to display the μA sleep current on a DVM as milivolts. It’s an exceedingly useful tool that lets you read into the nano-amp range without adding the burden voltage you’d see from putting your meter directly into the circuit ]

The other cool thing about this modification is that the processor on the Pro Mini can take a reading of it’s rail voltage simply by comparing it to the 1.1v internal band-gap reference. So all you need is a little bit of code, and you can keep track of your rail=battery level without a voltage divider.  Unlike alkaline batteries, lithium cells have very little voltage droop with brief loads below 100mA, but it’s still a good idea to protect your SD card from potentially data corrupting 5-10 msec low voltage spikes with a beefy capacitor. Adding a 47uF (or larger) on the microSD rails should keep those transients away, and once the system reg. has been removed running a jumper between Vcc & Raw recruits the orphan (4.7 or 10uF tantalum) capacitor that used to be on input side of the regulator. Always check the supply voltage before the data saving begins and go into low battery voltage shutdown when the lithium pack gets near 2850mv. (ie: at least 150mv above the SD’s 2.7v safe writing minimum). Generate a new data file every week so only the last one is vulnerable. 

Of course everything has a price, and removing the regulator means you’ve not only lost your reverse voltage protection, you also need to think about how all the components in your system will respond to that decreasing supply voltage over time. Ratiometric analog circuits handle this pretty well, but even if you see support for  2.7 – 3.6v listed on the spec sheet for a digital sensor – that’s no guarantee the readings will be consistent when the supply voltage changes over time.  You could have very different error percentages at the high & low end and, ambient temperature fluctuations could push your batteries through significant voltage changes every single day (although lithium cells are much more resistant to this than alkaline batteries).  Testing is the only way to find out if your sensors can handle the variation, and if you don’t have time for that it might be worth keeping that voltage regulator on board despite the reduced lifespan. For field units, I usually just replace the MIC5205 with a more efficient MCP1700 regulator. Another thing to keep whenever you are hoping for a really low-power build is leakage currents through leftover flux, etc – it’s always worth the time to clean those parts well during the build process.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s