Monday, March 8, 2010


Finally I got it working yesterday! The problem with TWI was not in MCU nor in software TWI Master implementation, but in differences in addressing.

In LM75A datasheet said that 7-bit addressing used for the device. MSB bits are always set to 1001, and value of 3 lower bits depends on logic level on pins A0:A2. As A0:A2 pins I have connected to Vcc, address of my sensor is b01001111 (8-bit binary) = 0x4F (hexadecimal). I have successfully used this address with Arduino and all was working as expected.

But when I started with ATTiny13 running software TWI nothing were working. As I haven’t full-functional digital oscilloscope, I had tried to make some “poor man’s logic analyzer” using codes from here. Got it working, but results were strange to me because SCL signal on TWI bus wasn’t like a strobe but more likely signal. So I decided to make more research over the net.

Fortunately I have found topic on forum where somebody discussed interaction with different LMxx sensor, and I noticed strange addressing in code. Address of device were 0x90 that corresponds to b10010000. I have maid guess that address should be not left-padded as I used it with Arduino, but right-padded. I put b10011110 (0x9E hex comparing to 0x4F I've used before) as address and now everything is working just fine!

Sunday, March 7, 2010

LM75A setup

I made serious mistake during design of pumping station thinking LM75A has non-volatile memory for configuration parameters. Actually this IC haven’t such ability as store configuration between power-ups.

Fortunately I have connection to TWI pins on both sensor board and wiring, so decided to create some “hardware config file” basing on ATTiny13. I have created Arduino sketch to test approach and it is working just fine, but tiny13 has no hardware TWI implementation comparing to ATMega168. After some research over the net I found nice implementation of AVR-300 (Software TWI) by Peter Fleury: 

Here are 2 PCBs, one is test board for LM75 sensor, second is ATTiny13 for software implementation of TWI:

Homebrew PCBs for LM75A digital thermometer and ATTiny13 based board to configure sensor

My configuration board is still not working despite simplicity of the library. I haven’t found why, but my guess is that internal RC oscillator is not suitable for this. Will try to run with external crystal today.

Update: I had made it working!

Friday, March 5, 2010

Pumping station project

3 weeks ago I started new project as a gift for my father who live in the countryside. There he has well with electrical pump and elevated water tank for housekeeping needs.

He is a good hand (despite a bit old-schooled), and pumping is more or less automated using few scrap yard relays. But we had as low as –27 °C this winter so pipes were frozen few times. My idea was to create device that will keep both water level and temperature at desired level and be more safe, more reliable comparing to existing device he uses.

Due to workload in the office I was unable to create my “pumping station controller” fast and now I’m definitely late with heater (+5 °C behind the window). But for now the device is almost complete and I can write about its features:

  • LM75A I2C Digital temperature sensor and thermal watchdog
  • 2x A3212 Ultrasensitive Hall-Effect Switches for water level sensing using foam float with magnets
  • 2x Atmel ATTiny13 MCU: one to watch sensors and control pump and heater, second for setting up LM75 during start-up
  • 2x powerful Omron relays (230V/20A) to control load

I have a hope I’ll have a time to describe device in detail in next posts. For now you can take a look at visualized PCBs for the device I had designed before:

Pump/heat station controller and sensor boards