Serial in eepe/eepskye

eepSKYe is the desktop too for flashing and managing your sky9x firmware.
User avatar
MikeB
9x Developer
Posts: 16126
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: Serial in eepe/eepskye

Post by MikeB » Tue Mar 03, 2015 4:17 pm

You might like to try this then:
SbusToPpm.zip
08-May-2016 15:37
Attempt to support 8Mhz clock
(5.64 KiB) Downloaded 100 times
SbusToPpm.zip
04-Mar-2015 16:20
Latch channel swap option
Remove debug, fix bug
Add link option on AD5, If AD5 grounded, swap channels 1-8 and 9-16 outputs
(5.47 KiB) Downloaded 121 times
Older files from the development:
SbusToPpm.zip
04-Mar-2015 14:13
Remove debug, fix bug
(5.45 KiB) Downloaded 84 times
SbusToPpm.zip
03-Mar-2015 16:16
Add link option on AD5, If AD5 grounded, swap channels 1-8 and 9-16 outputs
(5.45 KiB) Downloaded 85 times
I haven't actually tested it, but I think it should work OK.

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


nigelsheffield
Posts: 308
Joined: Fri Nov 08, 2013 9:56 pm
Country: -

Re: Serial in eepe/eepskye

Post by nigelsheffield » Tue Mar 03, 2015 4:29 pm

Cool, I will try it out next!
Would the full 16 channels slow down the servo response on the arduino compared to just having 8 channels decoded?
Just wondered cause the other s.bus decoder sketch which only does 8 channels seemed slightly more responsive but it might have been me, I need to set them up side by side I think and test em on the same .sbus signal.

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

Re: Serial in eepe/eepskye

Post by MikeB » Tue Mar 03, 2015 5:07 pm

It's possible. I synchronise the start of the output pulses to the incoming SBUS signal. The SBUS data is sent every 9mS, but I only start the pulses every other SBUS frame, to allow for analog servos in particular, the the pulse period is 18mS.
With FrSky, I believe the SBUS frame is only updated every other time, unless the new European firmware operates differently, which it might from another test I did.
This may mean there is a 9mS latency I my code synchronises on the "wrong" SBUS frame.
When I generate the pulses, I send 4 out together, followed by the next 4 etc. so there should not be much extra latency for the higher numbered channels. It is very tight if you send 8 channels out one after another. They only just fit in 18mS, and don't fit if you use extended limits on the Tx.

To guarantee each set of 4 pulses is glitch free, I sort them into length order, shortest to longest, then I start the shortest first, followed around 50uS later by the next, and so on. This means the end of each pulse is at least 50uS from all the others in the set of 4, so no collisions in the code trying to end each pulse at the correct time.

This sort of latency is an interesting problem with these digital systems. In (good?) old analog days, the servo pulse from the receiver appeared at pretty much the same time as it was generated on the transmitter. Now, the servo data is sent to a Tx model, that sends in on to the receiver that then generates servo pulses. Lots of scope for delays creeping in.

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

nigelsheffield
Posts: 308
Joined: Fri Nov 08, 2013 9:56 pm
Country: -

Re: Serial in eepe/eepskye

Post by nigelsheffield » Wed Mar 04, 2015 9:18 am

Mike,
I just tested that sketch and something very wrong there, I tested without link in and servos dont move at all, and now and then they will move suddenly to a fixed pos and stay a bit and then move like that again a bit later.
i put link in and ch15 worked but others I tested did not but I did not test them all?!?!?!? :?

I also tested your other s.bus version again with a fresh battery and servos response was fine. 8-)
Nigel.

User avatar
jhsa
Posts: 18489
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

Re: Serial in eepe/eepskye

Post by jhsa » Wed Mar 04, 2015 10:37 am

so the one that is posted on the first post is fine then.. I have been using it with eepskye and it is ok..

João
My er9x/Ersky9x/eepskye Video Tutorials
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9

Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW


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

Re: Serial in eepe/eepskye

