Tuesday, June 28, 2016

arduino based multi-function display for Vanagon - part 3


When I first embark on this project, I only have a vague idea of the list of features I want. It was just a preliminary list of requirements. Oil pressure and temperature, interior and exterior temperature, and most import a data logger.


I ran into memory limitation very quickly and that was a rude awakening that I need to be conscious of preserving RAM and always think of the most memory efficient coding. I also learnt quickly some libraries are best to avoid altogether if you can do without.

Since I ran into the limits of the flash and static RAM I have been very careful, and that had paid off. I have been able to implement a lot more features and make the system much more user friendly. The most recent added features are a clock/calendar screen, the ability for user to select the data logger's recording frequency, and also proper handling of the SD card presence or absence, as well as only initialize the card once.

now there is a display screen for selecting the data logging interval - 2s, 5s, 15s, 30s, 1m, 5m, 15m

15 minutes logging interval is the longest

the second OLED that I purchased arrived - it can be configured for SPI or I2C interface

The display came without any documentation. It gave me a lot of grief trying to configure for I2C because of the reset signal. I could not get it to display anything, until I dedicate a GPIO to pulse the reset long after the Arduino reset has occur.

here is the new all white OLED display showing the clock calendar screen - the blue text on the top line is cause by the screen refresh strobing effect interacting with the camera

here is the gauge screen

The hall current sensors arrived yesterday and I immediately added one to the system. It can be used to measure DC or AC current from low voltage to household 120 or 230 Vac. The version that I purchase is optimized for +/-5A but can measure up to about +/-13A. With 5.0V power supply it has a transfer function of 185mV/A at the analog output, with a 2.50V DC offset. The output is fed to one channel of an ADC to process by the uC to convert into amperage.

ACS712 hall effect current sensor

here I have the hall current sensor working showing 2.01A on the display; the hall sensor is circle in red

I use the lab power supply to pass 1.998A of current through the hall sensor

I then set up the system in the Vanagon to log the temperature and current consumption of the DC refrigerator. This is exactly one of the many applications that I design this data logger for. The forecast for the day is sunny with a high of 85F. It is a good day to find out how well the refrigerator perform. I set up the logger to log at 5 second interval. It logs time, ambient temperature of the Vanagon interior, the temperature inside the fridge near the bottom, and the current consumed by the compressor. I let it run for about 9 hours starting from 10 AM to about 8 PM. That is 10 hours worth of data. There are about 7000 records each separated by 5 seconds.

I deliberate start the logging when the refrigerator first turns on with the interior that is close to air ambient. I want to see how fast the refrigerator reaches set point of the thermostat. The refrigerator has no content so the cool down to to reach set point is the best case.

here you can see the hall effect current sensor that I wired in series of the on/off switch for the refrigerator


here shows 3.00A of current shortly after starting up

 Below is the graph that logged the refrigerator's operation from 10 AM to 8 PM during a 85F day. The top curve is the interior temperature of the Vanagon. The middle curve is the interior temperature of the fridge. The bottom curve is the current in amperage of the DC compressor. The current is negative because the hall sensor polarity with respect to the current flow.




This plot is just a quick and dirty graph that I created using Excel. There are much better graphing tool out there. I would like to be able to zoom into any spot in the graph to analysis more closely. Here you can see as the ambient temperature reached the peak of about 92F the fridge interior temperature held quite well. There is a few degrees increase inside. The square wave like plot of the compressor current is as expected as it cycles on and off. Because the current is inverted, the negative pulse is the on time. You can see the duty cycle increase with the ambient temperature reaching about 50%.

the first oil pressure sensor that I purchase was a wrong thread diameter. The correct one I purchased again arrived


Here is a zoom in plot between roughly 1:00PM and 2:30PM. I added two % humidity curves. One is the ambient humidity and the other the fridge humidity. The reason you are seeing the jaggedness in the temperature curve is due to the poor repeatability of the DHT11 temperature and humidity sensors that I use. I am extremely displeased with their poor performance. The only reason that I am using them is their humidity feature. However with their dismal temperature accuracy I am leaning to ditching them and just go with a more accurate temperature sensor.

a plot between 1:00pm and 2:30pm with humidity


In this zoom in plot you can see the on/off times of the compressor better. The on time is about 4.5 minutes and the off time is about 5 minutes, giving a duty cycle of about 47% with a period of about 9.5 minutes.

the DHT11 temperature and humidity sensor - it cost less than $2 a piece order directly from China

the inside of DHT11 here showing the humidity sensing element

the inside of DHT11 here showing the built-in 8-bit microcontroller, which I infer also has an integral temperature sensing element

Right now I am leaning towards switching to the Maxim DS18D20 temperature sensors and give up the humidity capability of the DHT11. The advantage with the Maxim DS18D20 is it is very compact and accurate. I can use one for the oil temperature sensing by replacing the primitive inside of the VDO-like oil temperature sensor.

Maxim DS18D20 temperature sensor

VDO-like oil temperature sensor (right); I can gut the inside and replace it with a DS18D20 sensor

I did another log of the DC refrigerator overnight from about 9:03 PM to 9:59 AM the next day. It was a cool night and I set the logging interval to 15 seconds. There are 3065 lines of records. The plot has 5 variables excluding the record number. I used another energy meter to tally the total watt-hour of energy consumed and that was 165 W-Hr which is about 13.2 A-Hr assuming 12.5V nominal battery voltage. I had a chance to swap the polarity of the Hall current sensor so the current is now positive. You can clearly see that the refrigerator's on duty cycle was much lower when the ambient temperature is lower. The interior temperature of the fridge is also lower too which shouldn't be a surprise.

an overnight logging of the DC refrigerator variables


2 comments:

  1. This project has come a long way! Glad I could see it in person this weekend. I expect adding contents to the fridge will increase the on/off periods, but could make it more efficient overall, with the food acting as a cooling battery.

    ReplyDelete
  2. Hi John. I concur when the fridge is loaded with food stuff the cycling would be less frequent and the temperature would be more stable. Cannot stress enough never load food that is not pre-cool if you are not going to drive a long distance. Cooling a fridge full of food really tax the batteries.
    It has been a lot of fun and I learnt a lot. Arduino has been the most fun for the buck bar none for me. I cannot foresee that I look forward to the USPS delivery these packages from China. On the average they cost $3. Some days I get 4 or 5. I am all thumbs when it comes to C programming. More like a hack.

    ReplyDelete