Friday, June 3, 2016

a multi-function display for isolde - part 6


More toys arrived from China. Among them are an 20x4 LCD display with I2C interface with green LED backlight, an accelerometer breakout board, Arduino Uno protoboards, and the most exciting one - a data logger shield that has an RTC and a SD card connector as well as some prototype area.


Also arrived is a more compact oil pressure sensor which I infer is a solid state instead of the VDO type.


G1/4 pressure sensor has 3 leads: VDD, GND, and OUT. VDD is 5V. This one is 0 to 80 PSI. At sea level the OUT measures 0.5V. I blew as hard as I can and it increased to 0.545V.

I could not wait and immediately find some time to test out the data logger shield. It was poorly packaged and all the stackable pins are bent. I just straighten them out with a pair of pliers.



One thing I notice is with most of these Chinese Arduino shields you have to be extra careful to do you homework when making the purchase decision. Some claim 3.3V and 5V operation but the boards may not be designed to do so. With the data logger shield the SD card interface must function in 3.3V or else the SD card can be damage, or the board fails to function at all. Hence I immediately check the interface circuit to the SD card as well as the power supply.

Good that I do. The 3.3V regulator is defective. it puts out 4.2V!

I verify the 5V input is within spec.

the 3.3V regulator outputs 4.21V which is too high

I defer sorting out the SD card interface. I turned my attention to test the RTC. It requires a CR1220 coin cell battery that I don't have on hand. Instead of driving to a store to buy one I shoehorned in a different coin cell battery.

I use a jogger flashing LED acting as a coil cell battery holder and connect it to the data logger shield

The RTC works without a glitch. Next I turn my attention to the SD card interface. Not wanting to jeopardize a good SD card, I found a 8MB old SD card for testing. First I tried to get away with the 3.3V excessive voltage thinking it most likely not kill this dispensible SD card. I ran into a lot of issues and eventually I was able to perform card identification. I notice it report the card is format as FAT12 and I thought it should read FAT16 but the text must be garbled from read corruption due to incorrect power and interface signaling voltage level. I could not perform other read or write function to it.

It would turn out the SD card library does not support FAT12 format. I decided to do something about the 3.3V regulator so I can put my good SD card to test. Since I don't have a replacement SOT23 regulator I went with my own work around. I defeated the defective regulator by lifting the output pin from the pad. I then patch in the 3.3V from the Arduino Uno's 3.3V to the SD card circuit. Success.

A  bit more coding work, I managed to write a simple program to log the humidity and temperature to the SD card. There is another challenge. while I have these SD cards, I don't have a reader on any of my PCs to read them. I have always manage to do without one as all my cameras has USB interface that I use to download the contents to the PCs. To verify the data logging indeed occur onto the SD card, I have to load another example program to view the SD card content to see the files.

a primitive data logger that consists of Arduino Uno, data logger shield, and a DHT11 humidity and temperature sensor

the data is logged in a CSV file format; Vcc in the last column is bogus

I purchase this prototype board shield just in case I need it. It is poorly designed but they cost only $5 for 3 shipped. The data logger shield has good size prototype area so I am likely would not need this.

the problem with this prototype board is the center area not setting up to support DIP ICs unless you do a lot of trace cutting


My original goals of this multifunction display is coming together bit by bit. I didn't try too hard in the initial design especially checking for potential resource conflicts among the needed functions. With the exception of having to give up one analog pin and forgo the ability to monitoring starting battery voltage everything comes very well together.

It appears likely I can fit all the passive components for the various sensors onto the prototype area of the data logger shield. this would keep the Arduino Uno module compact and easy to package.

I just realized that I do have a workaround to read the SD card on my PC despite I don't have a reader. Actually, in truth I do have SD card reader that are built into two of my Dell LCD monitors. However, neither are able to read this SD HC card. These monitors were built long before the advent of SD HC card standard. The workaround that I realized is the dash cams that I have. They uses SD card and become mass storage device when connected to a computer. Sure enough all the files created by my data logger in development are there. Here is one that I open with Excel.

a CSV file opened with Excel

I cannot wait to play with the data logger to log all sorts of events. I would build a few for various purposes. Fun!

I proceeded to add the data logger shield to the multifunction display with joystick setup to integrate all these hardware. I started adding the data logger functionality to the sketch. Bad news. I exceeded the 2k byte RAM of the Arduino Uno. It turns out the Adafruit OLED library uses 1k to buffer the OLED's 1k pixels. I am still dumbfound as to how the other 1k bytes of RAM got gobbled up by global variables. Here is the compiler reported memory usage of my code:

Sketch uses 21,676 bytes (67%) of program storage space. Maximum is 32,256 bytes.
Global variables use 2,319 bytes (113%) of dynamic memory, leaving -271 bytes for local variables. Maximum is 2,048 bytes.

As you can see the global variables consumed 2319 bytes of RAM. The Arduino AtMega uC only has 2k bytes, and it has to be shared with the stack, as well as dynamic variables.

No comments:

Post a Comment