I am struggling a little bit on how to approach this. I am about to make a custom thermostat for my apartment. The thermostat I am having now is based on a tilting mercury switch. As I do not want to change the system my plan is to build a device that tilts the complete thermostat and therefore control on and off of the heating. That means I would just need a little bit of movement, maybe 2 cm or so should be enough.
At first I thought about using a servo, but then I found that the standard servo library and the virtual wire library use the timer1. That gave me some troubles. Now I am not sure if there are other good actuators that I could use or if I should take the time and play with the software based servo library.
Are there any good alternatives to a servo? A regular motor would probably spin too fast and I don't want a gear and everything. Any other cool ideas?
Tommi:
At first I thought about using a servo, but then I found that the standard servo library and the virtual wire library use the timer1.
I can't see what this has got to do with anything?
A servo seems ideally simple if all that is needed is to tilt something.
...R
Yes, a servo would be ideal. But as the virtual wire library (that I also use for my outdoor sensor) uses timer1, I cannot use the standard servo library as this also would need to use timer1. So I am wondering if I should invest more time into using a different servo library (initial tests were not positive) or if I could just buy some other small motor and call it a day.
Hehe, well I tried to make the point in the beginning that I ran into troubles with the timer, but seems I was not clear enough
Thanks for the suggestion, will check that out! (will have to wait for the weekend...)
Are there other cool ways I could actuate that? For me even some binary "motor" would be enough, that just moves the thermostat enough that it goes from heating to not-heating.
How is a thermostat "based on" a tilting mercury switch ? It probably actually isn't
I vaguely remember seeing a thermostat with a loose coil of some metal with a mercury switch attached to the end of the outermost loop of the coil. I imagine that the metal of the coil contracted/expanded with temperature, changing the position of the switch in an arc, 'tilting' the switch. - Scotty
How is a thermostat "based on" a tilting mercury switch ? It probably actually isn't
I vaguely remember seeing a thermostat with a loose coil of some metal with a mercury switch attached to the end of the outermost loop of the coil. I imagine that the metal of the coil contracted/expanded with temperature, changing the position of the switch in an arc, 'tilting' the switch. - Scotty
Correct. It is a bimetal coil spring and at the end horizontally a mercury switch is attached. The different thermal expansion coefficients of the two metals make the coil curl more or less with temperature. That in turn tilts the switch and operates the heating. Smart solution of a pre electronics era
Ok, finally seems that I solved the problem. OK, step by step:
The ServoTimer2 library worked well with my Arduino UNO. Only when I tried to use it with the Mega (probably should have mentioned the mega earlier...) it stopped working.
The error I got when I tried to run the servo library AND the virtual wire library was that they both used Timer1. Until now I was not able to find a solution on how to use virtualwire and servo with the mega. The solution was actually super simple:
The regular servo library that comes with the Arduino distribution can be adjusted easily to not use timer1 (or any other timer I think). If you look at the header definitions of Servo.h, you see that from lines 60 - 84 the timers for various platforms are defined. As I am using the MEGA2560, I actually have 5 timers I could potentially use. All you have to do is remove line 62, which defines Timer1.
The timer definition for the mega looks like that after the modification (lines 59 - 65):
// Say which 16 bit timers can be used and in what order
#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
#define _useTimer5
// #define _useTimer1 //just comment this line to not use timer1
#define _useTimer3
#define _useTimer4
typedef enum { _timer5, _timer1, _timer3, _timer4, _Nbr_16timers } timer16_Sequence_t ;
The drawback of removing one timer here is that you cannot use as many servos. But as you can have 12 servos per timer, that is not a real problem (at least for me).