Page 4 of 4

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

Posted: Mon Jun 06, 2016 8:52 am
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.

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

Posted: Mon Jun 06, 2016 4:36 pm
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

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

Posted: Mon Jun 06, 2016 4:41 pm
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.

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

Posted: Mon Jun 06, 2016 5:39 pm
by MikeB
Also the oscillator may drift as the temperature changes.

Mike.

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

Posted: Mon Jun 06, 2016 9:09 pm
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

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

Posted: Mon Jun 06, 2016 9:31 pm
by MikeB
You might try using a Pro Mini first. Have a look at this: https://github.com/MikeBland/SbusToPpm.

Mike.

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

Posted: Mon Jun 06, 2016 9:45 pm
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.

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

Posted: Mon Jun 06, 2016 10:01 pm
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.

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

Posted: Sat Jun 11, 2016 8:02 pm
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

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

Posted: Tue May 08, 2018 11:10 am
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.

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

Posted: Tue May 08, 2018 1:27 pm
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

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

Posted: Sun May 27, 2018 12:37 pm
by michel49
It is easy to find S-bus servos but I'm sorry S-bus Esc don't exist.