Hi, I'm Bill Premerlani, the developer of the test firmware for the SparkFun autopilot.
I developed it on a Gentle Lady sailplane with an .049 engine on a power pod. I used two of the three inputs on the board for elevator and rudder control. Of course, the engine just ran flat out until it was out of fuel, so there was no need for throttle control. I used the third input on the board as a "supervisory" control, routed from the throttle control from the radio. In the low "throttle" range, the control dialed in some stabilization to make flying easier. At the top of the throttle setting, with max trim tabs, the control switches over to circling the point at that time.
Anyway, I was wondering how you intend to use the installed firmware with your electric, given that you will probably want to use the throttle channel to control the motor. You could use another, switch channel as the supervisory channel, but then it would either do nothing, or try to circle the last point when you switch over. Or, you could try to tweak the firmware to do something else. Or, you could use a splitter connection to feed the throttle signal to both the autopilot as well as the ESC.
I assume you are reading the manuals from the SparkFun website. You might want to read them all through before flying your board.
Thank you for commenting. Your manuals have been excellent. I gathered that you must have used the throttle channel like that.
I will use one channel exclusively to switch autopilot modes. My radio has mixable switches and unused channels. I should have at least 4 pulse lengths/modes available.
First, I will get it working in my model using my switched channel where you had the throttle. My ESC will plug direct into the Rx. I will use a 6V UBEC to power the system from the main LIPO batteries.
When I have tuned gains and got it working, I want to tweak the firmware. My maths isn't as good as yours but I had some assembler experience back in the days of early PCs. I will try to add flying a route and then explore height keeping.
Do you know if there other people who have already been down this route?
By the way, I see that you are located in Liverpool. What is the longitude of your flying field?
If memory serves me, I believe the SparkFun autopilot firmware was developed assuming a west longitude. If you are in an east longitude, you will need to flip the sign during the conversion of longitude to a coordinate.
I am not 100% sure right now, its been a while since I wrote the firmware, I will need to dig into and take a look and let you know if you need to flip the sign.
I double checked, the firmware assumes a western longitude.
You can use the firmware as is as long as you are flying west of Greenwich. I see that you would be ok in Liverpool or London. If you plan on flying anywhere east of Greenwich, let me know, I will help you revise the longitude conversion routine.
I noticed you said you are going to be using a 6 volt battery eliminator. I did all my development using using a 5 volt battery pack. I don't think the difference of 1 volt is going to make any difference, but I thought I should let you know.
When the autopilot is connected to a radio system, the raw power is obtained from the radio, and then regulated down to 5 volts.
With a 6 volt supply, the radio and servos will be running at 6 volts, but I am not clear what they will be using for signal levels. I would suppose they would be 6 volts. This is not a problem for 6 volt signals coming from the radio to the autopilot, there are resistors in series with the inputs to prevent the 1 volt excess from creating any problems.
The signals coming out of the autopilot will be 5 volt pulses. I would assume that the input circuitry in the servos is TTL logic, so the 5 volt pulses into a circuit with a 6 volt supply should be fine, but I am not 100% sure.
Anyway, the first thing you should do when you get your board is to run it in the "manual"mode, in which case it should simply pass through the radio signals to the servos. If they respond normally, you are in the clear. I think that will be the most likely case, but if not, let me know, I will figure out what to do.
There was a similar issue on the board, the CPU runs at 5 volts, the GPS at 3.3 volts, we had to put in signal shifting circuits.
I think that you are right. It should be OK with 6 volts and the 5 volt CPU regulator will be in use. I think that any Rx supplied at 6V instead of 4.8 will still output signal pulses at the same level. If it doesn't work 100%, then I will select 5V from the ubec and fit PJ2. My Lipo is 5 cell so the ubec voltage should be steady throughout the flights.
I agree with you about the 6 volts ESC. The more I think about it, I recall that some of my testing was done at 6 volts, so it should work just fine. I will double check when I get a chance, and get back to you.
Regarding altitude control, it is totally doable. I can help you with the math, if you want to try it. Certainly, many people have done it. You can either do gradual, gentle pitch reference adjustments based on altitude using a PI controller with low gains, or if you want tighter control, you can use the vertical velocity info from the GPS. Velocity info from the GPS is actually more accurate than positional information, because it is directly based on doppler shift. However, the vertical velocity info is buried in the GPS binary interface, so if you want to use it, you will need to write a GPS binary interface driver.
I'm still waiting for my board so it's a bit early to make detailed plans. When I am up and running, I will try using the NEMA altitude output in a slow control cycle.
When you mention the velocity based on doppler shift are you referring to the velocity data in the binary message ID 2?
If so why hasn't someone already done it? It would appear to complement the NEMA altitude for our purposes.
Have you tried switching the output protocol? Do you know how long it takes? Would it be feasible to get the velocity data from a fast cycle and switch to NEMA to get the fix data from the slower cycle?
My friendly programmer is confident that he cope with the binary interface driver. We need the board. :(
Please can I ask you for a copy of the hex file that you used in your Gentle Lady.
I have re-built the code from the UAV2520V1a project and programmed my board, but without success. I should have downloaded the code that was in the board when it arrived, then I would be able to confirm that I haven't damaged the board.
I have had the board since Mar 20th and have flown it several times. Everything worked fine and seemed to be as described in the manual. I used channel 5 to "supervise". However, I couldn't use the "return home" mode because my radio's failsafe continues to send out servo pulses.
First, I bought a Chinese made ICD2, which was unusable, and then a PICkit2 from Microchip. The PICkit came with a demo board and several tutorials. It does everything, including debug, with the demo chip. I can read and write to the UAV board (hence overwriting the code!). When I try to debug, however, it says that it can't enter debug mode and Vdd is 0V instead of 5V.
At the moment I'm lost in the forest of configuration options, etc etc.