Flying with ATtiny and ESP8266

So I decided to make an RC airplane and to make it as simple as possible. No sensors, no autopilot, just raw commands from the remote executing on the airplane. I’m not saying that’s a good idea, but I decided to go like that.


Anyway, I wanted the airplane to be as most simple as possible. So there are servos, engine, battery, receiver and the micro controller. Initially, the idea was to use the Arudino Pro Mini, but in the meantime, I remembered that somewhere in my boxes I have ATtiny25. I wasn’t sure will it fit and on the first sight it didn’t. Most specifications I was able to find on the internet was saying that there are just two PWM outputs, and I needed one more of them. I also needed some sort of communication port like serial port which was not discussed in the datasheet. IĀ lacked knowledge about that micro controller and I knew that. And I didn’t allow that to discourage me. I believed it should be able to do a job for me. I did a little research till late morning hours and it happened that I was right šŸ™‚

Programming the ATtiny25

I didn’t have programmerĀ for this ATtiny and I wanted to program it with my Arudino. I heard somewhere it is possible.

First, you need to upload a sketch to your Arduino to act like the ISP:

Then here is howĀ to connect the ATtiny to the Arduino:

And after that, you’ll need some libraries, to explain your Arduino software how to program the ATtiny. If you have ATtiny 45/85 then I think this should work a job for you:

I had ATtiny25 so I also needed this:

Getting one more PWM on the output

So as I said, there are two PWM outputs, and I wanted one more. I found the solution here:

It involved some advanced levels of Arudino programming (something weird on the first sight) butĀ it’s worth it.

Getting serial Rx channel

My ATtiny needed only Rx lineĀ on Serial, for receiving the commands. As it turned out, it was not that simple to get one, and after looking what serial libraries are used, there was no support for the Rx, only for Tx. By default it was using TinyDebugSerial library which always returns -1 when Serial.available() is called. SoftwareSerial was too big for ATtiny, so I had to google something new. I found the solution here:

-assembler-with-cpp option does not exist

After installing mentioned library, I got this error. And it was easy to fix. The solution is here:

After that, all I had to connect ATtiny to ESP8266 via serial port. And ofc to put everything together with servos, engine, wings etc.

At the end, I thinkĀ it was possible to fly only with ESP8266 (some versions have moreĀ outputs), but that’s for some other story.


  • Hej

    August 17, 2015

    Imam problem sa povezivanjem ESPa i Arduina. WiFi modul nema dovoljno energije da zajedno sa ekranom lcd i par senzora radi. Kada sam pokusao da ga stavim na eksterni izvor nije hteo da radi, jer ono sto sam primetio da posle paljenja arduina i uspostavljanja svih naredni sledi neka vrsta “tihog restarta” i tek posle toga sve proradi. Problem je sto do tog “restarta” nedolazi ako je u modul povezan na eksterno napajanje.
    Sta raditi i koje je resenje.
    P.S. Pravim malu stanicu za ocitavanje parametara vremena (temperatura, vlaznost, kolicina sunca, pritisak) od 3 senzora, lcd 1660 ekrana za prikaz ocitavanja kao i esp za slanje istih na net i crtanje grafika.

    • Aleksandar

      August 18, 2015

      ESP8266 svakako vuce vise struje nego sto ti mozes da dobijes na izlazu iz Arduina, te se ne preporucuje da ga tako napajas. Potrebno ti je neko napajanje sa strane, recimo regulator napona LD33 ili nesto slicno, sto ce ti na izlazu dati stabilnih 3.3V uz dovoljno struje da modul moze normalno da funkcionise. Nisam siguran kakav eksterni izvor si koristio, ali moguce da je napon bio nizi od 3V.
      Sto se tice ‘tihog restarta’ zaista ne znam kako to izgleda, radi ili na sta mislis šŸ™‚


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.