We have moved at community.getvera.com

Author Topic: Controlling a servo  (Read 7158 times)

Offline Cor

  • Hero Member
  • *****
  • Posts: 1249
  • Karma: +8/-4
Re: Controlling a servo
« Reply #15 on: November 24, 2014, 02:35:27 pm »
@ Cotejean:   Just came home from a working week and immediately hooked the arduino on my computer and changed the sketch  ;D ;D ;D ;D

Awesome , I have now 180 degrees movement with the slider.

It is just ashame it only goes with 10% steps, if it would have been possible to set 1% steps, I could make like 20% is 20 degrees celcius, 21 %= 21 degrees celsius etc ... ( now I just have to make a note somewhere that for example 30%= 24 degrees C)

But I think that's a shortcomming of vera and can not be changes in the sketch?

Many thanks for your help,

Tomorrow I will install the bracket and servo on the thermostate.
Cor


*edit* :oh ..... I see that with authomation it is possible to set 21-22 % etcetera ...... cool!!!

I do notice that the "UP-DOWN" is responding wierd, it does sometimes something completely oposite and than again it goes correct , those 2 button are a bit strange.

Cor
« Last Edit: November 24, 2014, 02:52:22 pm by Cor »

Offline Cor

  • Hero Member
  • *****
  • Posts: 1249
  • Karma: +8/-4
Re: Controlling a servo
« Reply #16 on: December 08, 2014, 07:58:25 pm »
This whole project is not without problems.

Finally today I got my bracket for the servo working ( photo's to follow) , and it was time to switch from Arduino uno to a nano.....

Hello all,

I have an arduino uno with a servo succesfully installed, but the arduino was just for testing purposes.

Ijust recieved my 2 nano's ( http://www.ebay.de/itm/291244948748?_trksid=p2060778.m2749.l2649&ssPageName=STRK%3AMEBIDX%3AIT )

Installed everything and uploaded the sketch , just to be sure I deleted the 2 devices I allready had ( the arduino node and the arduino win covering) . I press start to include , nothing happends.

Tried the second nano, exactly the same , tried to upload the sketch with "#define CHILD_ID 11 // Id of the sensor child " instead of 10 ( maybe an issue since the uno used 10 ).

But still the same .

Deleted the whole "my sensor plugin" and tried all again...... no luck with the nano's.

My last resort was to use again the uno , I press start to include , and yes , almost immediately the 2 devices were found.

What can be wrong??!

Hopefully someone can help, it's quite frustrating.

Thanks,
Cor

Offline gregl

  • Full Member
  • ***
  • Posts: 188
  • Karma: +9/-3
Re: Controlling a servo
« Reply #17 on: December 09, 2014, 01:24:25 am »
Hi Cor, you probably best off asking for help at mysensors forum...

but what output do you get from the serial connection s of your arduinos, and have you used a decoupling capacitor on the radios? I've found many of the nanos cannot power the radio properly.

Offline korttoma

  • Hero Member
  • *****
  • Posts: 729
  • Karma: +26/-5
Re: Controlling a servo
« Reply #18 on: December 09, 2014, 02:55:33 am »
@Cor your powering the radios with the LE33ACZ right?
It says that this regulator has an output current up to 100mA and your using the -PA -LNA version of radio witch will need over 150mA when sending at full power. Did you lower the RF24_PA_LEVEL in the MyConfig.h ?
Your setup worked with the UNO right? Are you powering the radio differently now?
Bottom line is that most problems people have with the MySensor setup are due to powering of the radio modules (not enough current or dirty power).

Like gregl said you are also welcome to join the MySensors forum for support.
- Tomas

Offline Cor

  • Hero Member
  • *****
  • Posts: 1249
  • Karma: +8/-4
Re: Controlling a servo
« Reply #19 on: December 09, 2014, 03:02:50 am »
@ Gregl,   I have posted as well on the mysensor- troubleshooting forum ( http://forum.mysensors.org/topic/698/servo-on-arduino-uno-works-but-not-with-nano )  ..... the only thing someone came up with was to clear the eeprom , what I will try shortly.


You say , the nano might not give enough power to the radio , how can I test this?  just a volt meter on ground and 3.3v?

@ korttoma,

this is the nano:
http://www.ebay.de/itm/291244948748?_trksid=p2060778.m2749.l2649&ssPageName=STRK%3AMEBIDX%3AIT
and this the radio:
http://www.ebay.de/itm/310651702557?_trksid=p2060778.m2749.l2649&ssPageName=STRK%3AMEBIDX%3AIT

I will try to lower the rf24_PA_level  , but to which number , what would be sensible , and, where do  I find this myconfig.h?



thanks,
Cor

Offline korttoma

  • Hero Member
  • *****
  • Posts: 729
  • Karma: +26/-5
Re: Controlling a servo
« Reply #20 on: December 09, 2014, 03:36:38 am »
If you are using the 3.3V out from the nano you should definitely lower the PA level. the MyConfig.h can be found from your MySensors arduino library folder (try RF24_PA_LOW or RF24_PA_MIN). The 3.3V output on the nano comes from the USB serial chip usually a FTDI chip but from the picture on MySensors forum it looks like your nano has a CH340G instead witch seems to have 80mA max on the 3.3V.

Another option is to use the 5v pin together with an external 3.3v regulator. How did you power the radio with the uno?
- Tomas

Offline Cor

  • Hero Member
  • *****
  • Posts: 1249
  • Karma: +8/-4
Re: Controlling a servo
« Reply #21 on: December 09, 2014, 06:01:33 am »
@ Korttoma: awesome !!, you helped me bigtime.  :) :)

