SMALL - espritmodel.com SMALL - Telemetry SMALL - Radio
Reply
Thread Tools
Old Dec 24, 2012, 05:05 PM
Autonomous Vehicles
United States, FL, Fort Lauderdale
Joined Dec 2007
304 Posts
Hi Ian,
Here is Jim Frye's (Lynxmotion) explanation for the DM8 timing diagram in post #121:
"Hokay... A good place to start is with the pulse stream generation. For an understanding of what is happening is to look at the code. The pulses were being created on pin 15 (at least on the earlier versions), which was made low early in the program. That means the pulses are positive going. So at the beginning you create a 400uS pulse. But the time for the first position starts at the beginning, so you subtract 400uS from the desired pulse and pause that long. When that time elapses you create another 400uS pulse, then pause for the desired position (minus 400uS), etc. What you end up with is illustrated below."
Hope that this might give you an idea of why shifiting the low end , middle, and high end values by 400uS got the receiver output to be correct.
Regards,
TCIII
TCIII is online now Find More Posts by TCIII
Reply With Quote
Sign up now
to remove ads between posts
Old Dec 29, 2012, 05:40 AM
Registered User
Joined Sep 2012
4 Posts
Quote:
Originally Posted by IanJ View Post
Don't forget to post photos!

Ian,
Here it is !
anode is offline Find More Posts by anode
Reply With Quote
Old Dec 29, 2012, 02:13 PM
Autonomous Vehicles
United States, FL, Fort Lauderdale
Joined Dec 2007
304 Posts
@anode,
Nice work! Looks good. I just about have mine completed also. However I have used a bigger case and have the joystick mounted on the top of the case along with the LCD display. I plan to use a 6 volt 2800 mahr NmHi battery to power my setup so I can button up the case and charge the battery from the outside. Pictures will be coming shortly.
@Ian,
I looked at the raw joystick data and it is offset by 400uS at the low, mid, and high end of the joystick range.
Regards,
TCIII
TCIII is online now Find More Posts by TCIII
Reply With Quote
Old Dec 29, 2012, 02:30 PM
Registered User
Aberdeen, Scotland, UK
Joined Dec 2007
607 Posts
Quote:
Originally Posted by TCIII View Post
@Ian,
I looked at the raw joystick data and it is offset by 400uS at the low, mid, and high end of the joystick range.
Regards,
TCIII
Good stuff......thats confirmed it then.

Ian.
IanJ is offline Find More Posts by IanJ
Reply With Quote
Old Dec 29, 2012, 02:31 PM
Registered User
Aberdeen, Scotland, UK
Joined Dec 2007
607 Posts
Quote:
Originally Posted by anode View Post
Here it is !
Nice one!......real tidy too!

Ian.
IanJ is offline Find More Posts by IanJ
Reply With Quote
Old Jan 01, 2013, 03:44 PM
Autonomous Vehicles
United States, FL, Fort Lauderdale
Joined Dec 2007
304 Posts
Hi All,
Attached are some shots of the front, rear, and interior of my USB Joystick Transmitter. I am still awaiting a 3800mahr NiMh battery to complete the project. I am using a 1600mahr NiMh battery for testing purposes only. I have the joystick mounted on the top of the case since this setup does not necessarily have to be portable.
Regards,
TCIII
TCIII is online now Find More Posts by TCIII
Reply With Quote
Old Jan 02, 2013, 05:36 AM
Registered User
Aberdeen, Scotland, UK
Joined Dec 2007
607 Posts
Quote:
Originally Posted by TCIII View Post
Hi All,
Attached are some shots of the front, rear, and interior of my USB Joystick Transmitter. I am still awaiting a 3800mahr NiMh battery to complete the project. I am using a 1600mahr NiMh battery for testing purposes only. I have the joystick mounted on the top of the case since this setup does not necessarily have to be portable.
Regards,
TCIII
Nice job, and you've plenty of space in that case.......no need to cram it all in like I did one mine.

The 3800mah battery should last you a long while.........and a good idea to use an NiMh batter rather than a Lipo, no need to worry about low battery voltages.

Ian.
IanJ is offline Find More Posts by IanJ
Reply With Quote
Old Jan 02, 2013, 07:15 PM
Autonomous Vehicles
United States, FL, Fort Lauderdale
Joined Dec 2007
304 Posts
Thanks Ian, much appreicated. I assume that the low voltage buzzer will alert you the LiPo needing to be recharged without going below 3.3v/cell? I have reprogrammed your low voltage code to give me a low voltage warning when my NiMh battery reaches 5.6vdc.
Regards,
TCIII
TCIII is online now Find More Posts by TCIII
Last edited by TCIII; Jan 03, 2013 at 05:08 PM. Reason: Always an afterthought! Darn!
Reply With Quote
Old Jan 09, 2013, 01:45 AM
Registered User
Aberdeen, Scotland, UK
Joined Dec 2007
607 Posts
Hi all,

