The Standalone Temperature/Voltage Logger v1.0 has now been released. Download SATVL v1.0 or view the Standalone Temperature/Voltage Logger project page. In the download, I’ve include a PDF guide file that has everything you need including step by step assembly instructions with pictures.
After about a months wait I’ve received 10 boards from Itleadstudio, they look good and I have successfully built a board up and it’s working. The SATVL is not currently up for sale at the moment until I receive a few more parts I’m expecting which should be in about 1-2 weeks.
During the testing process I found a few problems and a design flaw that made it to the PCB however it’s correctable and still functions as it should.
Type assumed to be double when it wasn’t
0.3 0.2 0 10570.2 10570 10569.7
I had being experiencing strange problems (as shown above) when I logged temperature that was negative with 2 bytes or when logging voltage with 2 bytes.
unsigned int combinedValue; if (functionInuse == function2Bytetemperature) { // Calculations to restore 2 byte value to temperature calculateDouble = (combinedValue - 248) / 6.206; } else { // Calculate to restore 2 byte ADC value to voltage level = (value * vRef) * vRatio calculateDouble = (combinedValue * 0.001074) * 27; }
In part of the calculations to convert the 1024bit number to a temperature/voltage I assumed the compiler would know to convert combinedValue to a double when doing the multiplication or division. To correct this we just need to insert (double) before combinedValue to specify that we wish the type to be a double.
Voltage is sometimes converted wrong
I found that sometimes when reading a voltage such as 9.04 volts it would actually be converted to 9.4 volts.
// Split the value into 2 parts int beforeDecimalpoint = (int) calculateDouble; int afterDecimalpoint = (int) ((calculateDouble - beforeDecimalpoint) * 100);
In the above code we were breaking up the number before and after the decimal point, for 9.04 it would break it up to 9 and 04 but 04 isn’t a number so it would really be 4.
// For voltage, fixes incorrect rounding after decimal point (without fix 9.04V would have read 9.4V) byte insertNumberzero = false; if ((functionInuse == functionVoltage || functionInuse == function2Bytevoltage) && afterDecimalpoint < 10) { insertNumberzero = true; }
The simple fix for this is to check if the number after the decimal point is less than 10 and if so we will insert the number zero before the after decimal point number.
Design flaw with Mosfet used to switch load when voltage logging
When testing voltage logging I found a strange problem where I was seeing a maximum voltage of 1.5V or so when testing 3V, 9V and 12V. I probed the board and found that the voltage being feed into the ADC was 50mV so it wasn’t a software issue. I found that shorting out the mosfet’s drain and source resulted in normal voltage readings so the problem had to be the Mosfet.
Here is how the circuit looks at the moment with the Mosfet, at low voltages such as 1.2V it looks like it works properly.
However when we increase the voltage source, we see it hit a limit of 55mV. This is because the Mosfet is dropping the voltage instead of the resistors.
We can’t have both resistors before the Mosfet is because if the Mosfet was off the voltage would read the same voltage as the source which is bad and would damage our ATtiny if we read the ADC.
The way to solve this is to have the Mosfet sit in the middle between the 390K and 15K resistor.
Smaller issues
- R11 was missing from the PCB and it doesn’t exist
- I had delay_ms(62) in my code before checking for if an EEPROM is present which I’ve now converted to use the watchdog timer.
I’ve decided that I’ll be pre-soldering the SMD components as they may be a little tricky to solder plus looking around at other kits they also pre-solder the SMD parts. Now it’s just a waiting game until I can put it up for sale.
Dear Alex,
Is there any benefit to replace the NTC to thermo sensor IC such as LM36, LM50 or DS18B20?
Hi Wally,
For the LM50 there isn’t any benefit, it may actually be a little worst because the accuracy is 2C -/+ at room temperature compared to the NTC 10K which was 1.5C -/+.
The LM35 offers 0.5C accuracy at room temperature which is good.
Only downside for both these is that it needs 4-4.5V minimum voltage.
The DS18B20 is good because it offers 0.5C accuracy and you can select a 9bit-12bit resolution plus some other things. It uses 1-wire communication to retrieve the temperature. Downside is the price, that it can take 93-750ms to complete the temperature conversion depending on the resolution you select and that it can take up 1mA when doing it all.
(I grabbed this all from the datasheets)
Hey good to see you are moving on this . I want two of your boards please when you are ready with parts if thats the way you are going – definately put me down for two