El Gallinazo

Aviation and technology ramblings from a third culture kid

I encountered two more issues that I needed to address:

  1. The cheap retract servo stripped out.
  2. The rear wing hold down threads stripped out.

I replaced the retract servo with a much higher quality hi-tech metal gear servo and spent about 10 minutes fiddling with end point adjustments and linkage lengths to try to get non-binding operation and minimize the servo buzz.

The stripped rear wing hold down threads was a bigger problem.  I tried to glue a nut to the back to replace the cheap plastic threaded plate, but just made a mess of things, got glue on the threads, etc.  Just a big mess that was hard to deal with due to it’s location and inaccessibility when things are lined up and put together.  So I went old-school — found a “blind” or “t” nut (like you use when kit building to anchor firewall mounts, wing mounts, etc.) and found a matching non-metric screw (my hardware store doesn’t sell metric t-nuts.)

So that’s it — no pictures, but the repairs are complete and the bird is airworthy again — at least until the next cheap part strips or breaks. :-)

What is the ultimate computing device?

Recently I just jumped into the world of tablets and wanted to share a few thoughts.

If we could build the ultimate computer, what would it look like?  Size?  Weight?  Battery life?  Transportability?  Network/Wireless speed?  Wireless access?  CPU Power?  Memory?  Hard drive space?  Graphics?  Display size?  Touch screen?  Keyboard/Mouse?  Voice input?  Cost?

The reality of today is that nothing meets all the objectives and gives us the ultimate in computing power, large display size, fast network speeds, comfortable typing and viewing, long long battery life, while slipping into our shirt pocket for storage and being relatively inexpensive.

Desktop PC’s

We have all been using desk top PC’s — they offer the ultimate in display size and computer power and are comfortable to use when setup properly, but they are a lot of work to transport.

Laptops

Laptops give you a computer that can be folded up and carried with you.  Often the result is still pretty heavy — maybe 20-30 lbs by the time you stuff your power cord and laptop and external hard drive and every other goody you have in your backpack.  Laptop performance can rival desktop performance, but at the expense of burning your battery very quickly and generating a lot of heat.  And you often have to make sacrifices in terms of display size, keyboard size, comfort of use, etc.  You can bring your own external keyboard and 30 inch monitor, but then you lose the transportability gains.

Smart Phones

Smart phones are great — they can slip in your pocket and go where ever you go without being hardly any nuisance.  They offer internet connectivity anywhere you go.  Many of these can run all day (or a good chunk of the day) on battery.  And despite their small screen size (maybe 4″ is typical) you can check your email, browse the web, post to facebook, even edit documents, and do quite a bit of the computing things that people typically need to do in a given day.  But it’s at the expense of screen size and most of these devices do not have a keyboard, so you are forced to poke your messages in one key at a time through a clunky touch screen interface.  Oh, but the touch screen interface — this is something new to people who are generally used to desktop or laptop computers.  The touch screen interface is really really nice for many things — you point directly at what you want and touch it rather than needing to move a mouse pointer around the screen.

Tablets

Here is my question: are tablets (such as the ipad) designed to address the short comings of smartphones or the short comings of laptops?

A tablet gives you a much bigger screen and often more battery life than a smartphone.  But most of them offer the same clunky touch screen keyboard interface — or is it a beautiful intuitive point directly at what you want touch screen interface?  – Along with similar CPU and memory size that is comparable to a smart phone.  But they do usually have wifi, gps, camera, tilt sensors, and touch screeens built in — keeping many of the best features of the smart phone.

Tablets tend to be lighter, smaller, and run longer on their batteries compared to laptops.  But often tablets provide zero expansion, no usb ports and severe limits on how they can connect to other devices and interface with the rest of the world.

Tablets with Snap-on Keyboards

In the quest to find just the right balance between size, battery life, and functionality, Asus created the Transformer tablet — a pretty standard 10.1″ Android tablet with touch screen interface.  However, they also created a matched “docking station” which is primarily a snap-on keyboard.  Adding the keyboard turns the tablet into something that looks more like a small laptop than a tablet.  The “docking station” provides much more than a qwerty keyboard.  It folds up with the tablet to protect the screen when not in use.  It includes another big battery for greatly extended run times.  It includes a standard size MMC card slot and two USB ports.  The USB ports can handle your typical thumb drive, but they will also power up and run a full blown external hard drive.  Do you want 80, 120, or 500Gb of storage to go along with your tablet?  Or maybe just an easy way to transfer files (documents, pictures, videos) to or from it?  Oh, and the keyboard also includes a mouse pad with left & right buttons.  This suffers the usual laptop problem though of I bump the mouse pad, and my cursor jumps somewhere unexpected and my typing goes in the wrong place or odd things happen because of stray inadvertent clicks.

Is it a Great Tablet?  Or a slightly too small Laptop?

