Jump to content

My little NAV/OSD project - under construction


Recommended Posts

  • Replies 735
  • Created
  • Last Reply

Top Posters In This Topic

A few minor updates:-

1. I'm taking a break from testing the autopilot - it's too exciting for me, need to cool off a bit here and recover from the fatigue of last week.

2. I'm rewriting parts of my code to optimize performance, and prepare for new features. Some of the interrupt handlers have been totally written in assembly now, leading to a 50% size reduction of the said code, and much higher efficiency. I'm also adding code to handle multiple waypoints and for current measurement (along with power consumed). This is all still within the capabilities of the microcontroller but I think I'm reaching the limit now with almost every resource being used up in one way or another. I have one last port which I intend to use as a One-Wire interface to read a 16-bit ADC for the barometric altimeter and some other fancy stuff like temperature, etc.

3. Soon I'll have to write a PC configuration software to talk to the controller so various settings can be customized.

4. I've been trying to set up a Magister as a possible candidate for an FPV platform. It's a big bird and has more space but flight time seems rather short for the moment, and it seems to have a nose down tendency for some reason that I've not figured out yet. It looks like my Cularis will be a more suitable platform.

Daniel

Link to post
Share on other sites

Okay, the code re-written in assembly have all been tested and works well. This will improve on the interrupt latencies and make the overall system a bit more responsive as well as buying me a few more cycles. Size wise - the interrupt routines are about 40% of the length of the compiler generated code and so there is some space saving as well.

Also, the code for reading the mAh consumed is also working but I still need the sensors (Allegro) to arrive before I can put it to any use.

What I'll do now is to work on the EEPROM handling code which seems to be a bit cranky. I've not tested the altitude hold part of the autopilot either but that'll have to wait till I clear out some real life work. Neither have I implemented the One-Wire interface which will allow me to properly use the barometric altimeter. I also have a few decisions to make regarding the user interface - whether I'll let the user scroll through an on-screen menu and make selections and settings, or to go for something simpler and more to the point. For example, what would be the best way for the user to activate autopilot and select a waypoint or list of waypoints to fly to. And how would this be distinguished from a call to fly home. Obviously the fly home part should be easy to activate but what about the waypoints and so on and so forth. I'm giving this some thought and if you guys have any suggestions I'd be more than happy to hear them.

Daniel

Edited by Daniel Wee
Link to post
Share on other sites

I've been incredibly busy this last week, all kinds of things cropped up in real life and only today I got some time to get back to testing the altitude hold portion of my autopilot. Evidently, I don't have the gain(s) in the correct ballpark and this will need quite a bit of tweaking.

I finally got so tired of driving to the field, test the controller, driving home, re-programming with new settings, then back to the field ... repeat ad nauseum, that I decided to get down to writing in a full configuration menu into the controller. That's done now and it's pretty cool. I can tweak nearly all the important settings without the need for a PC or programming cable. Just turn on the menu, select the item, and put in the value you want. This is very neat and should save me quite a bit of time. I have yet to test all the changes I've made but with some luck, this should get me the right settings for altitude hold. The settings are stored in EEPROM so the next time you power up, they will be retained.

I have quite a bit of EEPROM space left and am still trying to decide how best to use them. Meanwhile, no news from Allegro regarding the current sensors. Also, some parts I ordered from Vova is still somewhere in the postal system - yet to show up, nearly 2 weeks now. I'll need to get to work on my Cularis soon - it's been languishing for too long now.

Daniel

Link to post
Share on other sites

Altitude-hold WORKS!

Just a quick update - after getting that configuration option into the controller, I managed, this morning, to do a few tests. As it turned out, I had the elevator servos going the wrong way, which explained the earlier problems. So today, I had the plane under full control of the NAV/OSD. The gains were still a little high so the plane was porpoising about the cruise altitude but I managed to turn it down and it became better. To put it simply - altitude hold works, more or less. I won't get a chance to do more extensive testing until I get back from out of the country in a few days but this baby rocks! I'll have some videos up once I get a chance to process them (when I get back).

Daniel

Link to post
Share on other sites

Thanks guys - it's still not perfect yet but knowing that it works, even imperfectly, is a great breakthrough.

