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.












13 comments
3 pings
djdan says:
October 28, 2011 at 4:53 am (UTC -7)
I’m doing a similar project, and out of curiosity, what thickness are your high-current AC traces?
admin says:
October 28, 2011 at 7:51 am (UTC -7)
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.
Ethan Frei says:
October 28, 2011 at 2:13 pm (UTC -7)
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!
admin says:
October 29, 2011 at 3:45 am (UTC -7)
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.
Ian says:
October 28, 2011 at 5:12 pm (UTC -7)
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.
admin says:
October 29, 2011 at 3:53 am (UTC -7)
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.
Alex Whittemore says:
October 31, 2011 at 7:04 am (UTC -7)
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.
admin says:
October 31, 2011 at 12:22 pm (UTC -7)
Thanks!
valy says:
November 4, 2011 at 10:44 am (UTC -7)
where is hex?
admin says:
November 4, 2011 at 10:47 am (UTC -7)
What’s hex? What you mean by that?
asf21 says:
December 3, 2011 at 7:47 am (UTC -7)
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!!!!!
admin says:
December 3, 2011 at 8:16 am (UTC -7)
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
Amy Wu says:
May 17, 2012 at 8:51 pm (UTC -7)
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
DIY thermostat keeps the harsh winter cold at bay | ro-Stire says:
October 27, 2011 at 3:39 pm (UTC -7)
[...] zero. He decided to construct his own programmable thermostat to keep things in check, and has been documenting the process as he goes [...]
DIY thermostat keeps the harsh winter cold at bay | The Depot of Talk says:
October 27, 2011 at 8:02 pm (UTC -7)
[...] zero. He decided to construct his own programmable thermostat to keep things in check, and has been documenting the process as he goes [...]
Just simply good AVR thermostat | Embedded projects from around the web says:
October 31, 2011 at 1:56 am (UTC -7)
[...] 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. [...]