Perception is a really funny thing.  The Asus transformer by itself is a great tablet.  It is smooth, polished, fast, and has all the gizmos and doodads that you want, plus it runs the very latest Android 4.0 “Ice Cream Sandwich” — could it be the ultimate computing device?  It is about as sweet as it gets (unless you are a Mac weenie.) Really the only thing I would want to add to it would be a real, physical keyboard, some longer battery life and a couple USB ports.

The Asus Transformer docking station gives you exactly what the basic tablet lacks.  Snap it on the base tablet and now you have the ultimate computing platform, right?  But go back to that funny thing about human perception.  If you snap on the keyboard/docking-station, now the unit looks like a laptop.  It feels like a laptop.  It even weighs in like a laptop.  In my mind I start evaluating it based on my laptop criteria.  It’s small and cramped.  The keyboard is typable, but slightly undersized.  Android only runs one app at a time (you can quickly switch between them, but you can’t have two apps open in separate windows simultaneously.)

What is the answer then?

So then, what is the ultimate computing platform???

If you have some thoughts on the subject, please let me know!

 

One of the challenges of bread boarding is finding the right voltage sources and ground pins to power and connect a variety of components.  Recently I was faced with the challenge of connecting a Gumstix Overo with 1.8V TTL signals to a VectorNav VN-100T IMU with 3.3V TTL signals via SPI.  I just happened to have 2 Sparkfun logic level converters on hand.

The gumstix overo is powered from a wall power supply.  The vn-100t needs 3.3v power and ground.  The two logic level converters each need a 3.3v power line and a 1.8v power line (high and low voltage) as well as 2 grounds each.  The gumstix expansion board I’m using offers one 3.3v VCC line and two 1.8v VCC lines and 3 grounds — not even close to what I need.

So here’s what I did.

Start with some 0.1″ headers from spark fun:

These are the headers I’m talking about: sparkfun 0.1″ male headers.  These come in rows of 40 pins and you can cut off the number you need.  For my little project I decided I’d make a 6 pin set, two 4 pin sets, and a 3 pin set.

Solder a bare wire across the back to tie the pins together:

You can see my soldering isn’t quite professional, but as long as there is a solid connection, that’s what counts.

Hot Glue the crap out of the back to insulate the pins:

I have no idea how I ever survived before I went to Michael’s and bought a $3 hot glue gun.

Connect up your jumper wires:

I’ll probably run out of jumper wires and have to live dangerously, but I recommend connecting a wire to every pin as a safety precaution — or at least to the end pins.  Murphy’s law reigns supreme when a “software guy” tries to meddle in the world of hardware.  Spark fun makes some very convenient 6″ color coded jumper wires.  Nice for breadboard projects.

Double check your red wires and black wires!

An VectorNav VN-100T runs $800 and an Overo is $150-200+ depending on which one.  The logic level converters are $1.95 each.  Guess which one fries first if you mix up your reds and blacks?

Day 1

Fedora 16 hit the streets on Tuesday of this week.  (November 8, 2011).

I immediately rushed out to do a test upgrade on one of my old PC’s running Fedora 15.  Initially I used preupgrade to do it all via download, but I was met with the above screen when the machine booted.  This was what I got when I should have seen a login prompt.  Some people see this after they log in and that probably indicates other issues.

This is not a very informative message!  I googled quite a bit, examined the logs in /var/log/gdm/ and pretty much came up empty until I hit the following thread entitled “Fedora 16 Upgrade Disaster”.  Wow I thought, this sound promising!

http://fedoraforum.org/forum/showthread.php?t=271999&page=2

The issue turned out to be selinux — the silent killer and breaker of linux systems.  I run nvidia graphics hardware and it appears to be a conflict between the selinux access policies and parts of the nvidia driver.

The fix for the moment is to run the following for commands as root:

yum remove selinux-policy selinux-policy-targeted
yum update libsepol
yum --nogpgcheck install libsepol http://kojipkgs.fedoraproject.org/packages/selinux-policy/3.10.0/55.fc16/noarch/selinux-policy-3.10.0-55.fc16.noarch.rpm --enablerepo=u*g
yum --nogpgcheck install http://kojipkgs.fedoraproject.org/packages/selinux-policy/3.10.0/55.fc16/noarch/selinux-policy-targeted-3.10.0-55.fc16.noarch.rpm --enablerepo=u*g

Long term, I hope this will get fixed by default.  It seems to be killing a lot of folks upgrade dreams.  I’m posting here in hopes that it helps someone out.  Let me know if you find out any further updates to the problem.

Day 2

I should mention that after seeing this message initially and not finding a solution, I downloaded the install DVD and installed from scratch.  The problem went away — so this appears to be more of an issue for people doing an upgrade from a previous version of Fedora and not a problem for people doing a fresh install from scratch.

Day 3

