Remotely controllable resistors

Today some new potentiometers arrived – digital potentiometers in Plastic DIP (PDIP) package. I ordered some MCP41010 and MCP41100’s with a value of 10 kΩ and 100 kΩ respectively.

These potentiometers operate with a 2.7-5.5V supply, consume <1 µA and have a SPI interface to control the wiper position. The maximum wiper current can be 1 mA and its position varies linearly according to the 256 positions (steps) to which it can be set. Well, if you need to know more, all info can be found here. And they’re not expensive; <2 Euro each.

The first thing I tried was controlling one of those potentiometers with a spare Arduino and see if I could dim a LED with it.

Digital potentiometer

An Arduino, an MCP41010, a resistor, LED and some wires were put on a breadboard and I started reading the datasheet to find out how I could control the wiper resistance.

There are 3 commands available to control the DigiPot: one to write a new value (to set the wiper position), a shutdown command and a NOP command. After this command byte follows a data byte. For example, to set the wiper position to 25%, 2 bytes have to be sent: 0x11, 0x40. And for 50% it’s 0x11, 0x80. Let’s write some code now…

The Arduino (1.0) SPI library comes with a Digital potentiometer example, so with some  modifications not worth mentioning I came up with this:

#include <SPI.h>

const int slaveSelectPin = 10;

void setup()
{
  pinMode (slaveSelectPin, OUTPUT);
  SPI.begin();
}

void loop()
{
    for (int level = 0; level <= 255; level++)
    {
      digitalPotWrite(level);
      delay(10);
    }
    delay(1000);

    for (int level = 255; level >= 0; level--)
    {
      digitalPotWrite(level);
      delay(10);
    }
}

int digitalPotWrite(int value)
{
  digitalWrite(slaveSelectPin, LOW);
  SPI.transfer(0x11);
  SPI.transfer(value);
  digitalWrite(slaveSelectPin, HIGH);
}

This sketch will continuously brighten and dim the LED each 6 seconds – that’s all there is to it!

Some details that can be important to know is that these digipots have a minimum resistance – for example, the 10 kΩ version I used here has a minimum resistance of 52 Ω. Another thing to keep in mind is that the wiper position goes to the mid-scale position upon power-up, so it doesn’t remember the position it had before the last shutdown.

Why did I buy these digital potentiometers? Well, not to SPI-enable the volume knob on our AV receiver, but to fool our room thermostat and make it believe it’s colder than it really is – either by putting a 10 kΩ version in series with the external NTC sensor or totally replacing it by 2 x 100k parallel, which gives me a range of ≈50 kΩ.

But before I get there, I’ll have to find a more suitable digipot – non-volatile, available in a size I can easily handle (DIP) and as much steps as I will need.

To be continued…

Still not satisfied

After monitoring the temperatures in our house for a week with the new external sensor attached to the room thermostat, I’ve seen improvements and some things I didn’t expect.

The good thing is that the temperatures upstairs went up with approx. 2°C in the rooms upstairs, much closer to what they should be. What worried me was that the temperature in the living-room still got too high sometimes – the floor heating just produced too much heat under certain circumstances.

And the fact that the door between living-room and hallway being open for about 10 cm. still had a lot of influence on the external thermostat sensor in the hallway is something I didn’t expect – I’ll have to do something about that. Keeping that door closed is not a real option – our 3 cats (and hence the rest of the family) wouldn’t like that…

So what are the plans for next week?

Capping the floor heating

It sounds like a good idea to ‘cap’ the floor heating – why should I keep the floor heating pump running when the temperature in the living-room is equal to or higher than the temperature setpoint over there? I can’t think of any reason why I should, so I created a time-triggered event that periodically checks the measured temperature in the living-room, compares it to the room setpoint and shuts down the pump if the temperature is OK.

Creating my own reference temperature

Although the idea of an external temperature sensor already improved things a lot, I’m still not satisfied. What I’d really like to do is ‘feed’ the thermostat with a self-made reference temperature, i.e. a temperature value other than just the temperature of the living-room, hallway or any other individual location in our house. That self-made reference should somehow reflect ‘the need for heat’ throughout the whole house, no matter where that need comes from: living, office, bathroom, bedrooms – wherever.

 

The first one is simple; an appliance module is all that’s needed. The second one needs some more work, namely:

1. How to calculate this reference temperature

Should it be a value calculated based on an accumulation of all errors (measured temperature minus setpoint) of the rooms involved? Or the average error? Should a temperature error in the living-room have a bigger impact than the temperature error in the bathroom? And how about automatic ‘room exclusion’ (as in excluding rooms with a door or window open) from the calculated reference temperature?

2.  How to make the thermostats’ external sensor contact ‘sense’ this temperature?

