Feed on
Posts
Comments

Monthly Archive for February, 2012

Last week we looked at SoftI2C so we could use an I2C EEPROM on any of our AVR’s pins and now it’s time to apply that to the Standalone Temperature Logger as the internal EEPROM of 512 bytes is a bit limiting.

Identifying the pins to apply I2C to

The first step is to identify which 2 pins we can use, we rule out the USB pins PB1 and PB2. After some testing I found PB0 for the clock and PB4 for the data seem to work well. In SoftI2C the clock is only ever an output, we have a line like that already, the LED one PB0. The data line changes between an input with pull-up resistor and output, we also  have a 100k pull-down to ground which you’d think should affect the pull up but we’ll see why it shouldn’t.

The reason it shouldn’t is because the internal pull-up resistor is between 20K and 50K per the datasheet page 167. Since it’s a low value resistor compared to our 100k resistor it makes a desirable voltage divider.

(more…)

Read Full Post »

I’m thinking about updating the Standalone Temperature Logger to use an external EEPROM and since one of the ATtiny85 pins which correspond to hardware I2C/TWI is used by V-USB, a software implementation is the way to go. I found Soft I2C Master in Arduino code which allows any 2 pins to behave as an I2C interface.

Naturally I decided to convert that code to pure AVR which is available for download here – AVR_Soft_I2C_Master_v1.0

My modifications to the Soft I2C Master code are:

  • Made to work directly with AVR (De-Arduino existing code)
  • Changed from C++ to C
  • Added soft_i2c_eeprom_read_byte and soft_i2c_eeprom_write_byte

Example code

Here’s my example which writes 1 byte, reads that same byte and blinks the LED if the byte is the same.

(more…)

Read Full Post »

The Non-Contact Blackout Detector has been updated to v1.1. The PCB got etched and you can see that the back of the board has a block of exposed copper which acts as our AC interference detector, it’s not as good as using wire. I’ve placed it into a small container.

Download the Non-Contact_Blackout_Detector_v1.1 or visit the project page.

Blackout SMS Sender

Now I thought I’d link this project with the Nokia 3120 Keypad SMS Sender to make a project example named the Blackout SMS Sender. Download the Blackout SMS Sender_1.0.

In the above video you’ll see that the Blackout SMS Sender will SMS me once the power is out and then will SMS me once power is restored with how long the power was out for.

Modifications to the Nokia 3120 KSS were:

  • Use Timer0 interrupt every ~0.5 seconds to keep track of the time PB5 has been high for
  • Uses delay_ms again as we are using Timer0 to do interrupts and it won’t work well with the watchdog timer
  • Uses system sleep IDLE instead of PWR_DOWN as Timer0 won’t wake us up in PWR_DOWN

Read Full Post »