More problems with my system that was upgraded from Fedora 15 -> 16.  I can’t burn DVD’s with it.  I can insert a blank disk and it shows up in the file manager, but when I attempt to write an iso image to it, the dialog box claims it can’t find a valid disk to write to.  My system that has Fedora 16 installed from scratch does not have this problem, it can write DVD’s just fine.  More selinux problems?  I will stash all the data on this upgraded system and do an install from scratch to see if that cures my login problems and my dvd writing problems.

Summary

Upgrading to Fedora 16 from a previous version of Fedora seems to lead to problems!  Installing Fedora 16 from scratch seems to result in a nice well behaved system.

 

 

 

The Problem

My personal home network may be a little more complicated than average.  I used to work as a full time Unix/Linux sys-admin so I have some specific ideas about how I like to do things.  But I suffer from a similar problem as many, many other people: I have more than one computer spread through my house and they aren’t all in the same room as my DSL router.  To complicate things I have an upstairs and a downstairs basement and it would be impossible to run cables every where I need to go.

Wifi

The obvious solution is to connect a Wifi router to my DSL box and link up everything (a sever, a couple desktop PC’s, a couple laptops, a couple smart phones, etc.) all through the wifi.  This actually works pretty ok, but I have some annoyances:

  • Two desktop PC’s next to each other have to talk at Wifi speeds rather than 100Mbit ethernet speeds
  • Even within my house, I suffer from signal degradation between the basement and the upstairs.  Some areas don’t get a clean signal and can’t get nearly the bandwidth I should theoretically be able to get.
  • I do regular backups of all my PC’s to a server so I generate a *lot* of traffic a *lot* of the time and my daily interactive network use is affected because I don’t always have a lot of spare band width over the air.  I end up with web connections randomly timing out once in a while, and various things not working consistently.  This is a frustration since I work out of my home office and much of my day depends on being online.
  • Wifi transmits a lot of high energy RF right by your head or lap or other body parts … I suppose that’s not much of a health issue, or so I’m led to believe.
So wifi is ok, but with the loads I put on it, and the signal loss through walls and through the floor/ceiling, my service levels are inconsistent and I get frustrated having to wait for things or being forced to refresh a page that refuses to load — several times.

Powerline Ethernet

Say whatever you want about walmart, but I was up at my local store poking around and noticed a clearance rack in the electronics section.  They were selling a couple things called “Netgear Powerline 85 Adapter Kit”.  I had no idea what that was, but it caught my eye long enough to take a closer look at the box.  Then I went home and did some googling.  Finally the next day I rushed back to the store and strangely, all 4 units were still on the clearance rack so I bought one set.  I must have been the only one to notice the geek gold mine! <laugh>

What is Powerline Networking?

Powerline networking allows you to run ethernet over your existing AC wiring, rather than running dedicated ethernet lines or going over the air with wifi.  This is really cool, I didn’t know you this was possible, so I had to try it out and see how it worked.

How does it work?

It works pretty well!  In my case, my package came with two adapters that each plug into an AC outlet and have an RJ-45 jack on the side.  Instead of connecting two devices by running a 300′ ethernet cable across the basement floor, up the stairs, through the living room, down, the hall, and into my office … I just run a very short ethernet cable (included) to a powerline adapter and plug that into the nearest AC outlet.  Now I go to the other end of my house and plug a very short ethernet cable (also included) into the 2nd powerline adapter and plug that into the nearest AC outlet.  The 2 powerline adapters find each other automatically and create a bridge over my AC wiring.  My two devices are now happily talking and I’m not tripping over long ugly wires strung around my house.

So is it any better than Wifi?

I should qualify the following comments and suggest that for most people your mileage may vary.  There are potential issues that could make powerline networking not work so well and you need to watch out for these.

  • Do not plug your powerline adapater into a power strip, or a power strip plugged into to another power strip.  For best results and best bandwidth, you need to plug directly into a wall outlet.
  • It is possible for electric appliances and other things to create noise on your AC power lines and disrupt the ethernet networking signal.  Better devices include better filtering, but this is always a potential issue.
  • I don’t know how far a network could extend over AC and when you might start seeing signal degradation and slow downs.
  • I don’t know how many devices you can stack up (right now I just use a single pair) and how the system would react to higher traffic loads.
All disclaimers aside, I noticed a big improvement over my existing wifi network.
  • Base bandwidth improved noticeably.  My connection to the server on the other side can now get more data through faster than before.  This is a big win and worth the expense by itself.
  • I see more consistent service under load.  With wifi I noticed that if I was doing a long download, that could saturate the link and anything else I tried to do could really suffer.  Powerline networking seems to do a better job and managing contention and avoiding starvation of one connection in favor of another.  Everything seems better balanced, and even if I have the link saturated with a big download (or a long level 0 backup), my interactive use seems to be snappy and responsive … something that didn’t happen with wifi.