The external sensor is ‘just’ an NTC, a sensor with a resistance that varies with the temperature. Is there  a way to simulate an NTC with hardware & code? With a digital potentiometer perhaps? But will this digital potentiometer be accurate enough, provide enough resolution and will I be able to mimic the nonlinear R/T characteristic of the NTC well enough?

 

A lot of questions, new things to learn, explore and try out; which is just what I like to do most!

 

Eliminating errors in temperature control

Those who have visited my blog more than once, will probably know about my continuous struggle to get a better control of the temperatures throughout the house, both up- and downstairs.

To demonstrate the biggest ‘problem’ we have here regarding temperature control, I made a chart showing 2 different temperatures. The blue line shows the temperature measured in the living-room, by the internal sensor of our thermostat. The red line shows the temperature measured in the hallway, with an RF temperature sensor.

Oh, and the trends in the chart below could well be just like yours, cause it’s a very common phenomenon:

Temperature charts

Most of the days were sunny, but the last 3 weren’t. The peaks in the blue line (i.e. the temperature in the living-room) are caused by the solar radiation, warming up the living-room to almost 23 degrees! That’s OK of course, but the result is that the central heating will not burn from approx. 12:00 till 18:00. And the whole house, except the living-room, is getting colder and colder.. So no matter what I do, this is the first thing I have to fix -I need a different reference temperature. I know that for quite some time, but never did something about it. Not every thermostat has the ability of connecting a remote temperature sensor to it, I didn’t want to move the thermostat to another location and we sure don’t want to block the sun radiation that’s warming up the living-room for free. (oh and btw: no, the thermostat is not ‘hit’ by direct sunlight).

So last Thursday I added another item to my ever growing collection of hardware to control the temperature inside: a remote temperature sensor.

Honeywell F42010972-001

A week ago I stumbled upon this sensor of which I didn’t even know it existed and immediately decided to buy it and give it a try.

I pulled 2 m. of ‘thermostat wire’ through the wall to my Honeywell Chronotherm Touch Modulation, connected the sensor, configured the thermostat and left the remote sensor dangling in the hallway, near the coat rack and started watching the OpenTherm information.

The remote sensor now replaced the internal sensor of the thermostat and I immediately saw the temperature dropping from 20.5 °C to 19 °C, which is the temperature in our hallway. At the same time, the modulation level of the boiler went up to 100% 🙂 Of course, I’ll have to adjust the ‘room’ setpoint … lowered that one with 1.5 °C as well and things seemed to stabilize again.

That’s part 1 of the story. Part 2 is preventing the heat produced by the boiler flowing to the living-room when it’s not needed there (cause the sun radiation is already produces enough). Well, that’s not that hard – I can control the floorheating pump with an appliance module and switch the pump off@setpoint+0.1°C and back on when the temperature reaches setpoint-0.1°C. Done…

Let’s see what this new setup brings in terms of stability…

Down from 4 to …

I’ve still got my first PLCBUS PC Interface (1141 G, USB). It’s one of the first things I bought after I concluded that 1-way RF won’t make it in our house – too unreliable. That was 4 years ago. And because the first PLCBUS Interface took a while to be delivered I bought a second one, an RS232 version this time. I connected this one to a RS232 to Ethernet server and have been using it ever since. The USB Interface, once it arrived, ended up in a box labeled “to do”… And now is the time to do just that 😉

The ‘problem‘ is that I don’t like USB that much. If I can I’ll try not to be forced to use it, especially when it comes to Home Automation related hardware. It’s nice to transfer photos, a portable HDD and stuff like that but I’m always having trouble with those USB drivers – half of them don’t exist for my Windows 7 x64 PC or aren’t digitally signed and hence force me to tweak my system, or are too buggy to use 24/7; especially when connecting less common hardware like Logic Analyzers and other exotic stuff.

So, I’ve got this PLCBUS Interface with a USB Interface – what can I do to make this interface usable (for me)? I decided to open the box and have a look inside. First thing I encountered was a PCB in heat shrink with 2 IC’s on it:

Max232 sideProlific

 

 

 

 

 

In the pictures of the PCB above there’s a MAX211 on one side and a PL-2303 IC on the other. The left side of the PCB is where the USB cable is connected.

The wires which are cut went to the PLCBUS Interface PCB, of which the image below shows an interesting part:

The 2nd MAX232

Aha, another MAX, a MAX232 this time. Wait.. so the signal is converted from TTL to RS-232, back to TTL again, converted to USB and to a virtual COM port on the PC – while all I really need is 5V TTL for my recently arrived TTL to Ethernet converters!

I found these small converters after a tip on the domoticaforum and bought 2 of these and 2 Wifi converters. The wired converters seem to be working fine according to other forum members and the Wifi converters – well, I think I’ll need them in the near future for making my own ~35 Euro costing Wifi enabled LED controller!