Category Archives: Projects

Arduino CAN Bus Interface

I’ve been working on an implementation of CAN for use in aircraft.  The protocol is called CAN-FIX and is a part of the MakerPlane Open Source Airplane project.  You can get more information on CAN-FIX here.

The idea for this project is to build an Arduino shield that will let it communicate over the CAN bus.  I had some Microchip MCP2515 and MCP2551 (CAN Controller and CAN Transceiver, respectively) laying around so I decided to make my own little Arduino shield so that I could quickly try out some ideas.  I started with the little ProtoShield that Sparkfun sells.  I also had some header material laying around so just getting the PCB without the rest of the kit worked for me.  An easier answer may be to get the full ProtoShield Kit.  This will give you some buttons and LED’s to play with too.

My intention for this particular device is to use it as a generic USB<->CAN converter.  Once I have that working, I’ll have a CAN interface for a computer and could use the same code with an Arduino Mini, or something similar, to interface to a Beagleboard, Rasberry Pi or other SBC.

CAN Shield Schematic
CAN Shield Schematic

The circuit is pretty simple.  It’s just an SPI interface to the MCP2515 CAN Controller IC.  This IC handles all of the low level details of the CAN protocol.  Things like timing, arbitration, error detection etc are all offloaded to this IC.  I purposely made mine similar to the CAN Shield that Sparkfun sells.  The pins are the same but I choose to use a 20MHz ceramic resonator instead of the 16MHz oscillator that’s on the CAN Shield.  The only reason I did that was because I had some.  It might make it work better at higher bit rates too but I haven’t tested any of that to know.

There are a couple of CAN Shields out there and they all have basically the same interface to the Arduino so this means that we should all be able to use the same software with all of them.  After all an SPI interface to the MCP2515 seems to be the most popular way to do CAN communication anyway.

Arduino Leonardo
Arduino Leonardo

One thing about my shield that is a bit odd is how I actually tied in the MISO, MOSI and SCK lines.  Since I decided to try this with a new Arduino Leonardo which has some differences in where these signals are located.  They don’t bring them out to the headers any more, so I connected them to the six pin ISP programming header.  This should work regardless of which type of Arduino used but I haven’t tried it on another type.

Top View of the CAN Shield
Top View of the CAN Shield

In this shot you can see the MCP2515 to the right and the MCP2551 in the top center.  The DB-9 connector is just one end of a serial cable that I had lying around (You can’t see it in this picture, but it’s on the other end of that thick black cable).  I just cut one end off of it and found pin 2 and 7 for use here.  There is a pad on the proto board for a small pushbutton switch.  I used two of those holes (the ones tied to GND) as place to solder some wire and hold the serial cable.  There are probably better ways.  The transistor looking thing to the left is an LM34 temperature sensor.  I threw it on there so that I’d have something analog on the board to use when I’m playing around with the CAN-FIX software.

Bad photo of the solder side of the CAN Shield
Bad photo of the solder side of the CAN Shield

In the above image you can see the two rows of female headers that I used for the ISP interface.  I didn’t have any two row female headers so I just cut a couple of single row headers and jammed ’em together.  As you can see there really isn’t much to it.

The code to make this work can be had from GitHub.  It’s not very far along but it can be used for testing the circuit at this point.



MCP2515 Datasheet

MCP2551 Datasheet

Hangar Door Controls

I’ve been building a door for my hangar.  The door has been installed in the opening.  Now I have to finish installing the mechanical and electrical components that make it work.

The winch to the left is used to pull on the locking cable.  The motor and gearbox turn the main shaft.  The box to the right is the where the limit switches are located.
The winch to the left is used to pull on the locking cable. The motor and gearbox turn the main shaft. The box to the right is the where the limit switches are located.

The motor is a reversible 2HP 220VAC single phase motor.  It has a brake installed between it and the right angle gearbox.  The gearbox has two shafts.  I used both shafts and two ANSI 60 chains.  When I did the load calculations on the chain it came out to be right at the maximum for an ANSI 60 sized chain so I went ahead and used two.  If those chains break the door comes crashing down so I didn’t want to risk it.