What else is cool about powerline networking?

I’m sure if you’ve read this far you can see I’m not a powerline networking expert, but here are some cool things I discovered along the way:

  • I purchased 85Mbit devices, but I see that now 200Mbit devices are available.
  • My devices suck up an AC outlet which can be a pain.  Newer devices often have an AC pass through so you don’t lose an outlet.
  • I’ve seen devices with 3 ethernet jacks rather than just one.  These serve as a little mini ethernet hub for those of us that might have more than one network device in a room.
  • My devices offer encryption at the OS level (i.e. they come with a windows drivers.)  Mostly I run linux so I don’t think that helps me much.  But because I run linux, most of my LAN connections are already encrypted via ssh or https, so I’m not too worried about that.  I think newer devices offer better plug and play encryption options if that’s an important consideration.

Simple tools that you will use all the time!

I work with small electronics boards and components as part of my day job. I don’t really have a nice concise job title for myself, but lately it would be something like “UAS Embedded Flight Control Engineer”.  I come from primarily a software / computer science background, but when you have an obstinate electronic gizmo sitting on your desk and no one to hold your hand, it’s time to get up to speed on some basic electrical engineering concepts.

Digital Multimeter


A digital multimeter is a great first tool.  You can pick up one of these for a few bucks at home depot or just about anywhere.  What can you do with one of these?

  • Check the voltage of a pin or a trace or a through hole on your board.  You can often learn a lot by checking the voltage at specific locations on your board.  (This presumes some understanding of the components on your board and a schematic that shows how everything connects together.)  Are you getting power where you should be getting power?  If you have a little microcontroller running, is it driving the output pins high when it should?  Driving them low when it should?  There is a lot you can learn and debug and diagnose just by measuring voltages.  Even when there is signal traffic across a line you can often deduce interesting information.  For instance, the TX line on a serial port should live at +V (for whatever voltage you are running at) and the signal spikes should go low.  The opposite happens for the RX line.
  • Check if two points on your board are connected.  My multimeter has a 2nd mode where it will ring out a continuous tone when I touch the two leads together or if I touch the leads to two ends of a wire or a trace.  This can be really useful when you are hunting around a board and want to know where precisely the other end of a trace comes out, or verifying your solder joint is correct, or verifying you haven’t shorted something out, etc.  This is very handy for basic troubleshooting and it’s amazing how much you can do with very simple tool if you understand your hardware and think carefully about what you are doing.

Oscilloscope

Normally we think of really high end test equipment that costs thousands of $$$ when the word “oscilloscope” is mentioned.  And I don’t doubt you get what you pay for in terms of capabilities and quality.  But here’s an idea for the hobbiest who doesn’t have a couple spare thousands of $$$ in loose change they can dig out of their couch cushions on a moments notice: there are a ton of inexpensive oscilloscope modules you can buy that connect to your computer through the usb port and use your computer screen as the display.  Many of these are in the $200 range — something that hobbiests could consider.

I poked around and decided to try the cheapest thing I could find: A “PoScope Mega1 Bundle” on sale for $162 at saelig.com.  I don’t have any special allegiance to these guys, but they shipped right away and I have no complaints.  Here’s what comes in the box.  It may not look like much at first, but what you can do with it is pretty sweet, it’s a real oscilloscope after all.

Minor side note:  The software you download to support this device is Windows only.  I’m a Linux guy, but I have a Windows XP virtual machine running inside “Virtual Box” inside my Linux box.  The best of both worlds for all you Hannah Montana fans. :-)

There was a little slip of paper in the box directing me to go to www.poscope.com and download the latest software application and drivers.  My bundle didn’t include one of those round shiny things which is just as well.  After some fiddling around downloading and installing the drivers (and then rereading the instructions for installing the drivers and doing it again more carefully) I was up and running!

Here is a screen shot from the poscope page.  It shows several things you can do.  With two probes you can show two signals on a single plot.  You can show the X, Y plot of the two signals, and even do some FFT frequency analysis of your signals.

This might sound like really complicated electrical engineering stuff, but let me bring it over to my world and show you some of the things I might like to use it for.  The embedded electronics I deal with include microcontrollers that communicate with sensors and external pins.  If something doesn’t work, sometimes it is important to get a little bit more detailed view of what’s going on besides looking at the steady state voltage or basic connectivity.

Here is a screen shot of serial communication traffic at 1.8v logic level:

  • When two devices aren’t talking properly across their dedicated signal lines you can probe the communication at different points and see exactly what is happening.  Is there signal traffic?  What voltage level is the traffic at?  Often different devices expect their digital signals to operate at different voltage levels.  What if a 1.8v device needs to talk to a 3.3v device or a 5v device needs to talk to a 1.8v device?  You need voltage level conversion chips and life gets a bit more complicated than you like … especially if something isn’t working.  But with an oscilloscope you can probe different points of the communication path and see exactly what is happening.  Is the source sending the signal?  Is it being converted properly?  Is the signal making it all the way to the destination?
  • Digital logic analysis.  The poscope includes a separate connector with 16 digital signal lines.  The software includes a way to decode and display incoming serial traffic or other digital signals like i2c or spi communication.   Are you trying to connect up an i2c or spi device and something isn’t quite working yet?  Looking at the digital logic and relative timings of the different pulses might be just the thing you need to sort out exactly what’s going on.
  • I discovered another interesting use … debugging my code.   I needed to write a small program for an ATTINY13A microcontroller.  This is an 8-bit microcontroller running at 9.6Mhz.  It offers a whopping 1k of flash for my programs, 64 bytes of internal SRAM, and all of 8 pins to receive ground/power, and talk to the outside world.  There is no serial port for printf()’s, no display, no keyboard, no mouse.  The programming device shares these 8 lines to upload new programs.  Now to be fair, there is a whole suite of software you can download for windows, but I’m a linux guy remember, so what fun is that.  I needed to validate clock timings and check if my interrupt service routine was responding correctly, so why not toggle one of the digital output pins, probe that with my oscope and validate the program operation and timing by measuring the pulse lengths of the digital signal that is being produced?
Here is a screen shot of my ATTINY13A generating a PWM pulse that mirrors an incoming PWM pulse from an RC receiver.  I can even slide C1 and C2 (the vertical white lines) side to side to mark the start and end of the pulse and read off the time interval.

Conclusion

I’m barely scratching the surface of what you can do with an oscope (hey I’m learning as I go here too), but for < $200 why not consider picking up an inexpensive USB based oscilloscope.  It may not be something use every day for the rest of your life, but on those days when you really need to see and understand a little bit more about what is happening on your circuit board or what your tiny microcontroller is really doing, an oscope is a great tool!

Here is a photo blog showing the progress from initial rough prototype, to final design, to mold making, to test flying the first production aircraft:

Resolution 3: Design to First Flight

This is a project that was sponsored by NOAA to develop a fully marinized small UAS that could be deployed from a variety of small vessels, recovered in the water, and used for marine debris detection or wild life surveys.

The “Resolution 3″ purpose built UAS airframe is just one of the really cool products to evolve out of this project.

What I want to do: Control RC Servos from a Gumstix Overo

I have a project where I need to drive standard RC servos from a Gumstix Overo.  It doesn’t appear that the Overo ships with any built in PWM drivers.  I did quite a bit of googling, and still couldn’t find a single drop-in driver that worked well for driving RC servos.  I did find some great help though, rolled up my sleeves, and stitched pieces together to make the mother of all RC servo drivers.
Scott Ellis @ jumpnowtek.com has a nice introduction to programming the Overo hardware PWM signal generators: http://www.jumpnowtek.com/index.php?option=com_content&view=article&id=56&Itemid=63
The Overo has 4 available PWM signal generators on 4 specific GPIO lines.  Scott provides a simple driver that demonstrates how to configure PWM10 to generate a signal at any frequency and duty cycle.

What is PWM?  Frequency?  Duty Cycle?

PWM stands for “pulse width modulation”.  It is a common approach for computer servo control.  Essentially the computer sends a short signal pulse (raises the signal line high.)  The exact length of this pulse tells the servo where to position itself.  The computer sends the pulse at a regular rate and varies the “width” (or the time span) of the pulse to control the position of the servo.  This is how all standard RC servos work.  The number of pulses we send per second is called the “frequency”.  Typical RC systems use a frequency of 50hz.  The ratio of the on versus off time of the signal is called the “duty cycle”.  A duty cycle of 0% means no pulse at all.  A duty cycle of 100% means the pulse is always on.

For a standard RC system running at 50hz, there will be a pulse generated every 20,000 us.  (1 sec = 1,000,000 us; and 1,000,000us / 50hz = 20,000us).  The pulse length to center a servo is 1500 us and the useful pulse range to run the servo through it’s full range of motion is about 1000 us – 2000 us.  If you send a 1500us pulse every 20,000us, then the duty cycle is 1500 / 20,000 or 7.5%.  The duty cycle range for controlling a servo at 50hz is then between 5% and 10%.

Scott Ellis’s “Basic” PWM Kernel Driver

Scott Ellis on the page linked above makes a basic pwm.c driver available.  This driver only sets up one PWM (PWM10 aka GPIO145).  This is routed to pin 28 on the “standard” 40 pin breakout header included on many overo expansion boards.  This was a great start, but has some limitations.

  • It only supports one PWM line (PWM10)
  • Duty cycle is entered as an integer percentage.  RC servos operate across the range of about 5-10% so that only gives me 6 unique positions, not nearly the granularity I want