I have reviewed the video (which isn't very high quality because I smudged the camera lense somehow) and have noticed that GPS stability is crucial. If the GPS lock is not good, and the position is lagging or drifting, it could seriously mess up the autopilot. As such I've made some code changes to limit the extent of control variations. It does not completely solve the problem but it may buy a bit of time before things go real bad, giving the GPS a chance to catch up. Basically we're at the mercy of the GPS but when you think about it, if you fly out of range, the GPS is still your best bet. The other limitation of this system is that if your plane gets flipped upside down for some reason, the autopilot is not going to know how to right the plane. It requires the plane to be in a mostly upright position to start with.

I've also implemented code to read barometric pressure from a 16-bit ADC over a single-wire. I've not fabricated the PCB yet so I've not tested if this works. The ADC will sit together with the pressure sensor on a separate board/module which connects to the main board over 3 wires - 2 for power and 1 for signal. I may implement a temperature sensor as well but I can't really see the use of that and it will clutter up the screen. I am continuing to revise the PCB layout, making improvements, before I etch the next version of PCB. I'm also waiting for Decade Engineering to get their revised BOB-4S (with a 74.25MHz crystal oscillator which does not interfere with the GPS signal) off the production line so I can order another unit from them. Some other code changes include allowing better manual control while autopilot is navigating. Your controls are mixed with the autopilot's inputs so you can counter the autopilot if you so wish.

So, for now the feature set looks like:-

GPS readout (lon, lat, alt, speed, heading)

Elapsed time since power up

Home heading indicator

LOS distance

Ground distance

Barometric alttitude

2 battery readings

1 current reading

1 mAh reading

Scrolling compass

Peak values (LOS distance, current, altitude, speed)

Autopilot (to fly home)

Ability to turn off screen data

Configuration menu (does not need PC)

I might have missed a few things - mostly soft features like automatic disabling of irrelevant screen data, warnings, etc. There's still room to add some features such as logging of position or other readings, temperature readout, and possibly ability to handle ailerons controlled by two channels (which allows the use of flaperons etc.). At this point, I don't think the artificial horizon is going to get implemented on this design as it is being pushed quite hard (nor do I really see the need at the moment).

Daniel

Edited by Daniel Wee
Link to post
Share on other sites
  • 2 weeks later...

Just a little update here - I'm still testing the platform and tweaking it. So far the plane's been up to over 1km distance and 630m altitude, and it still comes back although altitude control hasn't been tweaked out yet due in part to inclement weather.

I'm also trying to finish up on the Cularis glider and we're almost there. It's a big glider (it feels almost too big for me) but I should be able to maiden it soon. Likewise I am testing out a balsa Piper Cub J-3 to see if balsa works out well. I must say though that the durability of foam is more convenient than the relative fragility of covered balsa. I keep worrying that I might poke a hole in the covering. The Cularis though, presents its own problems - location of electronics. For such a big glider, the space is actually quite limited, especially when considering spacing out the RX from the TX from the controller board. As a result, it may actually be necessary to build an external bracket for holding some of the stuff. I'm still thinking this one through.

If all goes well with the maiden, I will be doing some practicing on both the Piper and the Cularis to familiarize myself with their flight characteristics before moving the FPV equipment over to those platforms.

Meanwhile, I am preparing to build another controller board for some friends who are keen to get into FPV. Allegro apparently doesn't give out free samples for evaluation so I'll have to buy them in loose quantities and will be getting my hands on them next week. I am also waiting for Decade Engineering to get their modified BOB-4 units off their production line so I can complete the second controller.

Daniel

Link to post
Share on other sites

To Daniel , have you got some gps jam with the BoB4 board ?

It's seem that the inboard osc (80MHZ I mean) create an harmonic who jam GPS if this one is near the bob4 card.

Have you notified that and maybe the modified bob4 from decade enginering is this modif ?

Great job, you have done, well if you have it avaible a day for another fpv juncky man , I would like one

Rgds

Sébastien Gravit

Edited by tazdevil3000
Link to post
Share on other sites

Hi Sebastien,

Yes, I did have a problem with the 21st harmonic of the 75MHz oscillator on the BOB-4S. What I did was to change the oscillator to a 74MHz one which solved the problem but reduced the horizontal resolution by a few (about 7) pixels, but it's worth it because now the GPS works. Besides, the reduced resolution means that the text is actually more readable.

I have spoken to Decade Engineering about this and they are producing a new batch that uses a 74.25MHz crystal rather than the 75MHz one, which should solve the problem. They will also modify the software a little bit so we'll have to wait and see how that works out. The new boards will not be ready for a few more weeks I think.

I'm almost done with this board and am thinking of just making the controller board itself - I don't know - maybe it will cost about $80 without the BOB-4 or the GPS module. Either that or I'll just make this thing an open sourced project. I just am not really wanting to get involved in the business side of things, being mostly an engineer myself. But if you're interested I can help you make one and pass you the code for it.

Daniel

Link to post
Share on other sites

The term "Fly high" gets a whole new meaning :D

Mann you high up, next stop 2KMs ? hehe

Can't you mount the cam at a better spot, to get a better ground view, and still see the prop for RPM?

Regrads

LoopForEver

Link to post
Share on other sites

I could but the plane is pretty small and is a high wing (Cessna) design. To put the cam higher would be to mount it on the wing itself, on top, but I hesitate to put holes in the wing for fear of weakening the structure. I do have another plane which will give me better mounting options but it's not built up yet. Actually, I kinda like the "pilot" view although it does obstruct the ground view. I think the next plane will have a better view. I'll post some pictures in a little while.

Daniel

Link to post
Share on other sites

You could also glue the cam to the wing with some velcro or something.

Or put 2 cams on plane, so you can switch view ;-)

