Feed on
Posts
Comments

A year or so ago I decided to make a smaller version of the Standalone Temperature/Voltage Logger which would only do temperature called the A25TTL which measured 17mm x 12mm. In this post, we’ll be updating the A25TTL to v1.1 so we can use any EEPROM, v2.0 so we can now also use an ATtiny13 and briefly show my new programming method for SMD ATtinys.

V1.1
At the time, I used the cheapest 512K EEPROM I could find (the ST  M24512) however I found that not all EEPROM’s SCL/SDA lines acted the same and I had run the ADC a few times to determine if the logger was connected to the reader – not the best way to do this. I recently found that the M24512 EEPROM doubled in price so this was the main reason to update to v1.1 which makes the logger to set it’s pull up resistors on the SCL/SDA lines at boot which means that we can now use any EEPROM.

PORTB |= (1<<TWI_SDA_PIN) | (1<<TWI_SCL_PIN);

watchdogSleep(T1S); // Wait a little bit for things to settle

// Check if we powered up from the USB port
if (!(PINB & (1<<TWI_SCL_PIN))) {
	system_sleep(); // Sleep forever
}

PORTB &= ~(1<<TWI_SDA_PIN) | ~(1<<TWI_SCL_PIN);
...

This not only helps some EEPROMs reducing the current they draw but puts the ATtiny’s pins as inputs thus allowing the reader to pull SCL low. The logger waits 1 second, reads the SCL pin, if it’s low it goes to sleep otherwise it starts logging.

usbPoll(); // Keep polling USB

// Check if it's been 4 seconds since the last USB poll, then reset SDA/SCL pins and variables
if (usbUnusedCount >= 20) {
	scl_sda_low();
	...
	
	// Restart timer
	TCCR1 = 0;
	TCNT1 = 0;
	TCCR1 |= (1<<CS13) | (1<<CS12) | (1<<CS11) | (1<<CS10);
}

...

ISR(TIM1_OVF_vect) { 
	usbUnusedCount++;
}

For the reader, it’s mostly all the same except that now we monitor when we received our last USB command. If there hasn’t been any activity after ~5 seconds (16.5MHz / 16384 prescaler / 256 ticks x 20), we reset all the variables and set SCL/SDA low, so now when you use your reader you can hot swap loggers. Download A25TTL_v1.1

V2.0
After finding the EEPROMs price was doubled, I did a search for ATtinys with my suppliers and found that if I could reduce my code (currently 1220 bytes), I could use an ATtiny13A which is a little bit cheaper than the ATtiny25.

uint8_t delaySeconds = soft_i2c_eeprom_read_byte(EEPROM_ADDR, delayTimelocation);
...

// Wait the delay time
delayCount = delaySeconds;
while (delayCount != 0) { // Seconds
	watchdogSleep(T1S);
	delayCount--;
}
delayCount = delayMinutes;
while (delayCount != 0) { // Minutes
	for (uint8_t waitCounter = 0; waitCounter < 7; waitCounter++) {
		watchdogSleep(T8S);
	}
	watchdogSleep(T4S);
	delayCount--;
}
...

Before I used to combine all the delay time bytes together but that meant using 32bit ints and doing some calculations to reduce it to days, hours, minutes, seconds. To save space, each byte is it’s own variable and we use a specific routine for each delay time type – e.g for each minute we loop 7 times and sleep for 8 seconds then sleep for an additional 4 seconds. This allowed the code to be reduced to 944 bytes. I have updated the reader and C programs to match – Download A25TTL_v2.0

Thermistor changes

Previously I’ve been using an 5% tolerant 0805 thermistor which has also doubled in price, I couldn’t find a decent 0805 replacement so have gone with an 1% tolerant 0605 thermistor, a little harder to solder but should hopefully give a little better results.

Pogo pins for programming

IMG_3745

To program SMD ATtinys I used to use a binder clip to hold it in place which was hit and miss plus it couldn’t be done in circuit.

IMG_3744

I bought some pogo pins and was able to reuse my boards with a PCB glued in between which just happens to the ATtiny nicely.

4 Responses to “ATtiny25 Tiny Temperature Logger updated to v1.1 and 2.0 plus Pogo pins for programming”

  1. Nice little board.
    SPI NOR flash would give you more storage for a lower price. A 4Mbit part costs about 20c in small qty.

    • Alex says:

      Thanks Ralph, quite true about NOR Flash would be cheaper ($0.5 here in AU) however with the current draw required for writing that seems to be 10-20mA or thereabouts, a coin cell probably wouldn’t last very long? I should really try testing it out.

      May have to go with Lipoly batteries but then again I kind of want to avoid those for these simple projects.

  2. Miguel says:

    Could you tell me what type of pogopins did you used there to program the attiny85 ? The pogo pins seems to be little than the standard ones.

    Let me know,

    Best Regards,
    Miguel.

Leave a Reply to Miguel