Signal (Logic) Level Translation

A quick note on something that can turn into a really tricky headache for newcomers to the Overo.  The Overo uses 1.8v logic for all it’s output.  This means that even though you are generating a perfect PWM signal to drive your servo, nothing will probably happen because the servo is expecting 3.3v (or maybe even 5v) signal logic.  It may not see or respond correctly to 1.8v logic.  This is also a more general issue for any external communication with the gumstix overo and is something embedded hardware engineers encounter every day.  There are many ways to address this issue, but one quick and easy solution is to buy a logic level converter from sparkfun.com: http://www.sparkfun.com/products/8745

This sparkfun board supports level shifting for 4 lines at the same time.  I soldered 0.1″ male header pins onto both sides and then used sparkfun 6″ single wire jumpers to connect things together.  It is slick and relatively easy and with the color coded wires it even looks cool, especially on a glass desk with the office lights off and all the LED’s blinking.  :-)  All you have to do is tie your grounds together.  Then connect 1.8v (pin #16 on the 40 pin header) to the LV side.  Connect 3.3v (pin #2 on the 40 pin header) to the HV side, and then pipe the signal line through to the servo.  Despite the RX/TX labelling, I believe the signal conversion is bi-directional on the latest version of this sparkfun level shifter board.

Jack Elston’s Driver Extension to Support all Four PWM Lines

Scott emailed me an update to his pwm.c which expands support to all 4 hardware PWM signal generators.  This is a great next step.  However this version of the driver also had some limitations:

  • PWM10 and PWM11 used the 32Khz clock (which is the default).  Leaving the details aside, the 32Khz clock can only achieve about 32 unique positions across the typical RC servo range of motion.
  • I believe there is some integer overflow for PWM8 and PWM9 when computing the duty cycle which leads to odd results.
  • Part way into the project I decided I wanted to generate PWM pulses with sub us resolution.

13Mhz Versus 32Ghz Clock

Scott Ellis to the rescue again.  Scott emailed me an older testing driver he had built called “pulse.c” (note: Scott makes all his drivers available github.com under the GPL license.)  The pulse.c driver includes code to set the PWM10 and PWM11 timers to use the 13Mhz clock.
The 13Mhz clock allows us to have 259,998 duty cycle steps.  In other words 0 corresponds to 0% duty cycle and 259,998 corresponds to a 100% duty cycle.  Since an RC servo is expecting a 5-10% duty cycle at 50hz, this gives us a numeric range of about 13,000 values to work with.  We are interested in a pulse with range of 1000-2000us (a range of 1000us) so 1000us / 13,000 step sizes gives us better than 0.1us resolution.
0.1 us resolution gives us 10,000 unique positions across the range of motion of a typical RC servo.  For reference, if we were driving a pan servo on a camera system that was setup for 180 degree coverage, we would have approximately 0.02 degree resolution.
Now, whether or not an RC servo can resolve input signals down to this level of accuracy is a different discussion, but servo technology does continue to improve steadily.

Integer Overflow!

Integer overflow is never any fun.  The math proceeds without reporting any errors and you get the wrong answer.  Grrr.  Note that INT_MAX for an unsigned 32bit integer is 4294967295.  tmar is the integer duty cycle percentage ranging from 0 to 259,998.  num_freq is the max number of duty cycle steps (in our case 259,998 for the 13Mhz clock.)  The formula to compute the tmar value is then: pulse_us * frequency * num_freq / 1000000.
Here’s the problem, when computing this formula with a pulse of 1500us, you get an intermediate value of 19499850000 before dividing by 1,000,000.  This is way larger than INT_MAX so the math wraps around and the result after the divide is totally wrong.
As a work around I observe that frequency (50) divides evenly into 1,000,000 so I can rearrange terms and do that division first.  This keeps all the intermediate values less than INT_MAX.

Getting to 0.1 us Resolution

So far so good if I’m specifying integer us pulse widths to the kernel.  However I want to have 0.1 us resolution because the 13Mhz clock offers that level of resolution.
Doing floating point math inside a kernel driver is considered bad form, and you have to do a lot of horsing around just to get proper machine code generated and linked with the right libraries.  We don’t want to go there, so no floating point.
Instead I will specify timing values in 10ths of a us.  So to request a 1500us pulse I would write a value of 1500us*10 or 15,000.  Writing a value of 15,001 to the driver will give me a 1500.1 us pulse.
Back to integer overflow again.  Specifying a larger input value in the range of 10,000 to 20,000 suddenly pushes me back into integer overflow territory with my intermediate values.  259,998 / INT_MAX = 16519.2 so any pulse longer that 1651.9 us will push me back into int overflow.  The solution is that I observe that 259,998 is divisible by 2, so I can pre-divide this number by 2 and earlier divide 1,000,000 by 2 to get an equivalent answer.  This allows me to specify signal widths of up to 3303.8 us which is well beyond that standard RC range again.  I realize this is a pretty specific solution for this particular hardware and this particular clock frequency, but when dealing with embedded systems, you often have to get specific.

What’s so special about 259,998?

When dealing with low level hardware and clocks, you end up running into very odd ball numbers that some CPU hardware designer somewhere must have thought was cool.  259,998 is an annoying number.  Prime factorization is 2 • 3 • 17 • 2,549.  This means it’s hard to divide evenly with anything and it can be a challenge to try to simplify integer math expressions to eliminate intermediate integer overflow!
Observe that 259,998 * 50hz = 12,999,900.  In computers, kilo often refers to 1000 and mega refers to 1,000,000.  So 12,999,900 / 1,000,000 = 12.9999 Mhz.  Let’s round that up to 13 and I think you see this is the number of clock ticks per second a 13Mhz clock generates.  259,998 is the number of ticks per 1/50 of a second.  (You see, it all makes perfect sense!)

Getting the Updated Driver Code (Driver to Command and Control 4 High Resolution PWM Signals on a Gumstix Overo)

Scott was kind enough to commit my version of the pwm driver to a branch of his omap3-pwm project on github.  You can access the branch here (called “four-channel”):  https://github.com/scottellis/omap3-pwm/tree/four-channel

Future Enhancements

Scott suggested that a nice extension would be to allow the user to select which of the 4 PWM channels are activated and configured when the module is loaded (or via a platform device whatever that is.)

This weekend I took the plunge into Fedora 15 with Gnome 3.  This is a major change from previous versions of Fedora.

Overview

Fedora 15 is very different from previous Fedora releases.  The main reason is the upgrade to Gnome 3 which is entirely different from Gnome 2.  In Gnome 3 your entire desktop experience is completely (and I say completely) changed.  This is no small thing.  As with any change, there is good and bad; some things I like, some things I miss.

Cool thing: gnome-shell

The gnome-shell is something new in Gnome-3.  This isn’t a “shell” in the classic unix sense.  Instead it is really your desktop or your graphical user interface experience.  If you are coming from windows or previous versions of Linux, you might be in for some initial system shock!  Life suddenly got way different.  If you’ve ever used a Mac, you might think Gnome 3 is more Mac like than anything else.

Cool thing: Windows map + dual head display

Hey this is cool: when I press the “windows” modifier key on my keyboard, it pops up a map of my windows and workspacers.  In my primary display (on the left) I see all the windows from my current workspace.  In the secondary display (on the right) I see a selection of my my most commonly used windows from my other workspaces.  Neat feature!  On the right hand side of the primary display I get a map of all my workspaces and windows.  This makes it very quick to find an app or window, move things to different workspaces, etc.

Cool thing: Application launching

If you’ve ever used a modern mac, you’ll have gotten used to a different way of finding apps and launching them.  Gnome-3 follows this general style.  The “start menu” is completely gone with no hint of it left.  Instead you have an applications folder with all your apps.  You can select different categories to limit the options, or start typing part of the name in the search box.  If you have a collection of apps you use quite often, you can pin them on your activities bar so they are always handy to find when you need them.

Cool thing: Desktop recording

Alt+Ctrl+Shift+R – this toggles desktop recording on/off.  You’ll see a little red “record” icon in the far lower right corner of your display to indicate if recording is active.  I sometimes like to record movies of my FlightGear flights so I’ll have to see what kind of performance I can get with this feature.

Cool thing: Dynamic workspace allocation

Coming from the gnome-2 world, I spent quite a bit of time googling & trying to figure out how to configure more than 2 workspaces on my desktop.  (Normally I like to have 6 workspaces for grouping all the windows/apps related to different kinds of tasks.)  Well it turns out that the gnome-3 shell dynamically allocates workspaces on the fly … so you always have one more empty work space.  You can use Alt-1, Alt-2, … Alt-n to hot key between workspaces. When you launch an app from the app folder or the dock, you can middle click on it to launch on the last (empty) workspace. I don’t call any of these things “intuitive”, but once you get the hang of this new way to do things and “understand” the way gnome-3 thinks, it’s slick, and quick, and it’s growing on me quickly.

Cool thing: Desktop search

When you press the “windows” special key on your keyboard or mouse up to the activities corner of your workspace, a search box pops up.  You can start typing anything in this box.  Immediately (and as you type) you are presented with items that match: Applications, Settings, Places and Devices, and event Recent Items (files) from your hard drive.  I’m sure I will still have trouble finding that critical misplaced file when I need it (because I forgot the name, or forgot to copy it from my laptop, etc.), but this should be another great tool for quickly finding what you need when you need it.  I haven’t figured out what qualifies as a recently used file or how the indexer works or what it indexes.  I would like to understand that better.  I’ve seen hints that in the next release of gnome, the search indexer might be expanded to include file contents and not just file names.

Issue: Some things I miss

The new graphical interface gives up some things I have become used to and depend on:

  • The “start menu” is gone.  It’s replaced by an applications folder with application icons that is much more Mac-like (or maybe like a tablet or smart phone application selector.)
  • All my desktop icons and files are gone.  Gnome-3 doesn’t let you litter your desktop with 100′s of files and shortcuts stacked on top of each other any more.  This is distressing.  I like my messes, I like them a lot, I know where to find things!  [Edit] See comment from “AceRoom” below: apparently it is possible to get your desktop icons back if you wish.
  • The trash can on my desktop is gone (now moved to the file manager window.)
  • The “status bar” at the bottom of the screen is gone.  No longer can I see what apps are running on what workspace at just a glance.
  • The “status bar” at the top of the screen is changed.  Now it shows the current app, the time, and a few little icons way to the right.  That’s it.
  • Gnome widgets are gone.  I can’t have a weather applet in my top status bar any more.  Why?  There’s tons of room for stuff like this?  Maybe they will add it later?  Maybe they won’t?  Guess I’ll have to keep my phone handy so I can check the weather when I need to.
  • There’s no date displayed on the status bar of the desktop.  You have to click on the time to see the calendar and remind yourself of the date.
  • So far I haven’t seen if/where the little notification icon comes up to let me know there are new software fixes available to install.  I have been running “yum update” manually to keep my system current.
  • [Edit] Fedora has switched from Open Office to Libre Office.  After a couple spot checks, I haven’t noticed any problems working with office documents.  http://en.wikipedia.org/wiki/LibreOffice#History

Issue: Misleading screenshots on fedoraproject.org?

Minor nits, but when I go to the fedoraproject.org web site and look at the screenshots of fedora 15 … many of them are obviously fedora 14 and bear no resemblance to what fedora 15 looks like.  The web site also advertises a non-linear video editing tool.  That doesn’t show up in the install or anywhere I can find it.  Maybe last minute issues?  I can write these off as oversights, but I usually expect a little better from fedora … they are usually a pretty classy outfit with their act together pretty well.

Issue: Dual head display and workspaces

Problem: I run two displays on my desktop PC.  This was detected by default, however, any window that was at least 50% on the secondary display became “sticky”.  In other words, when I switch workspaces (a key aspect of my daily work flow), all the windows on the second display would follow to every workspace. If I was doing a presentation on a laptop and the second display was a projector, then this would make perfect sense.  But for my daily work, it’s absolutely the wrong way and very annoying.

Solution: Fortunately (as is often the case) a little bit of googling turned up a solution.  The recommendation is to “yum install gconf-editor”, then run it from a terminal.  Navigate to: Desktop->Gnome->Shell->Windows and you should see an option called “workspaces_only_on_primary”.  Uncheck this option.  It will not immediately take effect though, you will need to log out and back in.  Now both displays will participate in workspace switching.

Issue: No audio on Asus M4A88TD-V EVO/USB3 motherboard (Realtek 892) and Kernel 2.6.38

Problem: After the upgrade to Fedora 15, all I hear are random clicks and pops.

Solution: I tried a bunch of things with no progress.  Then I did a complete power cycle and my sound came back.  Weird.  First time I’ve had trouble with the onboard audio with this machine, but I’m back up and going so <whew>.

Tell me where I’m wrong!

If I haven’t discovered a cool gnome-3 or fedora-15 feature yet, please tell me about it.  If something I have an issue with is handled in a different or better way let me know!  I’m learning as I go and I’d love to hear your feedback.  Thanks!

The Hobby-Lobby “Hun Hunter” P-47 seems to have a small design flaw.  Because of the size of the wheel well required for retracting the gear, there is not a lot of foam material along the leading edge of the wing in this area.  At the thinest point, it’s pretty thin. The wing is subject to cracking in this area — starting at the leading edge and proceeding through the middle of the wheel well.  There is a carbon spar in the wing so the wing isn’t in any danger (I don’t think) of coming off in flight, but it does create greater flexing and makes me nervous.

It seems that any landing that is less than perfect has potential to crack the wings.  I can grease in a sweet landing now and then, but once in a while everyone bangs in a little harder than they intended.

In an attempt to repair this problem “permanently” I cut two small pieces of glass cloth, about 5/8″ wide by 1 – 1/2″ long.  I then used a mixture of slightly thinned 12 minute epoxy to glass in this cloth.  The picture below shows the outline of the tape along with the rough location of the crack (in green.)

The tape blends in pretty well once the epoxy saturates it, although the epoxy will cure a bit yellowish.  This takes away from the perfect scale appearance of the aircraft I’m sure, but what are you going to do?  I want to be absolutely rock solid safe in flight.