Go Down

Topic: Servo or other motor? (Read 1 time) previous topic - next topic

Tommi

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

zoomkat

From before the digital revolution.

http://web.comporium.net/~shb/t-stat.htm
Google forum search: Use Google Advanced Search and use Http://forum.arduino.cc/index in the "site or domain:" box.

Robin2


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

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.

Robin2

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 https://github.com/DerekK19/Arduino/tree/master/libraries/ServoTimer2

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

...R

Tommi

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  :smiley-slim:

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

Robin2

#6
Dec 05, 2013, 07:41 pm Last Edit: Dec 05, 2013, 07:46 pm by Robin2 Reason: 1
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
http://sourceforge.net/projects/pgahtow/files/Arduino%20(v1.0)%20libaries/

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

...R

Tommi

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

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

michinyon

Your entire project seems misconceived.

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

scottyjr

Quote
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

Tommi


Quote
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 ;)

I can make a picture if you are curious.

Tommi

zoomkat


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.
Google forum search: Use Google Advanced Search and use Http://forum.arduino.cc/index in the "site or domain:" box.

Tommi

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):
Code: [Select]
// 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

Go Up