DIY Quad Frame

I just ordered a cheap $30 56g lightweight frame off ebay, however, I need something in the mean time to get set up with. Instead of using the ugly and heavy (~250g) wooden frame, I have built this frame from some spare materials I found in the garage.

Next up, I will need to make all the electronic connections and determine where to house the RPi and battery on the quad. I am going to have to now be careful about positioning of the electronics as the entire frame is conductive :S

Here are a couple of picture of the new frame’s construction

Quadcopter Arrived! (Most of it)

Today a majority of the electronic components of my quadcopter arrived. I received an email from the online shop saying that my order had been dispatched today and they included a tracking number. Upon checking the tracking, it turned out it had actually been posted on the 13th and it was “Delivered”. Being curious, I went downstairs, and there it was, a package on my door step. Excellent.

So it was a given I was going to have the rest of the afternoon off study – now that I had a new fun thing to play with.

As I am not building this from a kit, I had ordered all my parts individually and hoping for the best. For someone with such little hobby RC knowledge, google has definitely been my friend.

My package contained:

  • 4x 10A ESC Combo Kits with a 1700Kv motor (not Kilovolts, RPM in K per volt)
  • 1x Lipoly Balance Charger (For charging my Lipoly battery)
  • 1x 2100mAh Lipoly Battery (2S, 30C)
  • 1x Wooden Frame (Only cost $5, thought it would be worthwhile)
  • 3x Different packs of Propellors
  • 1x Power Distribution (Which I stupidly bought the one with the wrong plug)
IMG_0003

The contents of my package, laid out

So, Let’s get started. What on earth do all those numbers mean? I didn’t know – until I started looking them up. So, let me explain the motors to begin with.

Components

Motors

In quadcopters, you really do need to use brushless motors. This allows you to get maximum efficiency. Unfortunately, to run these, you need a ESC (Electronic Speed Controller). This turns a PWM signal into a voltage which is used to drive the motors. Conveniently, I found a kit which included an ESC and a motor of which were of a decent specification. I will cover connecting the ESC to a Raspberry Pi in a later section

Battery & Power

In newer RC, everyone is making the switch to Lipoly (Lithium Polymer) batteries. These are similar to those which are found in your phone – Lithium Ion. Unfortunately, they require a great deal of care when handling. We have seen many mobile phone explosions over the years due to Lithium Ion batteries exploding – This risk is just as, and even more evident in RC using Lithium Polymer batteries. This is due to the risky nature of the batteries. Very high capacity, in a high risk environment. Any puncture or shock to a battery can cause it to explode. See here

The charging process of a Lipoly battery is the same as Li-ion batteries. You will require a special charger. Most modern chargers and batteries have balance plugs, which makes charging safer and simpler. Older technology required you to balance the cells before charging and after charging. Failure to do so could lead to explosion.

Raspberry Pi

I already had a Raspberry Pi, which is great, and I plan to use it to drive the ESC’s, however it needs a source of power. I am contemplating connecting it to the ESC +5v output, however still deciding whether or not this is a good idea.

Propellors

There is so much choice when it comes to propellor choice. I chose 3 different kits each with 3x CCW and 3x CW props. This is required as the opposite rotation of the quad needs to be offset otherwise you will get unwanted yaw. The kits were to the following specs: 1x 7×4.5, 1x 7×6, 1x 6×5.

Other Things To Come

I’m still waiting on the brains of the quad. I still need to receive my I2c Altitude/Barometer/Temperature sensor as well as my I2C Gyro/Magnetometer/Accelerometer. Once they arrive, I will be ready to start writing the software. In the mean time, it’s a matter of assembling the hardware and doing all the connections.

Software

I lied, I actually did start writing some software today. It was only a basic python program to interface with the ESC’s via PWM on the GPIO pins on my Raspberry Pi.

It was a time consuming process learning how to communicate with the ESC’s via PWM. It’s practically undocumented as I suppose this is just a known thing in the Hobby RC world.

Basically to send a speed control to the ESC you need to use Pulse Width Modulation. This is a signal of a square wave. It has two variable parameters; the period and the duty. The period is the frequency and the duty is how long a pulse is to stay high for.

I knew all about how this worked, but had no clue how on earth to communicate within the range the ESC understood. After some light googling, I found out the range around ESC’s PWM signal. A width of 700 – 2000 microseconds is within the working range of a generic ESC.  However the next issue was how to communicate using python using a value of microseconds. I’m lazy, and using math to turn this into a frequency in Hz unfortunate. Instead it turns out Python/RPi.GPIO has a class in PWM for a servo. It lets you set the value of microseconds directly. Awesome. Here’s a snippet of my code:

from RPIO import PWM
import time

max_PWM = 2000
min_PWM = 700

MOTOR_1_PIN = 25

servo = PWM.Servo()
time.sleep(2)

servo.set_servo(MOTOR_1_PIN, max_PWM)
time.sleep(5)
servo.set_servo(MOTOR_1_PIN, min_PWM)

time.sleep(3)
print("Servo Set Up")

while True:
 try:
 print("Enter New PWM Value:")
 ins = int(raw_input())
 servo.set_servo(MOTOR_1_PIN, ins)

 except KeyboardInterrupt:
 break

servo.stop_servo(MOTOR_1_PIN)
PWM.cleanup()

Unfortunately, that didn’t work. After much head scratching I still hadn’t worked out how to calibrate the PWM signal to the ESC.

To do a calibration process, you must turn on the GPIO PWM to the maximum signal, then switch on the ESC, then turn the PWM signal to minimum. After this occurs, you are now ready to start sending it PWM signal.

I modified my program to be more basic and let me give it any value i wished without the broken calibration code

from RPIO import PWM
import time

MOTOR_1_PIN = 25

servo = PWM.Servo()

while True:
 try:
 print("Enter New PWM Value:")
 ins = int(raw_input())
 servo.set_servo(MOTOR_1_PIN, ins)

 except KeyboardInterrupt:
 break

servo.stop_servo(MOTOR_1_PIN)
PWM.cleanup()

To do all this magic with the software I did need to connect everything up, so here are a few images of the current set up

IMG_0005

Breadboarding, connecting GPIO to the ESC via an old IDE cable.

 

IMG_0007

Cheap and nasty wooden frame – soon to be replaced

Anyway, that’s all for now, hopefully much more to come once everything is hooked up and ready to go!

iTunes vs Spotify

So I just caved into starting a 3 month free trial of Spotify. What have I got to lose? It’s going to make syncing to my android device much easier, plus I can listen to any song I want wherever I am (provided Optus is decent).

Upon starting my Spotify experience, I needed to import my iTunes playlists. I needed to get all of my playlists out of iTunes. I have a LOT of playlists (Over 300). See the image to the left for example. That’s only just a minority of them (I’ve included the scroll bar for reference). Now, getting these outside of iTunes is a process on it’s own, and getting them into Spotify is even more difficult. This would be somewhat easier I suppose if Spotify’s “iTunes Import” feature wasn’t greyed out.

So the next best thing was to use the iTunes playlist export functionality. This can be done by right clicking a playlist and choosing “Export”. Tedious – yes. I only exported about 15 playlists before researching the next step – converting these playlists to a format Spotify can handle. Fortunately there are online tools to do this – however they’re slow, and can only do one playlist at a time. So this was clearly not an option.

I ended up settling for dragging and dropping playlists into Spotify. The flow was as follows:

  1. Create a new Spotify Playlist
  2. Drag Songs From iTunes into Spotify.
  3. Ensure you didn’t duplicate anything

Tedious, especially for 300 playlists. I’m not even sure if I can be bothered to export my entire library to a service I may not use forever. Anyway, we will see where I go with Spotify, and maybe I’ll end up building the tool that I previously wrote about here.

New Theme

It’s the time of year again I suppose. I have given my blog a good clean and given it a fresh new look. This year I have gone with a flattened design, using typography to get the message across (Yes, I just called Open Sans typography).

Hopefully this refreshment will entice me to write more blog posts, however, as usual, the novelty disappears after a short period of time.

Bridging the Gap: iTunes to Android

I hate proprietary things. Specifically iTunes. It’s a great music manager, it’s robust, stable, and has a brilliant store. It also offers fantastic integration with iOS devices. As much as that is great for iOS users, it sucks for anyone on Android. In my opinion this is driving people to move to streaming music services such as Google Play Music or Spotify (both of which I am contemplating).

There are various tools available which bridge the gap. Apps such as DoubleTwist for Mac & Android do the job, however they’re just too clunky.

For me, leaving my iTunes Library and picking up some new music management tool would be a big hassle. iTunes has all my music, including over 300 of my playlists. I need a program to bridge iTunes and my Android Device.

At the moment I’m on the verge of writing a tool to extract iTunes music, track playlists and keep music in sync onto my Android phone. My roadmap for the tool is as follows:

  1. Read iTunes Library & Copy Playlists onto device without duplicates
  2. Synchronise Playlists with the device, so songs removed in iTunes are removed on the Phone.
  3. Write metadata to the device for playlists
  4. OR Write a music playing app – however this may be overkill.

Anyway, this will be a learning process. I’m aware tools are available to do this task, however building one tailored to my needs to possibly the best solution in my case. Looking at the iTunes Library XML files, they look relatively easy to work with, and maybe eventually I’ll set up a auto importer for my “external purchases” to automatically add them to my Library and put them in the right folder on my computer.