Post by MikeB » Wed Mar 04, 2015 11:28 am

I'll see if I can find time to test it, so many things I need to do!

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

nigelsheffield
Posts: 308
Joined: Fri Nov 08, 2013 9:56 pm
Country: -

Re: Serial in eepe/eepskye

Post by nigelsheffield » Wed Mar 04, 2015 11:34 am

Yes, that one is fine.
Just noticed mike described the other version as sbus to ppm, may be its not supposed to be s.bus to 16ch pwm for direct to servos then?
Ppm and pwm often get mixed up for some reason.

User avatar
jhsa
Posts: 18489
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

Re: Serial in eepe/eepskye

Post by jhsa » Wed Mar 04, 2015 11:48 am

Yes, I only saw the file name now.. I just had a look at the file and he is using 16 output pins on the code.. So it is correct, not PPM but PWM..

João
My er9x/Ersky9x/eepskye Video Tutorials
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9

Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW

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

Re: Serial in eepe/eepskye

Post by MikeB » Wed Mar 04, 2015 12:41 pm

That's what comes of not checking the changes. I've just noticed I also use that pin (AD5) for debugging.
At the top of the sketch is a line:
#define DEBUG 1
Comment this out:
//#define DEBUG 1
and try again please.

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

nigelsheffield
Posts: 308
Joined: Fri Nov 08, 2013 9:56 pm
Country: -

Re: Serial in eepe/eepskye

Post by nigelsheffield » Wed Mar 04, 2015 1:25 pm

OK just tested that and 1 to 8 works, remove power, put link from a5 to ground and connect power then 9 10 11 and 12 do not work but 13 14 15 16 do.. bear in mind I only have pins 2 to 9 connected so cannot test other pins.

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

Re: Serial in eepe/eepskye

Post by MikeB » Wed Mar 04, 2015 2:11 pm

Ahh, should be k >= 8 not just k > 8 on line 405 of the file.

