Introduction: ARDUINO 433MHz _ SERVO.h Vs VIRTUALWIRE.h

As everyone that found this Instructable probably already knows:

The Servo Library is using the same Timer as the VirtualWire Library does, so using Servos with RemoteControlled Arduinos is not as simple as it should be.

As it took me a week of researching and testing scripts, i wanna share the output, so you can speed things up by starting with this Instructable

My approach in this Instructable is to use a third Arduino that sends the information it got from the 433Mhz Receiver via the "normal" Wire library to the Arduino that controls the Servos.

Beside the Timer Issue, i also make some room on the Arduino that drives the servos for some scripts/combination of servo signals like V-Tails (airplanes) without getting issues with receiving and decoding signals from the remote.

I personally use this to control a 1:24 MAN TGA StreetSweeper, to slow servos down, couple it to other functions, like simulated gear shifts etc, which is not possible on common model RX/TX combos.

Step 1: ARDUINO to 433 TX

I use an Arduino UNO here, as my prefered Arduino (Feather M0) cant use the virtualwire at all, which is sad to begin with :)

As you can see on the Image, wiring is pretty straight forward:

It uses a pot on analog IN to generate the values to transmit

It sends this values to the 433MHz module.

On the code side, it takes the value(s) it gets from the pot and writes it in an array.

It then sends the array to the Rx where it gets transformed back to the original values.

Step 2: 433 RX to ARDUINO to I2C

The receiver side is a bit more complicated then on the transmitter side:

The 433Mhz module gets power from the arduino micro, and sends its signal to the micro via the micros PIN 11. The Micro itself sets up an I2C line via PIN 2 (SDA) and PIN 3 (SCL) and sends the values it gets to the Featherboard.

In the attached script, it only sends the first value and keeps the other three, from the three remaining POTs, as i just needed the first value.

If you need them all, just send them all.

See the next step for I2C to Servo

Step 3: I2C ARDUINO to SERVO

In the last script, we take values that came via I2C and set the servo according.

See the script for more details.

Step 4: CONCLUSION

This Script/Instructable a huge of a walkaround for stuff that should be way more simple

I also found different (hardware) walkarounds, beside change one of the libraries, so they dont need the same timer.

  • Dont use the SERVO.h library, but instead use an Adafruit PWM/servo shield.

Those shields have their own timers and run via I2C (i think thats the version i will use)

  • Use a cheaper Arduino, like a trinket for decoding the 433 signals
  • Make your own shield that hosts an ATiny8 and the 433 receiver out of a feather protoboard
  • Dont use 433Mhz RxTx but a hobby RxTx combo.

Step 5: USED LIBRARIES

  • WIRE.h

https://www.arduino.cc/en/Reference/Wire

  • VIRTUALWIRE.h

https://www.pjrc.com/teensy/td_libs_VirtualWire.ht...

  • SERVO.h

http://playground.arduino.cc/ComponentLib/Servo

  • SOME INFORMATION OF HOW TO ADAPT SKETCHES FOR M0 BOARDS

https://learn.adafruit.com/adafruit-feather-m0-bas...

  • THE RX/TX COMBO I USED

https://www.amazon.de/receiver-Superregeneration-Wireless-Transmitter-Burglar/dp/B00ATZV5EQ

Comments

author
AnantS5 (author)2017-02-24

I'm having problems sending 4 values of 4 potentiometers over the i2c bus. How can we send those 4 values over i2c bus? I tried to send those 4 values using an array but the software is showing me an error.

author

Hi, can you copy the error message and paste it in here?

author
anteino (author)2016-11-29

I did something similar to this. I connected the power pin of the transmitter directly to my 5V source, instead of having this power go through the Arduino first. For the receiver I did the same. I even bought special 433 MHz rated little antennas. The path between the transmitter and receiver is through the air without any obstacles. Still, the range isn't even 4 meters. I was thinking of using a step up voltage regulator of 12V to power the transmitter. But the modules are rated for 20 to 100 meters of range depending of the voltage input (3 to 12V I believe). At 5V I'd say I'd at least get 20 meters, but since I only get at most 3 meters I don't think stepping up to 12V would make a significant difference. Any tips on this?

author

I got the same problems, though with 17cm wire as antenna i get like 5-10m.

At the end i found another version to get RC signals in and out with arduino:

Bought an Adafruit PWM shield. Those shields have their own timers, and dont need internal interrupts/timers at all.

I made a video :

https://www.youtube.com/watch?v=hI-NF0oMP88

author

Cool, thank you :) I see you uploaded the video today, I hope you didn't go through all the trouble of making a video just to answer my question ;) What's the range on that actually? I'm currently considering an HC-12 setup:

https://www.instructables.com/id/Long-Range-18km-Arduino-to-Arduino-Wireless-Commun/

author

No, i had the plan of uploading it anyway :)

What i meant before, is i connected the RC Rx to the Arduino, and powered the servos with the PWM shield via I2C

author

Okay yes I see how you did it now :)

About This Instructable

4,839views

89favorites

License:

Bio: I'm a 36 year old DIY enthusiast from Vienna Austria with a strong background in mechatronics/automation. My DIY field is mainly video/audio ... More »
More by InevitableCraftsLab:ELECAM 360 - BLADE 200 QX - FRP QUAD CHASSISARDUINO_ POLAR V PLOTTER ARDUINO 433MHz _ SERVO.h vs VIRTUALWIRE.h
Add instructable to: