Browse Category: Electronics

RCBoat got an upgrade: ESP8266

After some time spent trying to bring my IOIO back to life, I decided to move on and to equip my RCBoat with a new controller – ESP8266. It’s a cheap wireless module which became popular very quickly and got a huge community around itself. Because of its price and size it is really easy to use it to connect any device to the Wi-Fi, and to make some cool IoT device out of it. There are also several different firmwares available for it, but maybe the most popular is nodemcu, which allows you to do programming in Lua programming language. Overall, quite pretty module to have for a couple bucks.

Taking all of that into consideration, including my curiosity for the new ESP module, it seemed like a reasonable decision to use it as a controller for my RCBoat. And so it was.

dsc_3751

The interior of the boat had to be reorganized, a bit squeezed as ESP8266 requires 3.3V voltage regulator as well, also some mechanical improvements were made, but at the end everything fit nicely.

dsc_3753

ESP8266 is flashed with nodemcu firmware and programmed to behave like an AP (Access Point) which allows me to connect to it using my phone. It is also programmed to receive data and control the rest of the electronics inside the boat. On the phone, I made a Joystick app, which is sending controls to the ESP8266. Both source codes for ESP8266 and the Joystick app for Android are available on my github page.

So after making a nice water sealed package and several successful tests in the bathtub, I’ve made a ride on the canal too. This time there were no connection issues, except when I pushed it quite far away. So now enjoy the video 🙂

 

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.

attiny

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:

http://highlowtech.org/?p=1706

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:

http://highlowtech.org/?p=1695

I had ATtiny25 so I also needed this:

https://code.google.com/p/arduino-tiny/

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:

http://www.technoblogy.com/show?LE0

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:

https://code.google.com/p/nerdralph/source/browse/#svn%2Ftrunk%2Favr%2Flibs%2Fbbuart

http://nerdralph.blogspot.com/2014/01/avr-half-duplex-software-uart.html

-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:

https://github.com/arduino/Arduino/issues/1807

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.