I couldn’t find any limit switches that I liked that didn’t cost $700.  I wanted to have two sets because if one set fails and the door continues to open, really bad things will happen.  The controls are set up so that one set of limit switches go into the PLC (Programmable Logic Controller) as inputs and are the primary way to stop the door at each end of it’s travel.  The other set of switches are set just further up and down than the first set and they are wired directly into the motor control circuit.  This way, if the PLC fails or one of these limit switches fail then the motor will still stop.

Limit switch enclosure
Limit switch enclosure

The limit switches work by turning a couple of Acme thread lead screws that have a two nuts on them.  I welded a washer on the nuts that I cut grooves into.  These grooves ride on the small aluminum angle pieces and this keeps them from turning.  I can make very fine adjustments to this by pulling the aluminum angles out and turning the nuts.  One of the nuts is the down limit the other is the up limit.  The turning of the screw causes the nuts to move back and forth and actuate the small lever switches on each side.


These are the chains and sprockets that drive the limit switch mechanism.
These are the chains and sprockets that drive the limit switch mechanism.

The limit switch lead screws rotate from sprockets that are attached to the main shaft.

The PLC is in the upper left, the main motor contactor is on the lower right.  Most of the relays are for lights.
The PLC is in the upper left, the main motor contactor is on the lower right. Most of the relays are for lights.

The main control panel controls the hangar lights and the door motor.  It uses a small Automation Direct PLC.  There are open/close buttons on the front of this panel and it also has the capability of interfacing with a keypad and a remote control.  I can open and close the door from the cockpit of my plane as I taxi up.  It’s pretty cool.  The PLC has a couple of communication ports on it for programming and for communication to other devices.  I used one to talk to a touchscreen that is near the walk in door of the hangar so that I can open and close the door from the entry door.  It’s a bit spoiled I know, but since this is the kind of thing that I do for a living I thought I should make the controls a little bit over the top.

I can control the door and the hangar lights from this touchscreen.
I can control the door and the hangar lights from this touchscreen.

I can also turn on the lights in the hangar from this touchscreen.  There are four banks of lights in the hangar.  I don’t always want all four banks on since I may only be working in one corner of the hangar so I can individually control them.  I had extra outputs on the PLC so I figured why not control the lights too.  This will give me the ability to control the lights from home at some point too.  Having the door computer controlled gives me lots of options on how to manage it.

This shows partially open.
This shows partially open.

Once I got everything installed I slowly opened the door a bit at a time and made sure that everything was working / holding.  It took a bit of fiddling to get the limit switches set and the tension on the straps set right.  Overall it works pretty well.

The open door.
The open door.

This turned out to be a much bigger project than I ever imagined.  It seems simple enough just looking at one but like most projects, the devil is in the details.  It’s nice to finally have my plane in a home of it’s own without a big hole in one wall.



Bifold Hangar Door

I’ve always wanted to own my own hangar.  I put it off for many years until I could afford to do what I wanted.  I didn’t want to settle on something that was too small, too far away or not built properly.  I was finally able to do that but I was not happy with any of the hangar door options that I had so I decided to build my own door.

Bottom panel of the door up on sawhorses for paint
Bottom panel of the door up on sawhorses for paint

The door is going be a bi-fold door.  This is the kind of hangar door that is suspended from the top and opens upward by bending outward in the middle.  The dimensions of the opening are 60′ wide by 16′ tall.  It’s made mostly of 2″ x 2″ square tubing.  There is some 1-1/2″ x 2″ and some 2″ x 3″ tubing as well.  I laid it all out on the floor of the hangar.  This was less than optimal since my airplane was stuck back in the corner of a hangar that had a very large hole in one end of it for several months.  I also elected to work on the door before doing the electrical work.  This was also a mistake since I did most of this work during the winter months and it get’s dark very early so I couldn’t do any work after work.  Had I done the lights in the hangar before building I would have been done sooner with both.  Once I got started on the door I couldn’t really do the lights because the door was in the way, so I was stuck.

