Servo or other motor?

Hey,

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?

Thanks,
Tommi

From before the digital revolution.

http://web.comporium.net/~shb/t-stat.htm

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

Robin2:

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.

Ah ... You didn't say that in your original post and many people ask questions that have no sensible basis.

There is a servoTimer2 library that uses timer2. I think this is the link for it Arduino/libraries/ServoTimer2 at master · DerekK19/Arduino · GitHub

I have used this but I can't immediately remember the project so I can't find the source I got it from.

...R

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 :relaxed:

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.

Thanks,
Tommi

I doubt you will find anything as cheap and convenient to control with a program as a servo.

Edit to add ...

I remembered where I use ServoTimer2 and this is where I got the library

I have a vague memory that I had another version that didn't work with the latest Arduino IDE.

...R

Well, it seems that there are not quite real alternatives to a servo - so be it :slight_smile:

Thanks, I hope I find the time on the weekend to tinker a little bit. Will report back!

Your entire project seems misconceived.

How is a thermostat "based on" a tilting mercury switch ? It probably actually isn't.

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

scottyjr:

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 :wink:

I can make a picture if you are curious.

Tommi

michinyon:
Your entire project seems misconceived.

How is a thermostat "based on" a tilting mercury switch ? It probably actually isn't.

The thermostat in the link I posted has a mercury tilt switch in it.

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).

Onto new problems!

Thanks,
Tommi