Arduino Transmitter link up

Started by Elsrickle
18 replies 28 likes Last activity: 7 years ago
#19

Arduino Transmitter link up

He All, this is a Fourm me and a couple of other people setup to help with Arduino for RC boats/Subs mentioned above. pulse in works ok for one or two channels but interrupts work better

http://rcarduino.freeforums.net/
Liked by Martin555
#18

Arduino Transmitter link up

Hi G6SWJ thanks this is getting more complicated for me but am going to give the circuits a try will take me some time to fully understand it all but it’s a great challenge. Have been reading a lot on the arduino site you told me about a lot of help there as well.
Elsrickle
Liked by Martin555
#17

Arduino Transmitter link up

Go for it R. Admiral M ASAP👍
Here is your official Round To It😊
Let us know how you get on 🤞
Cheers, Fl. Admiral Doug 😁
😎
Young at heart 😉 Slightly older in other places.😊 Cheers Doug
Liked by Martin555 and marky
#16

Arduino Transmitter link up

Hi Stephen thanks your are right on the track I am trying to get too. Will give this a try. I will only be trying it as test at the moment and will work on one led only. As I am totally new to this field I have a lot to learn have only managed to get the default light working so far. But will get onto your circuit first chance I have.
Ian
Liked by Martin555
#15

Arduino Transmitter link up

Hi G6SWJ.
Thank you, I will have a go at that as soon as i get a little more time.
Thank's again.

Martin555.
If it looks right it probably is.
#14

Arduino Transmitter link up

Example pulseIn() code to read RC RX pin (tested-working)

/ This is example code for an RC switch /

unsigned long ch1;

/ run setup code once/
void setup() {
pinMode(4, INPUT); // Set our input pins as such
pinMode(3, OUTPUT);
Serial.begin(115200);
}

/ loop code/
void loop() {
ch1 = pulseIn(4, HIGH, 22500); // Read the pulse width of the channel - timeout after X milliseconds if no change to pin

if (ch1 > 0) {

if (ch1 > 1700) { //assigned to a 2 position switch
digitalWrite (3, HIGH); // turn on
if (ch1 < 1300) {
digitalWrite (3, LOW); // turn off
}
}
Serial.println(ch1); // print value read to serial monitor
}
}

Note: Pin 13 on many Arduino boards is connected to the onboard LED - This is great as a fast way to test code. Be aware that as the Arduino boots it normally flashes the led on pin 13 - so if you connect your switch circuit to pin 13 it will also switch on/off on board startup
I think it's the way I have learnt most of my stuff - getting very stuck first...
Liked by philcaretaker and Elsrickle and
#13

Arduino Transmitter link up

Never tried using analogRead for PWM - does it work?

I know you have typed this code from memory which from my experience always leads to silly errors - couple of observations - to stand a chance pin should be A1 not 1 but I think you would have more success with pulseIn() (mandatory use of timeout parameter as if no change in signal code it will waste time waiting for one to arrive!!!) - however I am not a fan of this command due to it's "code blocking" side effect - far better to use Interrupts

Another pointer - repeated use of analog Read can lead to spurious readings - there is only one AD convertor - the analog pins are multiplexed to the single AD - the solution is to read any analog pin twice with a 5 millisecond delay between and only use the second read.

The first read forces the multiplexer to look at your desired pin, the delay allows voltage sabilisation and the second read will be a good stable reading

How do I know this - because I lost many brain cells and hours of my life before I found the solution!!

Projects have a habit of evolving and getting more complex, using puslseIn() (with timeout parameter set) for reading a few RC receiver pins to control some switches works well, if you then progress to more complex projects you will eventually find that using pulseIn() comes back to haunt you (code blocking) - using interuppts is a sure fire way of sucess with complex projects

See this link for a great tutorial and explanation - I have used a variant of Ryan's code for years

https://ryanboland.com/blog/reading-rc-receiver-values/

.
I think it's the way I have learnt most of my stuff - getting very stuck first...
Liked by philcaretaker and Elsrickle and
#12

Arduino Transmitter link up

Hi Stephen.
Yes please, I would like to see more.
It would be nice to switch lights on and off.
At the moment i have the lights on my HMS Cottesmore switching in a loop, i would briefer to use the RX/TX to switch my lighting circuits on/off.

Martin555.
If it looks right it probably is.
Liked by Rookysailor
#11

Arduino Transmitter link up

It’s going to be something like:

void setup() {
pinMode(1,INPUT); // PWM signal
pinMode(13,OUTPUT); // lights
}
void loop() {
if (analogRead(1) > 512) { // PWM signal ranges between 0-1023
digitalWrite(13,HIGH); // switch on lights
} else {
digitalWrite(13,LOW); // switch off lights
}
}

The transmitter stick PWM range is probably closer to 250-750 but 512 will be somewhere in the middle. So anything higher and it’ll switch on pin 13.

Check the max mA on the Arduino output pin before linking to LED’s. Sometimes it’s best to go via a NPN mosfet if powering higher amps. Although another cheat is to switch multiple outputs on at the same time which will get you a few more mA, just don’t melt the Arduino! 🤣 🔥

Hope the above gives you a starting point. Just typed it out now! For something that latches and counts stick movements you’ll need to include variables. Let me know if you need an example for that too. I’m sure once you get into it, it’ll begin making more sense 👍

