ArduPilot1. with EEPROM function.

It would seem I’m not the only one using ArduPilot1 code so I fiddled with the code and took some extracts fromArdupilot 2.1 and used it to save the home alt in the EEPROM.When the autopilot resets it self during flight or is reset by the user (quick 5 times toggle of AP switch) the home position (WP 0) would reset and for that given position during the flight the alt. will be “0”.If you descend the alt would read something silly like 65000 subsequently with AP armed then your plane start a immediate dive, but with home alt saved to EEPROM it still reads the correct height you are flying at and then only adjust for WP1 alt.The only problem when a reset happens is the nav routine starts from scratch with WP1 again, it doesn’t matter if you are on your way to the last waypoint or midway to WP3. My next attempt would be to write the current waypoint to the EEPROM and WP0 lat & long.To save home alt. add a jumper between pins 6 & 7 power-up and wait for a valid GPS fix on Ardupilot give it a nother couple of seconds (just to be sure) now home alt is saved to EEPROM. Maybe a led flashing at the end of EEPROM write would be a good idea?You can remove the jumper and reset the board either with the reset button or by cycling the power source.WARNING.I have not flown this code yet but it works fine on the simulator and will give it a go this coming weekend. --- hopefully!and I'm not a programming guru so the changes might not be completely "sound", maybe Jordi can give the code his
E-mail me when people leave their comments –

You need to be a member of diydrones to add comments!

Join diydrones


  • My time is very limited and I admire the effort you guy's put in to this project. regrettably I will have to put this project aside for some serious study’s soon.

    Just a thought as per your note on the PROMBLEM - if "current waypoint" would be stored in ArduPilot1 and during a flight you would return home and land, simply resave home position and off you go again to starting WP1?

    But I like your idea of stripping 2.2 stabilization stuff that would mean full use of the setup utility. and ground station utility in ArduPilot1.X maybe using it as before without the Z sensor as this is a problem for now. Just have to calibrate before flight though.
  • Developer
    Nice! i was planning to take 2.2 (with NMEA support) and delete the stabilization stuff to fit it into the atmega168. SO you can have the advantages of 2.2 but running the same principle of 1.

    Also all the 2.x version has "current waypoint" in the eeprom. So in case the system resets you can resume from the last waypoint you where and not from 1. THE PROBLEM is that if you you have 5 waypoints and you return home in waypoint 3 for any reason, theres no way to switch back to waypoint 1 again, even if you reset the board, so I've deleted this option temporary, until i find a way to restart the waypoints. My idea was to use the register in the Atmega168/328 to know if the systems bootups from a watchdog reset, push button reset, power reset or brown out reset. But the Arduino Bootloader is restarting this registers, so i can't use it. ;\

    Anyway till now i never suffer from crashes in my EZ.
  • 3D Robotics
    Good thinking! I haven't looked at the code yet, but if it checks out we'll be happy to add it to the code repository.
This reply was deleted.