Monday, January 18, 2010

Project #1 - input voltage

It seems that sometimes your experience in some subject is your worst enemy. I started drawing my schematic, and because ARM microcontrollers need +3.3V input voltage I automatically assumed that AVR need it too. So I put inside LM1117 voltage regulator and other unnecessary components. Today my colleague told me, that AVR works fine with +5V. I scrapped 50% of the schematic and started again.

Immediately I discovered that +5V circuits are cheaper than +3.3V (for example when you compare MAX232 and MAX3232). Later I found also that AVR may work faster on +5V - 16MHz. On +3.3V it may work with 8MHz only. Not that I need 16MHz anyway for my PRT (Programmable Room Thermostat).

Sunday, January 17, 2010

Project #1 - electronic CAD

To make a simple PCB by etching, I don't need any software, or special equipment - just some good chemical solvent (for cleaning the copper) and permanent marker (for drawing connections). But it's extremely hard to make anything more complicated that way - it's a medieval-book-writing-monk type of work.

Using specialist CAD software helps a great deal. What does PCB CAD essentially do? It connects the logical design of the circuit with physical design of the PCB. First I make an electronic schematic of my circuit - using logical symbols like resistors, capacitors, ICs and connectors. Every time I need to use a part I open part database, choose a suitable element, and place its symbol onto the schematic. Then I connect the parts using wires (lines). When I'm done, I click "PCB Design", and the program opens another window, where once again I place symbols of my components. But this time I place physical parts - with proper dimensions, pinouts and packages - the program automatically assigns physical symbol to every logical symbol. After that I route wires between the symbols and it's done. Optionally I may generate CAM files used to manufacture my PCB on CNC machine.

There are many free PCB CAD programs on the web. These are often connected to some big part suppliers. This is probably the most complete list available. For my project I chose a program called Eagle by German company CADSoft. It's free for hobbyists, and has some limitations, but they are not important in small projects. Eagle was fully independent software some time ago, but it has been purchased by Farnell - big part supplier. I expect some new version of Eagle with integrated Farnell part base to appear. However Farnell is quite expensive when buying small quantities of parts (ex. single ICs), so a hobbyist like myself won't be using this kind of integration much. It's quite sad, because integrated part base would make my life much easier. Maybe in a country like US people may put any part they want into their projects, but here in PL I have to carefully check availability of every part. Otherwise I'll either wait 2 months to get it, or pay 2 times the price, sometimes both.

About Eagle - it has some pros and cons - I'll describe them briefly:
  • Has decent database (I usually find what I'm looking for) and user-made libraries
  • Easy to use (it has a command line for hard-core users)
  • Many resources on the web
  • Pathethic database searching (it's 2010 now, everybody has autocompletion and search-as-you-type in their programs, and here I have to type name in little window and press Enter)
  • Shortcut - not Windows compatible
  • Tediousness - for example as a hobbyist I want electrical pads in my projects a bit larger than default - I don't know how to achieve it without modifying every single symbol

With this post I finished the introduction to my project. The information contained here is obvious for most people, but I felt that it's necessary to describe it, as it's part of the project too. With the next post I hope to move on to some technical details.

Sunday, January 10, 2010

Project #1 - choosing microcontroller

In every project there are some decisions to make at the beginning which influence all further steps. In small embedded project probably the most important choice is about the microcontroller. At first I wanted to use ARM microcontroller, more specifically Atmel SAM7X. I have experience in programming these μCs in C, they are reliable, powerful, not very expensive, and you don't need any external programmer to program them (thanks to SAM-BA). I have a minimodule based on SAM7X256 I bought to play with it, but never made anything useful of it, so I thought I'd put it into the thermostat. But on Friday evening I checked everything up once again, and I totally changed my mind. Atmel SAM7X256 is at least 20 times too powerful for a simple project like mine - it would be stupid to waste it to click a relay two times a day.

My natural second choice was Atmel AVR. These μCs are extremely popular in PL among hobbyists. Professionals also widely use them - in commercial applications engineers usually have to cut their costs and use reliable solutions. There are tons of code and resources for AVR on the web, and also official application notes on Atmel's webpage. I did one little project with AVR Atmega8 about six years ago - it was a basic mobile robot. I used very cheap LPT programmer, and coded robot behaviour in BASCOM - simple BASIC-like language for beginners. Nowadays LPT port is quite uncommon. Luckily I have an ISP programmer, which I bought to play with some other stuff, but never made anything useful of it (there seems to be some pattern here). I'm also not going to use BASCOM anymore - I feel that C has the right power to ease of use ratio for me.

After choosing μC I decided that I'll be making my circuit board from scratch by etching. I always did my circuits on protoboards using greenwire (kynar) to make point-to-point connections. It's great for prototyping, but it's slower and less reliable. Using a protoboard is also bad psychologically - I want to finish my thermostat fast, not prototype it forever.

The next step is to choose some CAD software for PCB design, and get to some real work.

Tuesday, January 5, 2010

Project #1 - controlling the boiler

At the beginning of the project I need to make some important decisions how to build the thermostat, and what components to use. The first problem is how to control the boiler. I checked the manual of my boiler, and I found a schematic (version in Spanish, but quite obvious):

On the schematic there is a jumper P1 which connects terminals 6 and 9. The boiler was supplied with the jumper in place. Removing the jumper turns off the heating circuit of the combi-boiler, even if heating is enabled on control panel (and domestic water works normally). That's very good news, because the only thing I need to do is to replace the P1 jumper with a relay, and I don't have to care about electrical compatibility of my thermostat and the boiler. Well I just have to choose a relay big enough for the voltage and current present in the circuit.

I measured the voltage between terminals 6 and 9, and my ancient multimeter shows 28V. Quite strange value, but it doesn't matter - 125V or 250V relay will work perfectly.

Saturday, January 2, 2010

Project #1 - programmable thermostat

My first project is a programmable thermostat for a boiler mounted in my apartment. In a town where I live there is a small CHP power station (combined heat and power). It was built long ago to support the industry with hot water for technical processes, and actually generates very little electricity (6MW in winter, during other seasons even less). The station supplies almost all apartment and commercial buildings in the area with hot water for heating and washing purposes. My building is probably the only exception. Such solution is both blessing and curse, as it gives me better control over heating, but is not forgiving of any mistakes ($$$).

The boiler is 24kW Nike Mini from Italian company Immergas, not the latest model, but still quite new. It is a combi-boiler - it produces hot water for both heating and domestic uses. The boiler can be set to provide domestic water only, or both heating and domestic water. Domestic water flows through heat exchanger and then directly to taps. Water for heating flows in a closed circuit and it's moved by electrical pump. The temperature of the heating water is measured by a sensor, and when it's too low, the boiler ignites itself and works for some time (it's either fixed time or until the temperature raises to acceptable value - I don't know).

The problem is that the boiler doesn't measure the temperature inside the apartment, so it doesn't switch off even if the temperature reaches preferred value. It also has no means of time-related programming, so it runs all the time, even when nobody's home. That's why the programmable thermostat is necessary. This device switches the boiler on only when the current temperature in the apartment (precisely in one of the rooms) is lower than value set in thermostat's memory.

Of course Immergas sells all kinds of thermostats for its boilers. Small electronic companies and workshops also sell thermostats which can easily be adapted to control my boiler. But by making it I hope to learn some new skills and test some solutions which might be useful later.