It was the wifi shield what was the problem ( caused me a very short night) .
I didn't find how to edit the myconfig.h , although I found the file on codebender.cc ( which I use to upload sketches).

Anyway , I did have also several of the other wifi shields without the antenna , and tried that one, and immediate succes  ;D

But now , since the arduino comes in a basement I really want the highest output with the external antenna. Would using this nano ( with  the CH340G )with a 3.3v regulator  from the 5v output be sufficient?  Than I will order some of these regulators.

One more question regarding this line in the sketch
Code: [Select]
#define CHILD_ID 10   // Id of the sensor child
When I have more servo's  ( on seperate arduino's)  , do I need to change the Child_ID to another number?   or do I need to do anything else to have my vera not confused  ::)

Thanks for your help,
Cor 


Offline korttoma

  • Hero Member
  • *****
  • Posts: 729
  • Karma: +26/-5
Re: Controlling a servo
« Reply #22 on: December 09, 2014, 08:29:45 am »
Looking at the schematic for the arduino nano http://arduino.cc/en/uploads/Main/ArduinoNano30Schematic.pdf you can see there is only a MBR0520 schottky diod between VUSB and +5V and this diode is rated at 500mA so it should be enough for the PA LNA radio and your nano.

Each Node is identified by the RADIO_ID and each sensor within the node is identified with the CHILD_ID so no you do not need to change it. If you want to have more then one servo (or some other sensor) atached to the same device, then you need to give them their own CHILD_ID.

If you use "gw.begin();" in your sketch the RADIO_ID will be automatically assigned to a unique number during inclusion so you do not need to worry about it.


I like to know the RADIO_ID of my devices so I use the following in my sketches but I have to make sure I do not assign the same ID to more then one device.

#define RADIO_ID 11

gw.begin(NULL, RADIO_ID);

- Tomas

Offline Cor

  • Hero Member
  • *****
  • Posts: 1249
  • Karma: +8/-4
Re: Controlling a servo
« Reply #23 on: December 09, 2014, 09:20:47 am »
@ korttoma: again , many thanks for your help.   It is all working now .

This evening I will buy some of these 5 to 3.3v thingies so I can use the "better" wifi shields" next week.

Thanks for the clairification of the sensor ID , I am not gonna change the sketches for the moment , it is all a bit of a mystery to me for thte moment , but so happy it is working !!!  ;D

Cor


Offline Cor

  • Hero Member
  • *****
  • Posts: 1249
  • Karma: +8/-4
Re: Controlling a servo
« Reply #24 on: December 10, 2014, 02:25:22 pm »
As promised , here some pictures.

I had to make quite  a bracket to hold the servo. Initially I had a standard 3 kg/cm servo , but it wasn't enough to completely close the valve.  I ended up using a big scale servo with 14 kg/cm on 7V. Offcourse the servo is powered by a seperate 7V, max 5A power supply  ;D

Initially the plan was to attach the servo directly to the thermostat ,  at that time I didn't know the themostat not only turns , but also moves in-and outwards .....

Plan 2 was to use a timing belt system with 2 sprockets , also this didn't work , because the servo pulled the thermostat towards it

Plan 3 finally worked , I routed out of trespa a bracket where the servo could go freely in and out , but not turn itself.
This trespa ( white) attached to the metal bracket. Now the servo can do it's normal thing , turn the lever , but also move in and outward.

In short quite a project , but it is working now..... just waiting for the setpdown regulator to attach the 'better"wifi shield.

Thanks or all the help ,
Cor