Pages: [1]   Go Down
Author Topic: Servo or other motor?  (Read 973 times)
0 Members and 1 Guest are viewing this topic.
USA
Offline Offline
Newbie
*
Karma: 0
Posts: 7
Getting started with Arduino....
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

0
Offline Offline
Tesla Member
***
Karma: 143
Posts: 9586
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

From before the digital revolution.

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

Consider the daffodil. And while you're doing that, I'll be over here, looking through your stuff.   smiley-cool

UK
Offline Offline
Tesla Member
***
Karma: 124
Posts: 7104
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

USA
Offline Offline
Newbie
*
Karma: 0
Posts: 7
Getting started with Arduino....
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

UK
Offline Offline
Tesla Member
***
Karma: 124
Posts: 7104
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

USA
Offline Offline
Newbie
*
Karma: 0
Posts: 7
Getting started with Arduino....
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

UK
Offline Offline
Tesla Member
***
Karma: 124
Posts: 7104
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
« Last Edit: December 05, 2013, 01:46:56 pm by Robin2 » Logged

USA
Offline Offline
Newbie
*
Karma: 0
Posts: 7
Getting started with Arduino....
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

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

Offline Offline
Faraday Member
**
Karma: 62
Posts: 3013
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Your entire project seems misconceived.

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

Pottstown, PA
Offline Offline
Sr. Member
****
Karma: 5
Posts: 318
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

USA
Offline Offline
Newbie
*
Karma: 0
Posts: 7
Getting started with Arduino....
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

I can make a picture if you are curious.

Tommi
Logged

0
Offline Offline
Tesla Member
***
Karma: 143
Posts: 9586
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Consider the daffodil. And while you're doing that, I'll be over here, looking through your stuff.   smiley-cool

USA
Offline Offline
Newbie
*
Karma: 0
Posts: 7
Getting started with Arduino....
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
// 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
Logged

Pages: [1]   Go Up
Jump to: