Arduino - Extend the number of servos supported by a Rx

Electronic projects that are either related to the firmwares for the 9x, or simply great for radio control applications.
User avatar
MikeB
9x Developer
Posts: 17990
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: Arduino - Extend the number of servos supported by a Rx

Post by MikeB »

The '84 has a "Universal Serial Interface" that will provide the hardware, but will need some software support. Have a look at http://www.atmel.com/Images/doc4300.pdf.

Note that if the '84 is not using a crystal, you will need to make sure the baud rate is accurate enough.

Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!

swampd32618
Posts: 4
Joined: Mon Jun 06, 2016 4:36 am
Country: -

Re: Arduino - Extend the number of servos supported by a Rx

Post by swampd32618 »

Thanks for the link! I'm not planning to use a crystal - do you think the default baud rates (74880 or 115200) are close enough to the 100K baud at which the Futaba sBus operates? If not, how can I solve the problem with an external crystal oscillator?

Thanks in advance for any help!

Marsh
User avatar
Kilrah
Posts: 11108
Joined: Sat Feb 18, 2012 6:56 pm
Country: Switzerland

Re: Arduino - Extend the number of servos supported by a Rx

Post by Kilrah »

The point is that the internal oscillator is of low precision, so when you set your code to say 115200 baud it may actually significantly different and potentially too far off for correct communication. I.e. you might need to calibrate the oscillator or tweak the baudrate generator values depending on what features the chip has.

Neither of these baudrates would work as is, they're very far.
User avatar
MikeB
9x Developer
Posts: 17990
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: Arduino - Extend the number of servos supported by a Rx

Post by MikeB »

Also the oscillator may drift as the temperature changes.

Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
swampd32618
Posts: 4
Joined: Mon Jun 06, 2016 4:36 am
Country: -

Re: Arduino - Extend the number of servos supported by a Rx

Post by swampd32618 »

It just clicked that the baud rates I gave are the defaults for the Arduino IDE serial monitor - you can set the ATTINY84 to whatever you want, right? However, your points regarding clock precision and stability are very valid ones. Are the internal clocks in the ATmega328P stable enough? It sounds like they are being used for processing sBus data for quads, so I'd guess they are. Perhaps going that route (or a Pro Micro?) would be better.

Questions still open about relationship between captured frame channel data and equivalent PWM data. Are they values that I can compare (simple <, =, > relationships) to determine switch position?

Any additional thoughts on viability of this in lieu of using discrete channels are greatly appreciated!!!

Marsh

User avatar
MikeB
9x Developer
Posts: 17990
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: Arduino - Extend the number of servos supported by a Rx

Post by MikeB »

You might try using a Pro Mini first. Have a look at this: https://github.com/MikeBland/SbusToPpm.

Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
User avatar
Kilrah
Posts: 11108
Joined: Sat Feb 18, 2012 6:56 pm
Country: Switzerland

Re: Arduino - Extend the number of servos supported by a Rx

Post by Kilrah »

swampd32618 wrote:Are the internal clocks in the ATmega328P stable enough? It sounds like they are being used for processing sBus data for quads, so I'd guess they are.
Arduinos and FCs all use a crystal oscillator.
User avatar
MikeB
9x Developer
Posts: 17990
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: Arduino - Extend the number of servos supported by a Rx

Post by MikeB »

Another option is to do what I have on the X8R-Analog device (https://github.com/MikeBland/x8r-analog).
This uses an ATTINY13 without a crystal, but measure the baudrate of the incoming serial data and adjusts its timing to match so if the internal oscillator drifts, it changes the baudrate to keep the correct speed.

Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
swampd32618
Posts: 4
Joined: Mon Jun 06, 2016 4:36 am
Country: -

Re: Arduino - Extend the number of servos supported by a Rx

Post by swampd32618 »

I like the idea of syncing the MCU clock with the receiver. Can I do that with the ATTINY84 as well? It has an USI capability, so on paper it looks like it will work. I'm not sure, however, if I can get something working on the Arduino Mega and then use it as in ISP for the ATTINY84. Thoughts?

Marsh
Joyplanes
Posts: 1
Joined: Tue May 08, 2018 11:05 am
Country: -

Re: Arduino - Extend the number of servos supported by a Rx

Post by Joyplanes »

Hi, I'm new to this forum but the work of this code is amazing, I would like to use it in one of my videos o my YouTube channel, I was looking for a project like this, I know this post is old already but in case someone is still following. Is it a big job to change the code to use it with an Attiny85? I'm planning to use it to only switch few lights not to drive servos and I want a very small device. Cheers.
User avatar
MikeB
9x Developer
Posts: 17990
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: Arduino - Extend the number of servos supported by a Rx

Post by MikeB »

The '85 could work. Compared to a Pro Mini, it doesn't have a full UART, only the USI and you will also need to consider whether you are using the internal oscillator or a crystal, and adjust the serial timing if using the internal oscillator.

Mike
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
michel49
Posts: 192
Joined: Sun Oct 07, 2012 10:59 am
Country: -

Re: Arduino - Extend the number of servos supported by a Rx

Post by michel49 »

It is easy to find S-bus servos but I'm sorry S-bus Esc don't exist.

Post Reply

Return to “General RC Electronic Projects and Discussion”