«

»

ATtiny2313 – Based Thermostat Project (part 2)

So I’ve came back to my ATtiny2313 – based thermostat project, that I’ve started to work on some time ago. And today I have assembled a first prototype (actually I only need a couple of these).

If you haven’t seen video I’ve made on this project, you can watch it here: Part1 Video.
It’s based around ATMEL AVR ATtiny2313 microcontroller, it will measure temperature using DS18B20 digital temperature sensor, and it has a 30A 240VAC relay to control heater.

As you can see it consists of two boards: main thermostat board and display board.

First I etched the boards.

I had some minor problems with those multiple parallel traces that goes from MCU to the resistors. The clearance between those traces were pretty small, and I’ve put too much pressure on the iron, so they become a little bit thicker and some of them were touching each other.
This problem was solved with X-ACTO knife and magnifying glass, then I made them a little bit thinner in the Eagle board layout to increase distance between those traces, so I won’t have this problem in the future. I changed thickness of the traces from 0.016in (0.4mm) to 0.012in (0.3mm) – which is perfectly fine for DIY boards.

After that I drilled and assembled these boards. And then washed them in ultrasonic bath with isopropyl alcohol (90% rubbing alcohol).

With ultrasonic bath cleaning flux residue from boards becomes effortless. You always get a perfectly clean PCB.

Here is close-up of thermostat board:

I got to say that big transformer is a bit of overkill. I could’ve put a smaller transformer instead.
Also right now for powering relay I installed 12V voltage regulator, but this relay can pick up starting from 7V, so I guess I’ll just swap 12V regulator with 9 or 10 volts one to decrease it’s current consumption.

Bottom side of this board looks like this:

High-current mains voltage traces on the right filled with solder, so they can handle more current.

Display board top:

And the bottom:

I’ve used SMD type connector here, which allowed me to make this board single-sided.

Since the hardware part is done, it’s time to do some programming…

I will make all the files and documentation for this project available a little bit later, when I’ll finish it.
And now I will give you only schematic in PDF format:

Schematic needs a little bit of polishing, so just wait until I’ll put out the final version.

15 comments

3 pings

  1. djdan says:

    I’m doing a similar project, and out of curiosity, what thickness are your high-current AC traces?

    1. admin says:

      5mm (0.196in) covered with thick layer of solder. But these traces can safely pass only about 10A of current (continuously). In order to pass a higher current through the same thickness traces – you can put a solder wick on top.

      This is just my prototype board, so I don’t need to put it under full load.

  2. Ethan Frei says:

    Really sweet tutorial you’re going through here. Also the pics are super clear and full of good. This is a great reference for 2 big things. Making your own DC power supply, and controlling high voltage/current with a microcontroller. The latter of which is very important for any sort of climate control or human-sized electronics/robotics control. I just actually made a similar one, and here is a video rundown on it. Keep up the good work!

    1. admin says:

      I’ve seen your video. Potentiometer to set the temperature – it’s a nice idea. Not as reliable as buttons, but IMO is a better UI.

  3. Ian says:

    Interesting project! I’d like to see how it’s wired into the heating system, as I’m working on a similar project to replace my baseboard thermostats, but I’m not sure how to wire it up properly to the 240V.

    Also, do you use ultrasonic cleaning on any boards that have crystals? I was under the impression that crystals can get damaged this way.

    1. admin says:

      If you need info on how to wire up the thermostat into an existing system, you can check the Honeywell thermostat’s datasheet or any other. They provide info on how to wire them up with the description of wires functionality. (If that’s what you asking about)

      I have washed many boards with crystals and never had any problems with that. Also, I never heard that crystal can be damaged that way. But I may be wrong, you’d better google for it.

  4. Alex Whittemore says:

    That’s an awesome video you’ve got! I’ve been meaning to update and organize all my projects into a real portfolio, I can only hope to make documentation that great.

    1. admin says:

      Thanks!

  5. valy says:

    where is hex?

    1. admin says:

      What’s hex? What you mean by that?

      1. asf21 says:

        The last question is: Where is the hex file (compiled code for ATiny mcu) or source code for the mcu? Your 3 parts are not finished! If we can realise your hardware project, at the power on, this circuit dosent function because the ATiny program block are fully empty!!!!
        Please post your code source or hex file OR erase your three parts and stop immediately the electronic lobby!!!!!

        1. admin says:

          Take it easy! I just wanted to put out everything at the end of the project. Eagle CAD files, BOM, Schematics, source code and .hex file.
          The firmware for my thermostat is not even alpha. I would say, that it’s in pre-alpha state now. But, sure, If you want the firmware – here you go:
          http://jumperone.com/files/2011/10/thermostat-project-part2/ATtiny2313_Thermostat_pre_alpha.zip
          It’s an AVR Studio 5.0 project written in C.

          - Phil

  6. Amy Wu says:

    Dear Friends,
    This is Amy from Xiamen China..We are the Hongfa brand relay supplier in Xiamen China.
    I am writing to confirm that if you should use the relay in your products.If there is any requirement,you could connect us freely.In this way i could offer the price and lead time information to you for your reference.
    You could also know more of us from the following website:
    http://www.xmyuzhou.com
    If there is any other details that you need to know,please feel free to connect us.
    It would be highly appreciated if you could forward this email to your purchase department.

    Best Regards
    Amy

  7. ian nicky says:

    hy brother, i think is good.. and i have a little idea, if i using this tool to control room temperature, can you adding one relay to control fan? the fan working every 1 minutes per hour, to blow out the air on the room is purpose. Thank youso much

  8. Sasha says:

    Hi Phill, thank you for your project. Can you please post complete schematic. The PDF you posted doesn`t contain LCD.

    Best regards, Sasha

  1. DIY thermostat keeps the harsh winter cold at bay | ro-Stire says:

    [...] zero. He decided to construct his own programmable thermostat to keep things in check, and has been documenting the process as he goes [...]

  2. DIY thermostat keeps the harsh winter cold at bay | The Depot of Talk says:

    [...] zero. He decided to construct his own programmable thermostat to keep things in check, and has been documenting the process as he goes [...]

  3. Just simply good AVR thermostat | Embedded projects from around the web says:

    [...] This is an AVR Attiny2313 project that interfaces 1-wire temperature sensor DS18B20. Controller is controlled by two buttons while seeing information on three 7-segment LED display. Temperature heater is switched by using relay. Thermostat is designed to be a stand alone device that takes power from mains. So there is a power transformer used and linear regulators to get needed voltages. Overall this is really simple but handy project. [...]

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>