Code: Select all

	if ( ( PINC & 0x20 ) == 0 )		// Link on AD5
	{
		// swap chanels 1-8 and 9-16
		if ( k >= 8 )
		{
			k -= 8 ;
		}
		else
I've updated the post above with this version.

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

nigelsheffield
Posts: 308
Joined: Fri Nov 08, 2013 9:56 pm
Country: -

Re: Serial in eepe/eepskye

Post by nigelsheffield » Wed Mar 04, 2015 3:44 pm

Great that works now on all channels.
Might be an idea to have the ch selection on a latch at power up, a dodgy connection on temporary a5 pin caused it to jump madly till I realized the problem, could happen in real life with vibrations or if a switch was used to select the channels and failed in flight.
Nigel.

User avatar
jhsa
Posts: 18489
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

Re: Serial in eepe/eepskye

Post by jhsa » Wed Mar 04, 2015 3:52 pm

you mean, if the jumper is on at power up, it would stay on the same setting until power OFF even if you removed the jumper? That sounds like a good idea.. Safer indeed..

João
My er9x/Ersky9x/eepskye Video Tutorials
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9

Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW

nigelsheffield
Posts: 308
Joined: Fri Nov 08, 2013 9:56 pm
Country: -

Re: Serial in eepe/eepskye

Post by nigelsheffield » Wed Mar 04, 2015 4:20 pm

Yeah thats the idea.

I noticed you mentioned working on a version for 8mhz 3.3v at the start, I wonder how this would work with most bec and servo requiring 5v?
I guess the pwm output would not be a problem but what about the s.bus input logic level?
The arduino board I used was this
http://www.ebay.co.uk/itm/New-Pro-Mini- ... 3f44308c58
http://www.kitchenandtools.com/wp-conte ... -Board.jpg

it worked on a single cell lipo reading 3.6v so would be OK in a low voltage situation I think.

The cheaper arduino with the big silver xtal did not work on a single cell.
I just thought it might be worth a mention for a bit of a safety margin get the above one, I think its a development board but a5 and a4 are in different places , I wonder if there is a version that works down to those voltages with normal configuration?

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

Re: Serial in eepe/eepskye

Post by MikeB » Wed Mar 04, 2015 4:22 pm

Option link now latched, new version posted on the post above!

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

nigelsheffield
Posts: 308
Joined: Fri Nov 08, 2013 9:56 pm
Country: -

Re: Serial in eepe/eepskye

Post by nigelsheffield » Wed Mar 04, 2015 4:28 pm

Wow Mike, you are FAST!
OK I will test it AGAIN!
Nigel. :D

nigelsheffield
Posts: 308
Joined: Fri Nov 08, 2013 9:56 pm
Country: -

Re: Serial in eepe/eepskye

Post by nigelsheffield » Wed Mar 04, 2015 4:35 pm

Works fine.
Thanks MIke!
Nigel.

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

Re: Serial in eepe/eepskye

Post by MikeB » Wed Mar 04, 2015 5:08 pm

Thanks for testing!

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

User avatar
jhsa
Posts: 18489
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

Re: Serial in eepe/eepskye

Post by jhsa » Wed Mar 04, 2015 6:51 pm

nigelsheffield wrote:
The cheaper arduino with the big silver xtal did not work on a single cell.
I just thought it might be worth a mention for a bit of a safety margin get the above one, I think its a development board but a5 and a4 are in different places , I wonder if there is a version that works down to those voltages with normal configuration?
The arduino with the big XTAL doesn't work with lower voltages because the regulator is not low drop.. It is a normal 78L05, which is a shame. I like the fact that it has a real XTAL instead of a ressonator..

João
My er9x/Ersky9x/eepskye Video Tutorials
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9

Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW

nigelsheffield
Posts: 308
Joined: Fri Nov 08, 2013 9:56 pm
Country: -

Re: Serial in eepe/eepskye

Post by nigelsheffield » Wed Mar 04, 2015 7:49 pm

So are all the arduino pro mini without xtal likely to work at lower voltages?
Just so I know for future purchases, for sensors then the xtal version might be fine as its not critical for flying but s.bus decoder the resonator type would be safest bet?

If its the regulator that's the problem then I guess it could be powered direct to VCC with a nice stable 5v but no more.

User avatar
jhsa
Posts: 18489
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

Re: Serial in eepe/eepskye

Post by jhsa » Wed Mar 04, 2015 8:22 pm

nigelsheffield wrote:So are all the arduino pro mini without xtal likely to work at lower voltages?
Just so I know for future purchases, for sensors then the xtal version might be fine as its not critical for flying but s.bus decoder the resonator type would be safest bet?
That doesn't depend only on the regulator. It depends also on the ability of the processor to work at 16Mhz with a lower voltage.
If its the regulator that's the problem then I guess it could be powered direct to VCC with a nice stable 5v but no more.
If you have a good BEC it shouldn't be a problem. There are a couple possibilities.
- You can for example the arduino from the S-Bus power and power the servos from another power supply.
- You could power the arduino from the first 2 cells the main battery using the "Raw" input. The arduino doesn't take much current and wouldn't unbalance your Lipo.. You could then power the servos the normal way. Just connect ground and signal to both S-Bus, and servo (PWM) lines.
- You could do it the way you said, with a regulator. But better to use for example a 8V regulator to the "Raw" voltage input of the arduino, instead of a 5V reg.. The reason is that the greater the voltage drop across the regulator, the greater is the waste of energy through heat.

So, you really have some options. My favorite is the second I guess, connecting to the first 2 cells of the lipo. I will give it a try when I build my next oXs sensor. At the moment I have a regulator, or use the arduino regulator directly to a 3s Lipo.. But it does get quite hot because the big voltage drop..

João
My er9x/Ersky9x/eepskye Video Tutorials
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9

Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW

nigelsheffield
Posts: 308
Joined: Fri Nov 08, 2013 9:56 pm
Country: -

Re: Serial in eepe/eepskye

Post by nigelsheffield » Wed Mar 04, 2015 8:43 pm

A good bec is of course essential, if it is not up to the job then you have big problems arduino or no arduino!
Powering arduino from 2 cells to raw should provide nice stable supply though, and power servos separate.
Hmm, this talk of brown outs is bringing back bad dsm2 memories lmfao!
Still, my testing today I was using 3 cell lifepo4 cells on a 2 amp bec none switching with 6 servos running at once, no sign of any glitching , apart from when I touched the s.bus input and the plus and minus with my fingers and thumbs at the same time , I must have conducted some electrons, maybe my lack of resistor to collector in my inverter is contributing to that!

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

Re: Serial in eepe/eepskye

Post by MikeB » Wed Mar 04, 2015 11:14 pm

The ATMEGA328 does include a clock pre-scaler, so even though the oscillator is 16MHz, it is possible to run the processor at 8MHz. I'm not quite sure if the oscillator will run at 16MHz at lower voltages. From the datasheet, the lowest supply voltage at which you can guarantee to operate at 16MHz is 3.78V.

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

User avatar
jhsa
Posts: 18489
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

Re: Serial in eepe/eepskye

Post by jhsa » Wed Mar 04, 2015 11:27 pm

You wouldn't fly anymore if a 4 cell NiMh receiver pack voltage dropped that low.. The servos would probably stop working before the arduino failed. ;)

João
My er9x/Ersky9x/eepskye Video Tutorials
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9

Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW

nigelsheffield
Posts: 308
Joined: Fri Nov 08, 2013 9:56 pm
Country: -

Re: Serial in eepe/eepskye

Post by nigelsheffield » Thu Mar 05, 2015 8:03 am

No but on a single cell lipo like i use for dlg you might see voltages down at 3.5v, would never need the sbus decoder for a dlg though as they only need 4 channels.
But single cell lipo for RX makes for a simple setup if it works, no bec needed and fast charging with lots of capacity.
And every servo I've tested so far has worked down at single cell volts, just a little weaker and slower maybe.

User avatar
MigF117
Posts: 9
Joined: Thu Mar 12, 2015 5:14 am
Country: Australia

Re: Serial in eepe/eepskye

Post by MigF117 » Thu Mar 12, 2015 5:38 am

Hi Mike

Thank you so much for the work you have been doing and big thanks to Joae for all his efforts too.

I'm very new to this forum to the Sbus to PWM decoder project.
I'm working on a project and I need some help.

I have Arduino Mini Pro ATmega328, I need to build a decoder to take SBus from Futaba RX and output 16 PMW channels. Which you have developed already but I've some questions.
1- There is more than one sketch to download on the top post, which one is the final one?
2- I use the failsafe on the radio, so will it work with this decoder or I've to use the failsafe button on the decoder?
3- I'll power the decoder from a powerbox with 5V, so the RX to be powered from the decoder through the SBus cable and the servos will be powered directly from the powerbox, is this setup will cause any problem?

I'm looking forward for you reply.

Thank you for all your hard work.

Regards
Moatasem

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

Re: Serial in eepe/eepskye

Post by Kilrah » Thu Mar 12, 2015 6:05 am

Wrong thread?

User avatar
MigF117
Posts: 9
Joined: Thu Mar 12, 2015 5:14 am
Country: Australia

Re: Serial in eepe/eepskye

Post by MigF117 » Thu Mar 12, 2015 6:17 am

Hi Kilrah.

Do you know if there is a thread for what I need?

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

Re: Serial in eepe/eepskye

Post by Kilrah » Thu Mar 12, 2015 6:51 am

Aren't you talking of the Sbus decoder? If so the related thread is here:
viewtopic.php?f=84&t=4539

User avatar
MigF117
Posts: 9
Joined: Thu Mar 12, 2015 5:14 am
Country: Australia

Re: Serial in eepe/eepskye

Post by MigF117 » Thu Mar 12, 2015 7:16 am

Thank you Kilrah


Post Reply

Return to “eepSKYe”