Anyway, a 60′ x 16′ door turned out to be a much bigger challenge than I thought.  It didn’t look that big on paper.  It was a lot of welding.  The worst part was getting it up off the floor to paint.  I had to enlist the help of the neighbors several times to lift each panel and to turn it over.

Both door panels painted and ready to go up.
Both door panels painted and ready to go up.

It was too big of a door for me to install myself so I hired the same company that built the building to come back and hang it.

Lower panel of the door in place.
Lower panel of the door in place.

Once the door panels were up I had to hurry and get the straps and cables put in.  It worked out okay because the company that was putting it up for me had another job that had to be done so it gave me time to install the lift straps and the cables.  I could have done this after the sheet metal was put on but it was much easier to do without the sheet metal.


Door panels installed with the lifting straps attached.
Door panels installed with the lifting straps attached.
Another view of the door panels with straps
Another view of the door panels with straps

Once I was done with that the installers came back and put on the sheet metal.

Most of the sheet metal installed on the door.
Most of the sheet metal installed on the door.


Installation Done

The door is installed in the building with the sheet metal and insulation complete.  Now it’s up to me to install the motor, shafting, electrical and the rest of the odd and end bits that make it move.  Stay tuned.

Do It Yourself Outdoor Wireless Access Point

My wife and I live on 44 acres here in Texas and I needed to get my network distributed around the place. I needed to have access at the barn because my wife has a small office there and I wanted to have a camera at the entry gate. The barn is about 500 ft from the house and the gate is over 1500 ft away.

I built a couple of wireless outdoor access points using a Cisco-Linksys WRT54G Wireless-G Router, a PVC enclosure from the hardware store, a couple of outdoor antennas and some open source firmware for the WRT’s.

I started by installing an access point at the house and putting an antenna under the eve. Since I only need to be able to see this antenna from one side of the house this worked out pretty well, otherwise I would have had to put it on a mast.

Here is a picture of the access point at the gate. It just fits inside one of these 8″ CPVC boxes. I had to drill the hole in the bottom in just the right place since there is just not enough room inside to make a bend in that antenna cable.

I don’t have a picture of the access point at the barn but it looks just like this one except, I left one of the little rubber ducky antennas on it that came with it. If you put the WRT on it’s side and at a slight angle you can turn the one antenna up alongside the WRT and it all fits. Since the box is plastic there is little there to attenuate the signal. Since the barn is only 500 ft away it works just fine. You need to be sure and disable the other antenna in the setup program.

I bought this antenna from RadioLabs. It’s a 16 Element 15 dbi Yagi Antenna. Here is a link to the antenna. The connector on the back of the WRT is a Female Reverse Polarity TNC (or RP-TNC). My antenna came with an N type connector and I simply ordered a cable that had the correct connectors on each end. The key is to remember that you need a Male RP-TNC on the cable or antenna to connect to the router.

The whole thing is powered off of the same solar panel that powers the gate controller.

I used the DD-WRT firmware for both of these. Both are used in Client Mode. Client mode is a way to have the WRT54g router act as the client end of the wireless connection instead of the access point end. This basically creates a ‘virtual wire’ type of connection. It’s as if I ran an EtherNet cable all the way out to the gate from the switch in the house. I can go out to the gate, plug my laptop into one of the ports of the router and surf the internet.

There is a lot of documentation on how to use DD-WRT in Client Mode, but there is one ‘gotcha’ that had me stumped for a while. You need to use MAC address filtering in the access point and put all of the client’s MAC addresses in the list. This may have changed in more recent versions of DD-WRT but MAC address filtering would be a good idea anyway, if for no other reason, than to help keep the neighbors from using your connection.

ATX Power Supply Conversion