Stephen
We may not be able to control the wind 🍃 but we can always adjust our sails ⛵ - MBW Admin
Liked by Elsrickle and Rookysailor and
#10

Arduino Transmitter link up

Hi Doug,

The K in morse code is an abbreviation for "over" or "Invitation to transmit " or variations of that ilke.

If your local you call the town Ket ring - if not you would pronouce it as Ketter ring - easy to spot a local!!!

Hopefully we can pique others interest in Arduino, a very rewarding aspect to the hobby and it certainly exercises the brain cells. As many will know but if they don't Arduino is designed to be "accessible", whilst the first few hurdles might seem like vertical brick walls they are worth knocking down as once some of the concepts are mastered you can create some amazing projects.

It's a shame many will not scratch the Arduino surface and see what's invloved - we don't think twice about sending a text message on our phone - but if you put a phone in front a someone who had never done this before they would not have a clue of what to do, and it would seem a complex and all but impossible task!!!

. de G6SWJ
I think it's the way I have learnt most of my stuff - getting very stuck first...
Liked by philcaretaker and Martin555
#9

Arduino Transmitter link up

Mornin' 'K',
Many thanks for posting that link👍
I'm sure it will be very useful to many of us considering venturing into Arduinoism!
You piqued my curiosity and interest for one.
Fully understand and appreciate your motives; logical and eminently sensible 👍👍
I heartily approve😊

Re the 'Ks'-
Found your call sign in the Ham Register which gave me the Ket-Ring connection.
Also found it on the Mayhemers site!! 😮
Couldn't find 'K' in the Ham shortform list though!
Keep up the excellent work JD😉
Cheers, Doug 😎
Young at heart 😉 Slightly older in other places.😊 Cheers Doug
Liked by Martin555 and G6SWJ
#8

Arduino Transmitter link up

Sometimes things are not as they seem!

I was not trying to keep a secret - more wanting to be a responsible forum member.

A few years back a forum was started for RC & Arduino - the majority of the content relates to model boats or subs.

It was started as fellow modellers wanted to discuss and progress their Arduino adventures but clogging up a model boat forum with the minutiae of microprocessors and software syntax, the discussion and pursuit of misplaced semi colons, did seem fair on other members who had no interest in the subject.

It was also not possible to structure and present the techie information in a way that a dedicated forum facilitates (sections/categories/groups etc) – hence we started our own forum.

Our intention was/is that the detail would be kept away from cluttering up the modelling forum’s – the results however in all their glory would be published and celebrated on the various modelling sites and shared with all members – hopefully a win-win situation.

My PM contained the link to the RC & Arduino forum where all are welcome to join – it is not my intention to divert posts, traffic away from the modelling sites as explained above – if admin do not approve of this post then please delete.

RC & Arduino forum - http://rcarduino.freeforums.net/

And yes to both ‘K’s although I wouldn’t want to boast about the Ket ring one!
.
I think it's the way I have learnt most of my stuff - getting very stuck first...
Liked by Martin555 and RNinMunich
#7

Arduino Transmitter link up

"PM sent..."
Don't be an ol' meany 'K', 🤔
Share your secrets with all us potential/budding Arduinoists 😊
😎
PS Does the 'K' stand for Kettering by any chance?
Or does it have some special significance in Ham parlance?
Young at heart 😉 Slightly older in other places.😊 Cheers Doug
#6

Arduino Transmitter link up

PM sent...

.
I think it's the way I have learnt most of my stuff - getting very stuck first...
Liked by Martin555
#5

Arduino Transmitter link up

Thanks G6SWJ am looking at some leds 4 or 5 on one switch and 3 grain of rice on another not more than 80-100 milliamperes per circuit.
Will check out for tutorials on the net on how to read the PWM outputs
Many thanks Ian
Liked by Martin555
#3

Arduino Transmitter link up

Hi Elsrickle,

It's easy to connect an Arduino to an RC RX and read the PWM output(s) from the receiver channels and then apply some 'logic' to this/these readings/states and then act on that logic to do something e.g. switch something on/off

Working backwards - what types of lights do you want to switch?

And I would say YES - it's possible for someone new to Arduino to achieve what you want with some guidance - we all started somewhere!

With most things to do with Arduino you don't start with a completely blank sheet - you often use someone elses code and modify/add to it - you will find that there is not much you can think of that hasn't been done by someone else before using the internet.

Do be aware that some of the Arduino forums can be scary places even for seasoned Arduinoers...

.
I think it's the way I have learnt most of my stuff - getting very stuck first...
Liked by MouldBuilder and Martin555
#2

Arduino Transmitter link up

Here is a link just to show that it can be done using Arduino.

Martin555.
If it looks right it probably is.
Liked by MouldBuilder
#1

Arduino Transmitter link up

Am looking into a new project. I would like to use an arduino board to switch lights on and off to start with. Using the stick on the tx in one direction for on and opposite direction for off by jabing it a set number of times for each set of lights is this possible
Or can the arduino be used to programme an ic to do this job.
Is this possible for a beginner with arduino or is it too complicated.
All advice and ideas welcome. Am trying to avoid relays and make my own circuits instead of using action quad switches.
Liked by Martin555

Sign in to add to this thread.

Delete this post?

It will be removed from the site.

Discard this draft?

Your draft will be deleted and cannot be recovered.

You have an unfinished draft

What would you like to do with it?