Just a wee note.........I never really pushed it before because it was on a slow link, but my website at http://www.ianjohnston.com is on a new server and is much, much faster.
There's also a new forum to play with.

Ian.
IanJ is offline Find More Posts by IanJ
Reply With Quote
Old Feb 05, 2013, 09:13 AM
Arducopter Developer
R_Lefebvre's Avatar
Joined Oct 2010
2,402 Posts
Hi Ian,

I finally have my Pelican case, gimbals, and just ordered a boat load of switches and stuff to build my ground control station. I'm using the pre-USB code from you, and plan to combine it with ArduStation code to make an all-in-one controller. I'll get a panel to fit into the Peli case waterjet cut, and start slapping this together soon.

I got your latest pre-USB code, and sent it to one of the Ardupilot developers who is an expert on micro-controllers. I just wanted him to have a look at the PPM generation code as that is really at the heart of this system. Here is his response:

Quote:
I just skimmed it, and it looks reasonable. I would have gone a slightly different route, but nothing wrong with his method. Only two serious things I noticed.

1. He has forgotten to make variables modified by interrupts volatile. You have to do this to ensure that the compiler doesn't wrongly optimize use of variables (temporary storage in registers) that might be changed in a interrupt at any time.
2. He does not access ppm_array[..] in a interrupt safe way outside interrupts. If a variable is more then 8 bit, it takes longer then 1 clock to modify. That means that a interrupt might fire and change the variable value while you are reading or writing to it. So you need to start / stop the interrupt ( cli(), sei() ) every time you read the variables to ensure it won't trigger at the wrong time.
Quote:
What would be the possible problems caused? There are a number of people using this code. Just some minor jitter or something? Or is this a critical problem?
Quote:
1. Has to do with making sure the compiler makes proper code for sharing variables with main() and interrupts. If the compile results in a working binary without using volatile, then the compiler has guessed correctly. But here is no guarantee it does so every time you compile a new change.
2. May only lead to short periodic PPM glitches, not a permanent PPM fault. Assuming the logic using the corrupt PPM value does not lock up.
Have you made an changes to this part of the code in the post-USB code? If not, do you think we could look at making these changes? Seems pretty straight-forward.
R_Lefebvre is offline Find More Posts by R_Lefebvre
Reply With Quote
Old Feb 05, 2013, 04:48 PM
Registered User
Aberdeen, Scotland, UK
Joined Dec 2007
607 Posts
Quote:
Originally Posted by R_Lefebvre View Post
Hi Ian,

I finally have my Pelican case, gimbals, and just ordered a boat load of switches and stuff to build my ground control station. I'm using the pre-USB code from you, and plan to combine it with ArduStation code to make an all-in-one controller. I'll get a panel to fit into the Peli case waterjet cut, and start slapping this together soon.

I got your latest pre-USB code, and sent it to one of the Ardupilot developers who is an expert on micro-controllers. I just wanted him to have a look at the PPM generation code as that is really at the heart of this system. Here is his response:







Have you made an changes to this part of the code in the post-USB code? If not, do you think we could look at making these changes? Seems pretty straight-forward.
A great idea to get a real software engineer look at my code, he's picked up some stuff I wouldn't have realized...........and therein lies the problem........it's probably a shade above my head to do anything about it without to tell you the truth. I'm just a software hacker really.........but with plenty to learn!

Any glitching I haven't noticed, not in real life flying, nor on the oscilloscope, so I'm not overly worried about it. Any glitch would be recovered in a matter of uS i'd presume, so wouldn't be catastrophic.

But yes, both sets of code (usb and non-usb) are effectively the same.

Keep us all informed......dying to see your project.

Ian.
IanJ is offline Find More Posts by IanJ
Reply With Quote
Old Feb 05, 2013, 06:42 PM
Arducopter Developer
R_Lefebvre's Avatar
Joined Oct 2010
2,402 Posts
Well, hey, the fact is, if all he picked up are these complicated and non-critical issues, you're doing pretty well!

Got all my components in, and sent a drawing off to get the panel cut. Then the fun begins, what do you think of my layout? I'm going to meld Ardustation and some code to run a simple 8 channel Tx together into an ArduinoMega. I hope that part is straight forward.

Here's what the front panel will look like:



It'll be sort of like this, but bigger, and not upside-down.



