FS1000A and XY-MK-5V second range test

Two months ago, when I published first FS1000A and XY-MK-5V range test, I was little surprised that I was able to reach 315 meters of stable connection. And I was almost sure, that they can do more.

Having some free time during my summer vacation, I’ve left transmitter on a towel and took a walk with a receiver. In a surroundings just like that:

FS1000A XY-MK-5V test on a beach

Results? 332 meters with a FS1000A powered with 7.4V and 1000bps over-the-air data speed.

FS1000A XY-MK-5V range test on a beach

For the second time, I’m sure I can pull more from this setup. This time, there were two problems:

  1. Transmitter was low on the ground
  2. Other people on the beach blocked line of sight much faster than I expected

So, expect third attempt…

Read More

How to connect APM Airspeed Sensor (Pitot Tube) to INAV

Recently released INAV 1.7.2 introduced new hardware support: analog airspeed sensors. I’ve written new but it is new only to INAV. Analog airpseed sensors aka APM Pitot Tubes aka Ardupilot Airspeed Meter and one the market for years. And they are cheap. By cheap, I mean below $30. And until recently they were usable only in APM world.

Pitot Tube for INAV Continue reading “How to connect APM Airspeed Sensor (Pitot Tube) to INAV” »

Read More

How to read PPM signal with Arduino?

More than a year a published a post called Generate PPM signal with Arduino. Today it's time for part two: How to read PPM signal with Arduino?. Strange thing: internet does not gives very useful information on this topic. Strange, right? Some links to pages that does it either very very wrong or in not simple way.

There is a one almost good solution. It's an example code by Hasi123. Short, efficient and actaully works almost out of the box. But it has 2 problems:

  1. It is not a library. You have to copy paste code
  2. It alters Timer1 and that means, that many other things stops to work: PMW output, Servo library or anything else that uses Timer1. Crap…

So, I've invested some of my time and, based on that code, I've created Arduino library called PPMReader. Advantages?

  1. It is a library (!)
  2. It does not alters any timers (!)

Example code, that reads PPM signal connected to Pin 2 of Arduino Uno or Pro Mini (and other using ATmega328) and prints decoded channels over serial port would look like this:

#include "PPMReader.h"

// PPMReader(pin, interrupt)
PPMReader ppmReader(2, 0);

void setup()
{
  Serial.begin(115200);
}

void loop()
{
  static int count;
  while (ppmReader.get(count) != 0) { //print out the servo values
      Serial.print(ppmReader.get(count));
      Serial.print("  ");
      count++;
  }
  count = 0;
  delay(500);
}

The only required configuration is a decission of a pin and interrupt. Not all pins have hardware interrupts, so on many boards this is limited to:

  • Arduino Uno, Pro Mini and other based on ATmega328: pin 2 / interrupt 0 or pin 3 / interrupt 1
  • Arduino Pro Micro and other based on ATmega32u4: pin 3 / interrupt 0, pin 2 / interrupt 1, pin 0 / interrupt 1, pin 1 / interrupt 3, pin 7 / interrupt 4

PPMReader Arduino library can be downloaded from GitHub.

Read More

GPS Racer: worklog #8 – sonar test platform

I honestly admit, that my 6″ quad (codename GPS Racer) was never very pretty. It was just ugly with that GPS tower on the front. Today it got even uglier: I’ve equipped it with HC-SR04 sonar connected via I2C bus (ATtiny85 to the rescue).

Why, you might ask, have I done something so useless? Answer is simple: to make it less useless. There are at least few problems with sonar and modern flight controllers. First of all, most new boards does not have connections for it. Second of all, it does not work reliably.

HC-SR04 test platform for INAV

It just don’t. It was no unreliable that INAV, for example, disabled it for some time completely. Right now it is back, but used only during landing on multirotors. No terrain following or anything like that. Continue reading “GPS Racer: worklog #8 – sonar test platform” »

Read More

AnyFC F7 and DIY buzzer for INAV

Because both original and Banggood clone of AnyFC F7 flight controller and missing buzzer support, its usefulness is somehow limited. There is no dedicated pin and driver. Next release of INAV (1.7.2) will finally solve this problem by reusing Motor #9 output as buzzer output.

But, some additional hardware will be required. To be precise, single n-channel signal MOSFET transistor like 2N7000. Connection diagram is shown below.

AnyFC F7 Buzzer driver with 2n7000 mosfet transistor

And this is how it can be soldered together.