Commercial lab power supplies can be pretty expensive. For most of what I do in my little lab I don’t really need that level of sophistication. ATX computer power supplies are cheap and plentiful. I had an old one laying around and I decided to turn it into something that I could use in the lab.

In the old days of the AT power supplies it was easy to turn them on and take power from them. I used a few of these for powering prototypes years ago but the ATX power supplies are a little more complicated and I never got around to figuring out a way to turn them into something useful.

One of the extra features of the ATX power supplies over the old AT versions is that the ATX power supply can be turned on and off by the computer itself instead of a big giant switch that turns the AC power to the supply on and off. This is done by simply grounding one of the wires in the main connector. It’s the green wire. The ATX supplies have a pretty high current capacity for 3.3V 5V and 12V outputs. There are also -5V and -12V outputs, but these aren’t capable of delivering the same current.

The one that I modified had the following specs…

Total Power Output 230 Watts
5V 18 Amps
3.3V 10 Amps
12V 7 Amps
-12V 0.8 Amps

It also has a +5V standby of 2A that is on all the time whether the supply is powered up or not. I had no use for this one so I clipped it off.

I took the power supply apart to figure out where to put the binding posts and the power indicator LED. It made sense to use the same side where the wires come out of the circuit board. The problem with this for me was that this side of the box is on the part of the enclosure that comes off from the rest of it. It worked okay but the soldering was tricky. Other supplies will have different geometry and may be easier. This one is physically very small so I struggled with it a bit.

Radio Shack didn’t have enough of the big binding posts that I wanted so I bought a couple of little ones. I figured that since the negative voltage outputs won’t supply much current that they could stand to be on the smaller ones. It would have also been nice to have a different colored one for each voltage but RS only supplies red and black so I went with those. I didn’t want to spend forever on this little project.

The color code for all the wires…

Green Power Supply On
White -5 V
Blue -12 V
Red 5 V
Orange 3.3 V
Yellow 12 V
Black Ground
Purple 5 V Standby (Not Used)
Gray LED Power Indication

After I laid out and drilled the holes for the binding posts I started cutting and soldering the wires. The first thing I did was solder the green ON wire to one of the black ground wires. You could wire this to a small switch if you want to but the way mine turned out I have pretty good access to the main switch that came on the power supply. If you want to use the standby 5V power then you’ll have to put a switch between the green wire and ground for powering the supply on and off. You could also build a fancy little circuit that could power the supply off after some time. The sky’s the limit with this.

I put a 220Ω resistor in series with a small LED (check the polarity) and connected it to one of the red 5V wires and one of the smaller black ground wires. This gives me a power on indication. After I finished I discovered that the gray wire is designed to be used for this purpose. Oh well, I’ll remember that next time. Using one of the red wires works just fine.

After that I started cutting and bundling the different colors of wires together. I tried to tie as many of each color to it’s respective binding post as I could but there was no way to get all of those black wires on one post. Since I had extra black binding posts I used a couple for the ground. I tend to have banana plugs hanging 6 inches off of my power supply grounds so this will give me more options anyway.

Once I got them all soldered together I put the power supply back together and turned it on. It just blinked and went back off. It didn’t take me long to figure out what I had missed. This particular supply has a couple of small sense wires coming off of the circuit board. One was orange and the other was black. I took the thing back apart and connected the orange one to the 3.3V post and the black one to ground. When I turned it on this time it stayed one. Success!

In my research I found that there are several different types of power supplies and some have a sense wire that has to be connected and some do not. On some of them it is a different color. It may take a little playing around with whatever power supply you have. There is plenty of information on the internet too.

There also seem to be some power supplies that won’t stay on if there is no load. In this case you will need to get a 10 or 20Ω – 10W resistor and put it between one of the red wires and ground. This will give the supply enough load to stay on. Mine worked without it.

The last thing, was to make some labels with my label maker.

These ATX computer power supplies are actually pretty good switched mode power supplies, and with a little hacking they are easy to convert to bench use. This whole project can be done for less than $15 if you have an old power supply laying around. If not they are easy to find.