Raspberry Pi + MOSFET = High power switch

With all the possibilities, Raspberry Pi requires additional hardware to turn on and off any additional hardware. GPIOs built in power limit is low: 3.3V, 16mA per GPIO, but not more that 50mA total). And while it might be enough to light a small LED, it is not enough for anything else. Forget about motors, strong LEDs, relays. Anything that uses more that 16mA on input will destroy Raspberry Pi.

Luckily, there are things called MOSFET. To keep things short: they are special kind of transistors that can be used to turn on and off devices with high power requirements. Unfortunately, most MOSFETs require more that 3.3V Raspberry Pi GPIO provides. So you either have to use 3.3V logic compatible MOSFETs or add few other elements and use more common 5V compatible MOSFET like 30N06. And 30N06 MOSFET transistor can handle a lot of thing: up to 30A and 60V. So it’s more that enough to handle most 12V motors, relays, lights, LEDs, etc.

30N06 MOSFET Raspberry Pi

 

Required elements:

  • NPN BC547 (or compatible) transistor,
  • PNP BC640 (or compatible) transistor,
  • 30N06 MOSFET transistor,
  • 3x 10kOhm resistors,
  • 4.7kOhm resistors,
  • 1N4001 (or similar) diode

If it was Arduino with 5V logic, transistors would not be required. But with Raspberry Pi’s 3.3V logic they are required to bump voltage from 3.3V GPIO port provides to 5V MOSFET needs. Additionally, if we would be powering any coil device (motor, relay), flyback diode would be required to secure MOSFET from voltage spikes. Even if there is no coil, flyback diode still can be used. Just to be safe.

RedCruiser – DIY Depron airplane for FPV

Few months ago I’ve wrote about my first handmade Depron airplane. It was cool design. Super simple, with KFm-2 airfoil, durable and easy to fly. But it had few serious flaws:

  • motor mounted in front of fuselage is great for flight characteristics, but propellers breaks all the time. Even with prop savers,
  • big fuselage is not the same as fuselage with a lot of space inside.

Depron KFm-2 airplane with pusher propeller

That’s why, I have build a second Depron airplane. This time with pusher propeller mounted on a tower behind wing. Wing is almost the same design as in my first airplane. It is still an KFm-2 (Kline-Folgeman, modified) airfoil, 150mm chord, 12mm thick. But is a little shorter: 1200mm instead of 1250mm. The main difference is inside wing. Instead of carbon fiber spars I’ve used two carbon fiber 6mm pipes. That gives plenty of stiffness. Wing almost does not bend in flight, even during hard maneuvers. And generates more than enough lift to give nice, slow flying experience without danger of heavy stall. You really have to want to stall it. And event when it stalls, it recovers nicely: drops a nose, dives for a second or two, and you have lift again. No need to work with rudder, just let it dive and gain speed and then level.  Continue reading “RedCruiser – DIY Depron airplane for FPV” »

How to add external compass to Flip32

In my last post I’ve showed how to disable internal MHC5883L compass on Flip32+ (10DOF) flight controller board. Now it’s time to fix what we’ve broken last time, and connect external MHC5883L compass with I2C bus.

u-blox NEO-6M with HMC5883L compass

In my case I used very popular setup: u-blox NEO-6M GPS module with integrated MHC5883L compass. So you have both GPS and magnetometer in one case. Pretty nice. I’ve described how to connect NEO-6M GPS few weeks ago, so that part should be covered. The only new thing is compass itself. And hardware setup for it is very simple. In addition to GND and +5V lines you only have to connect SDA and SCL lines to bottom line of connectors right to USB port on Flip32. SDA to SDA, SCL to SCL. In case of I2C we do not have swap lines or do any other kinds of voodoo. Continue reading “How to add external compass to Flip32” »

How to disable compass on Flip32+

Build in HMC5883L compass/magnetometer is very nice feature of Flip32+ flight controller. Too bad it’s not always working like expected and there is a time, when one have to replace it by external device, positioned as far away from power cables as possible.

I’ve encountered that specific problem two weeks ago when I’ve discovered the reason (or at least I think I discovered) why Position Hold and Return To Home GPS assisted flight modes on my Flip32 and Cleanflight were not working. Or rather were working only sometimes, usually when quadcopter was positioned to the north, north east. On any other case, huge overshoots, going in totally different direction than expected. GPS was more less useless. Finally, during one one flight I kept attention to compass heading displayed on OSD. On the ground, heading was correct. After take off, it was drifting to east. Always east. With that data I’ve concluded: Flip32+ built in compass is too close to power cables and when motors are running magnetic field makes compass readings unreliable. Solution: move compass further away from power cables. But with compass already on PCB it was rather impossible. So the only real solution is: disable internal compass and use external HMC5883L connected over I2C bus.

MMC5883L on Flip32+

Continue reading “How to disable compass on Flip32+” »

Fix buzzer on Flip32

Buying cheap from China is like a lottery. Sometimes everything is fine, sometimes is not. For example, I will never again buy super motors and pellers. This just does not work. With electronics it is slightly better. Usually it works. But sometimes, well, it does not. And this might be a case for Flip32+ multirotor flight controllers from around June 2015 (give or take few weeks) v2.3_OEM RTF. In those FC, buzzer is not working when connected to designated pins.