The mode button on the MFD will switch between Tx settings, Ardustation, and some Telemetry/Alarms. Hat switch for MFD navigation.

Ch8 is a switch and a knob. The knob sets the "setpoint" level of Ch8, and the switch changes it between low and setpoint. So I can turn the heli motor on and off instantly, and also change the setpoint to control rotor speed. Pretty cool.

Then I have 6 distinct Ch5 mode buttons. These will operate like radio buttons, instead of having a bunch of switches or a 6 position knob. That's going to be great.

Dead-space on the sides is to give a comfortable hand rest for the joysticks. I much prefer to fly pinch-style instead of holding a Tx.

It's all going to be built into a Pelican 1500, sort of like this:



Also want to put an FPV monitor in the lid.

The idea is a rugged ground controller for FPV and Line-of-Site UAV use, tailored to my purposes. I want it to be very professional looking, instead of using a hobby RC Tx. And simplify setup. Just throw it in the back of the truck, take it out, open it up, switch it on and go.
R_Lefebvre is offline Find More Posts by R_Lefebvre
Reply With Quote
Old Feb 06, 2013, 02:42 AM
Registered User
Aberdeen, Scotland, UK
Joined Dec 2007
607 Posts
Now that's gonna be a pro setup.........and you're tackling the issue that has always annoyed me......the time and hassle it takes to setup for flying.....nice one!

I let one of the senior software engineers who used to work for me read your guys findings on my code.......and here's what he said.......pass it on to your guy if you like.

"Using volatile variables would certainly be the preferred method if the compiler insists on doing specific register optimisations by default, I would only use the start/stop interrupt method if the interrupt were dedicated to doing one thing or wasn't involved in some critical timing routine.
Most of the interrupt routines I wrote were multifunction though so that method was not really usable.

Remember the digital glitch on the speed monitoring of the integrated board?
Well that was caused by the reception of an interrupt that we couldnt ignore as it was coming from the onboard cpu comms chip of the Z280 which meant if data was rxd on the cpu serial port the speed reading might glitch not often but it would happen.
The serial port interrupt had higher priority than the timer based speed interrupt so the serial port interrupt interrupted the speed reading interrupt if you get my drift.

Well I solved it using what I call a dirty reading flag which was a boolean flag i set if a serial rx interrupt arrived whilst the speed monitoring interrupt code was being executed which told me I could ignore that speed reading as it would be wrong, I would then just wait for the next good speed reading a few milliseconds later so no problem.
A proper fix would of required hardware design changes or the original step we took in just not using that serial port.

Interrupts and multi-threading are fun things as they really present a challenge which I find enjoyable."


Ian.
IanJ is offline Find More Posts by IanJ
Reply With Quote
Old Feb 06, 2013, 09:30 AM
Arducopter Developer
R_Lefebvre's Avatar
Joined Oct 2010
2,402 Posts
The only thing I don't like so far is that the gimbals I bought don't feel that great. I got the $20 units from Servo City. They are Chinese knock-offs of CH Products gimbals. They just don't have that nice smooth feel I've come to expect from high end Futaba sticks. But given this is for use with a flight controller, I'm hoping "feel" won't be as much of an issue.

Originally I wanted to get the Hitec Aurora gimbals which were available, but they seemed to have stopped selling them.
R_Lefebvre is offline Find More Posts by R_Lefebvre
Reply With Quote
Old Feb 06, 2013, 09:22 PM
Registered User
Illinois, USA
Joined Aug 2009
968 Posts
This is we're I got the aurora joystick's
http://www.robotshop.com/productinfo...129&lang=en-US
They feel pretty nice. But dont think the resolution is very fine.
vertcnc is offline Find More Posts by vertcnc
Reply With Quote
Reply


Thread Tools

Similar Threads
Category Thread Thread Starter Forum Replies Last Post
Discussion RC Radio Tx - Re-inventing the wheel! IanJ DIY Electronics 345 Mar 18, 2013 03:44 PM
Sold Immersion RC 600mW 5.8 TX Version 1 $50 shipped. nybeechpilot FPV Equipment (FS/W) 2 Jun 02, 2012 07:36 PM
Discussion Re inventing the internal combustion engine UlteriorModem Life, The Universe, and Politics 10 Apr 11, 2012 06:24 AM
Discussion Re-inventing the wheel philgib Blimps 5 May 25, 2006 07:42 PM
Wanted WTB AeroFly Professional Deluxe USB Interface Version RC Flight Simulator for futaba heliguy Aircraft - General - Radio Equipment (FS/W) 0 Oct 20, 2005 03:21 PM