Sunday, December 12, 2010

K-Type thermocouple sensor I2C interface board

Today I finished with board preparation and soldering:
K-Type thermocouple sensor I2C interface board
Most important part is firmware to turn ATTiny13 into I2C ADC which is not ready yet. Will continue with this task on next week.

Friday, December 10, 2010

K-Type thermocouple measuring

I'm designing the circuit to measure high temperatures (up to 600 °C) with at least 1 degree resolution with TWI (I2C) interface.

Literature on thermocouples:

Circuit design will include LM75 TWI temperature sensor for cold junction compensation, LM358 dual operational amplifier for two-stage amplification and ATTiny13 microcontroller for ADC and TWI interfacing (software slave).

Board layout supposed to be as narrower as possible to be insulated with heatshrink tube. Thermocouple will be connected using 3.5 mm screw terminal. For MCU communication and power supply 4-pin JST connector will be used (2.5 mm step). TWI address of LM75 will be configured using solder jumpers, ATTiny address will be set using TWI protocol and default address and then stored to EEPROM.

Device will support 3.3V and 5V supply.

Dual stage Non-inverting amplifier calculation is the following:

As I need 600 degrees upper level, voltage could be aplified up to 125 times to be below 3.3V for normal operation with this supply voltage as about 25mV corresponds to 602° on k-type probe.


1st stage: R2=10K, R1=1K, Gain=11

2nd stage: R2=10K, R1=1K, Gain=11

Total gain = 11*11 = 121

Total gain of 121 is good for us as it gives 25mV*121=3.025V at 602 °C (25 mV reading).

Measurement resolution considering 10-bit ADC will be:

At 3.3V 3.025/(3.3/1024)=938 steps, about 0.64 °C per step.

At 5V 3.025/(5/1024)=619 steps, about 0.97 °C per step.

I will work on proof of concept today; let's see the results.

Thursday, July 8, 2010

Digital Soldering Station Concept

Haven't written some time due to my work and ongoing projects I will explain later.

My pumping station is on hold for a while as it is not urgently required till first frosts. Actually all electronics is complete and working perfectly. The only thing is to pack it into cases and make good water insulation for immersed parts. This part I hate most because I have no suitable tools and place to do the hardware work.

Now I'm working on digital soldering station to replace my old 40W 220AC iron with tool more suitable for lead-free soldering. Features I'm going to implement:

  • PID controlled heating of 24V iron (I'm going to use SL-ICMC 24V/48W iron with ceramic heater that normally used with CMC series of Solomon stations with K-type sensor)
  • 3-digit numerical display for temperature reading and setting
  • Two-button 100 to 450 °C temperature setting
  • Calibration using external thermometer
  • Replaceable circuit for thermocouple or thermistor sensor support
  • EEPROM to store temperature settings when station is switched off

I have bought switching PSU 24V/2.7A, iron and metal case for this project and now working on electronic part. Hope to come soon with first results.

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