Reason? Instead of 100Ohm SMD resistor in buzzer circuit, there is a capacitor. Solution is quite simple: replace capacitor with a resistor and fix manufacturing error.

What you will need, is a 0603 size 100R (100Ohm) SMD resistor and a (good) soldering iron. Position of faulty element is shown on a picture below.

Not working buzzer on Flip32

Today I’ve fixed two of mine Flip32 flight controllers and succeeded on both. 0603 size SMD are small, but big enough to do it at home. If your soldering iron has temperature setting, set it to 280-300C. If not, use one with about 20-25W. And sharp, good soldering tip of course. To remove old SMD element just heat it up about 1 second and push away with a tip of soldering iron. Apply some new solder to pads. Place new element on pads, push it carefully with a needle when needed. Heat it for a second and that is all. New SMD element should be soldered to pads and buzzer should be working like expected.

 

I have build a Depron plane…

How hard it is to build a RC plane without plans and starter kits? To do it in “Trust me, I’m an engineer” style. In mid June I’ve decided to give it a try and right now I can tell: it’s hard, but not that hard as one might imagine. All the problems I’ve faced were faced previously by someone else. I only had to ask right questions, read a lot, and use engineering sens to make plane work.

And well, it works. Way better than I expected it might work. Look for yourself.

Depron RC Plane

It even flies. See the maiden flight video.

Continue reading “I have build a Depron plane…” »

Adding Bluetooth telemetry to Flip32+ and Cleanflight

When few weeks I wrote how to solve a problem of broken USB port in Flip32+ flight controller, I suggested that one of the solutions is adding a serial Bluetooth module to provide wireless connection with a bord. And telemetry. Excellent news is: this is pretty simple and cheap.

HC-06 Bluetooth Flip32

What we will need:

Simple servo tester with Arduino

Servo tester is a useful little device that is needed specially when you do not have one. I’ve been placed in a situation like that few days ago what I was trying to connect ailerons with servos on my Depron plane and setup correct control throw. Luckily, I own a few Arduinos,  so 15 minutes later I owned a divice like that:

Servo tester with Arduino

It is an extremely simple servo tester based on Arduino Pro Micoro that can send 3 different PWM pulse lengths: 1000us, 1500us and 2000us. That gives min, neutral and max stick position on RC radios. Perfect to setup control throws and neutral positions.

Required parts:

  • Arduino. Any Arduino will do. I used Arduino Pro Micro, but any can be used. Even barebone ATmega328 running internal oscillator on 8MHz,
  • Breadboard,
  • Tact switch,
  • Some golpins to make servo connector,
  • Cables.

Electrical diagram goes as follows:

Arduino servo tester diagram

Program is also not complicated:

And at the end, it works like that:

Source code is available on GitHub.

Flip32 with broken USB port

Low price equals low quality. At least usually. I became clear to me (again) when I’ve broken USB port on my Flip32+ multirotor flight controller. I’ve pulled USB cable and USB socket stayed on a plug. Cheap solder. Or too quick soldering. No idea. Bottom line: unable to connect to flight controller board using USB cable. To make things worse, quadcopter was not tuned yet. It was flying, but not in the way I wanted it to.

What are the options in this case? Well, there are 3:

  1. get new flight controller board. Quite expensive since the only thing that is broken is USB port itself. Everything else works just fine,
  2. resolder USB socket. Might be the best solution, but since it’s surface mounted micro USB, it’s way above my soldering skills. THT? Why no prob. Simple SMD like resistor? Why not. More advanced? No…,
  3. use different way to communicate with flight controller.

I’ve chosen the third way. Flip32 (and Naze32) has build in hardware UART ports (as well as SoftwareSerial) that can be used to establish connection with a PC. Software like Cleanflight already allows you to use any serial port to talk to flight controller. Continue reading “Flip32 with broken USB port” »

Dead Rat, wooden quadcopter, maiden flight

Last week I was, finally, able to perform a maiden flight of my DIY wooden quadcopter (here and here). I will not say it was huge success, but it was a success alright. What went like expected? Well, quite alot. First of all, it flies and has enough thrust to weight ratio to do flips and rolls. And is pretty stable in hover. What went not like expected? It is highly unstable on yaw. Really, really unstable. Probably rear propellers are too close to each other and I have to work on PID settings. As soon as I will have enough spare time…

In a mean time, here is a short video from DeadRat’s maiden flight:

Final configuration goes as follows:

  • Motor to motor diagonal: 500mm,
  • Motor to motor front arms: 370mm,
  • Motor to motor rear arms: 300mm,
  • Materials: 3mm plywood and 15mm wood spars
  • Motors: Suppo A2212/13 1000KV
  • ESC: XT-Xinte 30A
  • Flight Controller: OpenPilot CC3D (clone)
  • Battery: Turnigy 5000mAh 3S 25C
  • Propellers: Gemfan 1045
  • Start weight: 1212g
  • Hover time: 21 minutes

Next steps: tune it up and move battery to top. Somehow I do not want to construct a landing gear for it…