AnyFC F7 Buzzer driver with 2n7000 mosfet transistor

AnyFC F7 with buzzer

That is all. Simple, right?

Read More

Working solution for USBasp driver in Windows 10 64bit

Yesterday I've spent like 2 hours fighting to make USBasp ISP programmer work under Windows 10 64bit. Seriously, that was like some kind of nightmare that turned into a comedy. All web pages that I've found suggested following procedure:

  1. Download zadig
  2. Install libusb-win32
  3. Be happy

Unfortunately, in my case all attempts failed miserably. All I was getting from avrdude was

avrdude: error: programm enable: target doesn't answer. 1 
avrdude: initialization failed, rc=-1

I've found a solution. Internet was wrong. libusb-win32 was not the correct driver for USBasp. The correct driver was libusbK (v3.0.7.0). After installing libusbK USBasp came back to life!

usbasp driver for Windows 10 64bit

Read More

FS1000A and XY-MK-5V, Arduino and VirtualWire

While FS1000A and XY-MK-5V 433MHz radio modules might not be the best choice in terms of quality, or reliability or distance (although few hundred meters in open space are doable), they have one very important trait: they are extremely easy to use. No complicated wiring, no advanced programming. If you want to send some data, just connect data lines, supply voltage and write few lines of code. Super simple!

In example below, we will be sending a single 8bit number over FS1000A->XY-MK-5V line with a help of VirtualWire library.

Please remember, without antennas and in radio-noise rich environment, range might be limited. Very, very limited. Even to just a few centimeters. So keep that in mind!

Transmitter

FS1000A transmitter Arduino

Receiver

XY-MK-5V receiver Arduino

Read More

FS1000A and XY-MK-5V range test

Very often, where you go cheap, there is a price to pay. Exactly like with cheap 433MHz transmitter-receiver pair of FS1000A and XY-MK-5V. You rather do not expect much for $1, right?

When playing with them in a middle of a big city (Berlin), few meters of range was all those modules were able to archive. Too much interferences form other devices. But what about open space in a middle of nowhere? I’ve decided to test that, and this is what I came up with:

If video was too long: 315m apart, no direct line of sight between transmitter and receiver and still stable data flow! It would be more, but nature was against me and I just was not able to go further. I did not expected that much range from those two…

Read More

FS1000A and XY-MK-5V 433MHz RF modules: overview

One of the cheapest (but not the best) solutions for DIY wireless data transmission between different devices (Arduino and other microcontrollers) is a pair of 433MHz modules: FS1000A and XY-MK-5V. A set of them (you will need one transmitter and one receiver) costs about $1. Pretty cheap, right?

FS1000A and XY-MK-5V

Of course, there is a price to pay. Those modules are as simple as possible. They do not offer anything like error correction, RSSI, frequency hopping, or even two directional transmission. They offer only basic functionality: receiver reports digital ONE when transmitter detects ONE on the input (if in range, of course). Everything above that has to be done in the software. Continue reading “FS1000A and XY-MK-5V 433MHz RF modules: overview” »

Read More

Using FET transistors as switches

When over a year ago I published this post about using transistors as switches, I described only how to do it with bipolar transistors. And bipolar (NPN and PNP) transistors have a small problem: they are current driven, so they consume current when they are switched on. They consume much less than they drive, but still…

Field Effect Transistors (FET), and especially the ones from MOSFET family, work in a slightly different way. Instead being current driven, they are voltage driven. Than means, to conduct between Source and Drain terminals, specific voltage has to be applied to Gate terminal. More than that, FET transistor consumes current only during switching. It works kind of like a capacitor. When Gate is charged, it stops conducting electricity.

And that, in case of low voltages and low currents (3.3V – 5V logic level and few hundred miliamps), removes the requirement of Gate resistor. Small MOSFETs like 2N7000, BS250 and other, can be directly connected to microcontroller outputs. Cool!

Switch with N-channel MOSFET

N-channel MOSFET is ON when positive voltage (comparing to Source) is applied to Gate. So, Load will be powered when HIGH state is applied.

N-channel MOSFET as switch

Switch with P-channel MOSFET

P-channel MOSFET is ON when negative voltage (comparing to Source) is applied to Gate. So, Load will be powered when LOW state is applied. It acts like an inverter.

N-channel MOSFET as switch

Gate resistor

In case of bigger currents and voltages, gate resistor might be required since FET gate acts like a capacitor and passes electricity until charged. Consult transistor data sheet.

Read More