Circuit boards There are two circuit boards, one for the microcontroller, gyros and accelerometers and one for driving the motors. There's a 20-pin cable between them. The main reason to have two separate boards is to keep the sensitive analog electronics away from the high current switching transients in the motor driver. You'll want to plan ahead to mount them several inches apart. Both board use mainly surface mount components. If you haven't built these kind of boards before, you might want to practice on a simpler one first. While you can solder these with a regular fine-tipped soldering iron, it's better to use a temperature-controlled hot plate so you can place all the components with solder paste, and melt the solder all at once. This process is fast, and makes rugged and reliable circuit boards. Some of the components are 0402 size, meaning about 1 mm by 0.5 mm. Unless your fingers are nearly this small, you'll want to use tweezers. I use a 20x stereo microscope to make sure everything is aligned right, but you can probably manage without one if your eyes are good. Sparkfun has a good tutorial on reflow. The yaw gyro, which needs lower precision, is on board. You can either solder the 32-pad BGA version or a DIP version. Unless you have experience soldering BGA chips, use the DIP. The design uses the fairly recently developed high-capacitance MLCC ceramic capacitors, which provide up to 10 microfarads in a tiny package. They're now better and cheaper than tantalum capacitors. The microcontroller board has space for some extra stuff which you may or may not want. It supports 2 strain gauge inputs, 2 optical quadrature encoder inputs, 4 foot pressure sensor inputs, 3 gyro inputs, and a RS-232 serial interface. You can leave off some of the components if you don't need all the above features as indicated in the BOM. Currently, my scooter uses 1 strain gauge input (for steering,) zero quadrature encoder inputs, zero foot pressure sensor inputs, 2 gyro inputs, and the serial interface. The board calls for some 10k, 0.1% precision resistors. They aren't very expensive, about $10 altogether. You can use 1% resistors, but you'll have to do more calibration. For each board, you can download the Gerber files (which you can send to a board shop to get them to make you a PCB,) a bill of materials (giving parts numbers and sources for each component) and a PDF showing where to place the components in places where the silkscreen on the board isn't quite legible. Someday I'll get a batch of PCBs made and sell them at cost. Or if someone else wants to do this, let me know. Here are the design files for the microcontroller board: Now for the power driver board with all the big MOSFETs. Ideally, this board should be fabricated with thicker copper layers (4 oz rather than the standard 1 oz) to handle the high currents. The MOSFETs are mounted up through the bottom of the board and bent outwards, so they can be bolted down to a heat sink plate. The IRFP2907 MOSFETs have an insulated mounting hole so all you need are the silicone pads, Digikey part BER120-ND. You use them dry, without grease. Be careful: some similar looking parts like BER131 are not electrically insulating. Rather than one huge wire connecting the board to the motors & batteries, it uses several 16 gauge wires in parallel. (By the way, 4 16AWG wires have the same amount of copper cross section as a 10AWG wire.) It's easier and more reliable to solder multiple small wires than one large wire. There are 8 wires each for battery positive and negative, and 4 wires each for the motor leads. For current sensing to work, you have to route some of the wires through the holes in the current sensors. The 8 B+ wires go through the current sensor at far right. The 4 MA wires go through the left current sensor and the 4 MC wires go through the middle current sensor, all in the obvious direction. The wires terminate in connectors a few inches away from the board, with 10 AWG wires on the other side. See the wiring diagram and picture. The board also calls for ceramic decoupling caps placed on the bottom of the board to handle the large current spikes from switching MOSFETs. Be careful about changing any of the wiring. I had something specific in mind when I designed it to ensure that current is shared evenly among the batteries, wires, PCB traces and MOSFETs. There are lots of other ways to wire it up that will seem to work, but will cause failures such as melted wires, melted PCB traces, blown MOSFETs, or overheated batteries under hard operation. It will show up when the scooter suddenly fails and tips over at high speed or during aggressive maneuvers. You'll wish you'd done it right in the first place. This board has a tricky combination of parts on both sides. Here's the best way to build it:
Here are the design files for the power board: Electrical The batteries, disconnect relay, and wiring need to be fairly beefy to handle the large currents drawn by the motors during a maneuver. At cruise it only draws 10A or so, but it can peak at over 200A during an abrupt acceleration or deceleration. You'll need:
Make sure to use the appropriate gauge of wire as indicated in the wiring diagram. The fuses are pretty important, since fresh batteries can deliver several hundred amps, enough to melt copper wires. Two 40A fuses will give you enough power for any reasonable maneuver. (The recommended fuses can withstand a pulse of 200A for a second or so before blowing, which should be enough to get you over the top of the loop-dee-loop :-). The diagram shows how to route the B+, MA and MC wires through the center of the current sensors. Pay attention to connecting the battery wires to the right terminals, since current sharing between the batteries depends on getting it right. Do a good job crimping the connectors for the high-current lines from the batteries and to the motors. You don't want them melting at high currents, or opening due to vibration. I've tried to crimp them with pliers and vise grips, and it can't be done properly. Powerwerx sells an affordable crimp tool. The 45A powerpole connectors will accept either a 10AWG wire, or 4 16AWG wires. To connect to the relay you'll need yellow quick-disconnect female connectors, Digikey part WM18234-ND. I used 5mm coaxial power connectors for the battery charge input, but I'd probably use Powerpole connectors if I were doing it again. I used Powerpole connectors at the battery terminals to make them easily removable. If you're using a strain gauge for the steering sensor, connect it to connector XSG1 on the microcontroller board. The cable should be shielded.
Connect the CRS03-02 gyro to the XPITCH connector. For the gyros and accelerometers to work right, orient things as shown in the picture. Electromechanical parts
Mechanical parts You'll get the best results if you make these parts with an accurate milling machine, but you can probably make something acceptable with hand tools if you're good at that sort of thing. There are machinist drawings for everything.
You can either build your own spoked wheels or buy some small & heavy wheels that bolt onto the NPC motors. The spoked wheels are larger and lighter, so you'll go 40% faster.
Test, charging, and programming system You'll need:
There are two ways to program it. The first is using a dedicated programmer like the STK500 connected through the 6-pin header labeled "PROG" on the microcontroller PCB. The STK500 connects through a serial port to your PC, where you run avrdude to download the .srec file through the STK500 into the microcontroller. The second, more convenient, way is to install a bootloader in the flash memory using the first method, then download new code to it over the serial port. The serial port is also useful for capturing debugging output. Avrdude should work with this, but I haven't tried it. There is some more technical detail in the README file in the source directory. Getting it running There are a bunch of things you can get wrong when hooking everything up. Most likely, you'll have one or both of the motors backwards so that the balance feedback goes the wrong way. This will cause the scooter to lurch when you start it, so start it gently with your hand on the kill switch. It works best to start with one motor disconnected. If the active wheel makes it sort of balance, then it's right. If it takes off, switch the wires and try again. Then get the other motor right. Finally, make sure the steering works in the right direction. If it doesn't, you can swap terminals 2 and 3 at the XSG1 connector. ...needs more... |