Really nice OSD you got, good with the heading locator.

The "flyhome" function is also good in case something bad happen.

Got waypoint navigation working yet?

Looking forward to see more pics :)

LoopForEver

Link to post
Share on other sites

I just finished my third prototype (and likely the last PCB revision). The Allegro current sensors won't get here for a few more days. I've added some minor features such as the ability to control both ailerons separately and have respective passthrough ports. This is to enable the use of flaperons in conjunction with computerized aileron controls. Anyway, here are some photos to let you guys see where I'm at with this. I've tested the autopilot and it's actually working very well - much better than I expect.

DSC_6410.jpg

DSC_6411.jpg

DSC_6413.jpg

DSC_6414.jpg

As you can see, the plane is some cheap foamie, just under 1m wingspan and costs only about US$20 without the electronics. The black wires under the board and the white 5-pin connector at the corner is the ICSP port for in-situ re-programming of the software. Normally those wires and port is not required unless you want to put in your own software. The little protrusion at the corner near the regulator is where I might install the Allegro sensor (I've not made up my mind about this yet.) The 6-pin socket is for the GPS module.

Some other photos of the OSD features - the GPS home setting screen and the configuration menu. You configure the settings through the use of the aileron and elevator sticks.

GPShunt2.jpg

Menu.jpg

As for waypoint support - it's in there but I've not done the user interface because it really complicates what is supposed to be a simple application. Maybe if there is enough demand, I could put it in, but you will need to interface it with a PC to upload way points (plus I am running out of code space).

Daniel

Edited by Daniel Wee
Link to post
Share on other sites

Wow..looks really expressive :-)

And its works well without acc/gyro/fma copilot and with the very small plane is also some of a archivement.

Are the board only powered by the cell battery on the board?

LoopForEver

Link to post
Share on other sites

The cell is to keep the GPS memory alive. Without the backup cell, the GPS will also cold start, which takes a minute or more to get a lock. With the cell, the warm start takes only a few seconds to get going. I'll post a photo of the power supply and hub board in a moment.

Right now, I am making another controller for some friends of mine. I reckon the board to cost around US$70 or so. Together with the BOB-4S it will be about US$175. You will also need the EB-85A GPS module which you can get for US$85 (while stocks last). So the whole she-bang should set you back about US$255 (inclusive of GPS module). If there's enough interest, I can post the PCB mask and the software online so others can build this thing. I might even make the code open-source except that I'm kinda iffy about releasing my auto-pilot algorithm at the moment.

Daniel

Edited by Daniel Wee
Link to post
Share on other sites

Okay, this is the power board:-

DSC_6416.jpg

You can see the two switching regulators - one 5V-regulator for the TX module, and another variable (step-up capable) Anyvolt for the camera. This way I can power the whole setup from 2S or 3S regardless of what voltage the camera needs. The three sockets are for the controller, the transmitter, and the camera. This is to keep things neat and modular. I can unplug parts as I want to. There is a jumper on the side for when I don't want to fly with a controller. With the jumper, the camera video goes straight to the TX. The trimpot at the side controls the audio signal volume so you can set it to what you like.

Daniel

Link to post
Share on other sites

I'm impressed at it's size! So tiny Daniel! :o Anyhow I think all can understand you hesitant in releasing your auto-pilot algorithm at the moment, so then offer it for a price. :D

Link to post
Share on other sites

Oh, I'd be happy to put up the hex code, just not the source code that's all.

Actually if there's someone who wants to commercialize this thing, I'd be happy for them to do it. Maybe this can be the basis for a do-it-yourself UAV/OSD platform. With the source code, you can change stuff any way you want to, and even add new features. I just need to comment the code properly before I forget what I wrote!! Actually this thing can be made a lot smaller if a proper dual-sided board with SMT components are used. I didn't use SMT because my eyesight is getting worse and it's hard to work with such small parts.

I forgot - this is all SI/Metric at the moment so if you want an Imperial version, I'd have to specifically change it. Then everything would be in miles and feet rather than in meters. Should not be too hard to do really.

One of the ports is for a One-Wire interface which will be used to read a 16-bit ADC connected to a barometric pressure sensor (which will be converted to altitude), a thermometer perhaps, and maybe other nifty sensors (accelerometer for G-force?). That's one of the last avenues for expansion as I've squeezed as much as I can out of this little controller.

Daniel

Edited by Daniel Wee
Link to post
Share on other sites

Well, the component list for the main controller board itself is not very long but you will need a programmer that can handle the dsPIC30F4012. Some PIC programmers do not support this. In my case, I am using the ICSP header to program the controller so that I don't have to keep pulling it out. Component list as follows:-

1x dsPIC30F4012-20I (make sure you get the DIL-24 package)

1x LM2940CT-5.0 (LDO regulator but the old LM7805 should work here)

1x 2N3906 (PNP transistor)

3x 1N5817 (Shottky barrier diodes)

1x 1N4148 (small signal diode)

1x 10.0MHz low profile crystal

2x 47uF 16V tantalum capacitors

3x 0.1uF decoupling capacitors

1x 0.33uF capacitor

2x 22pF ceramic capacitors

2x 11.1 kohms 1% 1/8W metal-film resistor

2x 22.2 kohms 1% 1/8W metal-film resistor

4x 10 kohms 5% 1/8W resistor

1x 4.7 kohms 5% 1/8W resistor

1x CR2023 holder

1x brass hex stand-offs (about 6-8mm long?)

1x low-profile 28-pin DIL IC-socket

A bunch of connector pins - I don't know what you call them, but this is for the servo connectors. Also the 6-pin connector you see in the photo, for the GPS module. Again, I don't know what you call these. You can always use whatever connector you like as long as it has the same pitch. Actually a 5-pin connector will do but I have one line unused.

You will need MPLAB IDE, and a programmer capable of ICSP programming the dsPIC30F series of controllers.

I would make more of the PCBs except that I can't get hold of PCB etchant locally as they are considered a restricted substance. I had to use some hydrogen peroxide with some strong cleaner that contains HCl to etch these boards - takes forever but it works. On the ground plane side, I manually removed the copper around non-ground holes with an oversized drill bit. Then I drill out all the holes manually with my Dremel and a 0.9mm bit. The board is fibre-glass and to be honest, I'm quite sick of the smell of that stuff at the moment. I probably inhaled more of the dust than is good for my health. Making the PCB is the most tedious part of the process for me. You are welcome to make your own PCB with the latest Eagle PCB template here:-

MyOSD (Eagle PCB EPF file)

The software HEX file can be found here:-

My NAV/OSD software version 2.4

I'll have to write up the component placement details and the connection details if there's really enough interest. I still think the best way is for some enterprising soul to just make a bunch of these PCB's - maybe even improve on it to avoid 3 of the jumpers I used (blue color). Maybe sell it for about US$100 or so and save everyone the work and agony of building it themselves. Let me think about the source-code for a while to see if I will release it. Oh - and I'll try to draw the circuit up soon. Right now it only exists in my head.

Daniel

Edited by Daniel Wee
Link to post
Share on other sites

Okay, I've added some code and now (untested though) the OSD supports both SI/Metric and Imperial measurement units. In Metric it will he kph for speed, and m for altitude(s) and distance. In Imperial units it will be mph for speed, ft for altitude(s) and ml (miles, using ml so as not to confuse with meters) for distance. The user can select which system from the configuration menu. Hope you US guys are happy now.

Daniel

Link to post
Share on other sites
Just for the fun of it, here's a rather long WMV video - parts of this go over 600m and it's quite a view from up there but somehow the WMV compression makes things look really worse than they are.

600m up in the sky (123MB)

Daniel

Hi Daniel, isn´t it the video too heavy for the size that you finally got?

Your OSD&NAV platform is great. The BOB4 displays the best quality I´ve seen in other osd modules. I´ve got one bob4 in my osd and last sunday I went to my rc club. I made a fpv demo for the old pilots we´ve got in the club, all of them said that the quality of the text was great. :D

Congrats

Edited by Wavess
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...