Saturday, November 10, 2012

Tiny ATmega 328p board and adventures in SMD soldering

With Metal Scooter sitting partially finished back on the West Coast, a new project has been overdue for a while now. So here it is:


Still covered in flux from soldering 


I've always found digital electronics and microcontrollers interesting, but without a lot of experience in anything beyond simple circuits, Basic Stamp 2s, and Arduinos, I've always been afraid to try and dive into more complex stuff. So as a small step in an attempt to broaden my electronics knowledge, I've decided to start with trying to make a shameless Arduino knockoff. Actually, more of an Arduino nano knockoff, because to make things more interesting I wanted to incorporate the surface mount ATmega 328p chip. The mini board design was inspired by the many internet examples of shrunk down Arduino projects (like the really impressive one I used as a model here). This will be nowhere near as good as those, but it is super simple and much cheaper than buying commercially.

The board was laid out in Eagle first, primarily using parts of the useful SparkFun library. I referred to the 328 datasheet and other schematics posted online for most of it. It only has a reset switch, crystal, power LED, and important resistors and capacitors right now. This board is too small to have an USB FTDI converter, so instead it just directly takes an FTDI input cable through the boxed pins on the picture above. It also lacks a voltage regulator, as well as TX or RX line LEDs. I found the trace routing process tricky for a beginner with this little room, so I ultimately had to end up increasing the board size slightly, and rely on Eagle's auto-routing feature for parts. Here was the final product


After obsessively checking over the connections to make sure that everything was correct, I set an order to OSHPark for the price of $5.40 (for three!). All but one of the components were ordered from Sparkfun (because they didn't carry it). Fast forward a slow two and a half weeks later, and everything had arrived.

The board on the right has been fake-populated for reference

The boards looked awesome, so I started the soldering process as soon as possible. I'm fairly proficient at through hole soldering, but knew that SMD would be a different story. This was reinforced when I looked at the size of the mega:

On my pinkie finger
It didn't help that I hadn't picked up on the sizing designations for SMD parts until after the order was sent. Some of the pieces truly made the 328 seem easy. Luckily, the RPI embedded hardware club held an SMD soldering tutorial exactly when the parts arrived. I attended and was able to practice putting together an Arduino nano clone. Whereas that was using other people's soldering flux and leaded solder though, I had to assemble my board with lead-free and no flux (because I didn't buy any from Sparkfun like I should have). Soldering it together was tough with no magnification, but it seemed to get easier as I went, and by the end I had everything on.

For programming, I ripped off the pogo-pin board idea from a number of people on the internet, and used it to connect an ICSP programmer. The first time I plugged it it, the green power LED lit up. Excited by this minor success, I tried to burn an Arduino bootloader to the chip. This is where things started going wrong. Because of the simplified Reset button circuit, I needed to hold down the button to start the programming. Unfortunately, due to a schematic error that I later discovered, holding down the Reset button caused both the button and board to heat up alarmingly fast. It looks like I missed a resistor in the design, and in doing so created a direct short between the power and ground when the button is depressed.

Sketchy pogo-pin programmer setup
To try and fix this, I scratched out a tiny spot on the board to the point where the copper was visible. I cut the offending trace, and soon the component will get soldered in. Even though the board isn't working yet, I'm hopeful that it will only be one (or many) hacks away from functioning. Expectations were honestly pretty low that it would work the first time, but I have enough parts for at least one more board right now, and if the first works I'll definitely be ordering a version two. Either way, I'll update with more info when I get farther.

Monday, September 24, 2012

Projects on hold

Hello,

I apologize for the abrupt stop in updates on Mëtal Scooter as well as updates in general lately. I've been very busy over the past month transitioning into my Freshman year at Rensselaer Polytechnic Institute, and in the process discovering ways to continue pursuing my hobbies at college. Mëtal Scooter is in the same (mostly functional) state as I last reported on, and it has been left back in my home state to continue when I return during breaks. I've discovered a few aspects that I want to work on more or rebuild, but overall I was very happy with how the scooter turned out.

With that said, I have begun to order parts to begin a small project that I also began designing over the summer. I'm hoping that it can act as my introduction into an area that I'm very inexperienced in, but want to learn much more about. When I get a little further into it, I'll begin posting some information again on how that process goes. I definitely don't want to stop updating this blog or working on projects,  but this will probably happen more slowly from now on.


Friday, August 3, 2012

Mëtal Scooter construction update #3



The final work and testing on my Mëtal Scooter project has been very productive; especially in highlighting those areas of the design that need improvement. As only my second electric vehicle (and really the first meant to actually be regularly ridden on), Mëtal Scooter has been an highly educational project from start to finish for me. Maybe at some point in the future I'll be able to use these lessons as inspiration for a version 2...

Continuing from where last update left off:


I finally have a front wheel now, complete with an mega-sized aluminum fork! After getting more cutting fluid for the mill, the ShapeOko cut out the other half from last update. This is obviously a much larger wheel (8") than the Razor was ever designed to use, both in width and diameter. Conveniently, the addition of the aluminum plates to the outside of the existing fork mount was just wide enough to give the wheel clearance. The axle is a simple threaded rod with end cap nuts like the back wheel. This front end actually seemed to come out pretty well. The wheel+handle has room to turn 360° without getting caught (not that I intend to turn that far while riding). 

Initial non-powered push rides with this arrangement quickly revealed the first design problem. The force holding the platform and rider to the main chassis is focused on 4 machine screws near the front. My brief and non-scientific test ride immediately lead to the stripping and pulling out of all these joints. While the riser to deck connection is more than sufficient for preventing carbon fiber flex and keeping pieces from falling apart, it isn't enough to support a rider. My first attempt to remedy this problem was a redesigned handle mount plate:



This new plate allowed it to spread the load over twice the number of screws, as well as reduce the deck flexing. Unfortunately, the 8 screw arrangement failed just as much as the first. For the moment, my solution has been to stick a C clamp on the front end of the scooter during test rides to keep this from coming apart. I've recognized the foolishness of trying to support my weight (and potentially many times more, especially given the force from going over bumps or small drops) on small screw threads. The two solutions I'm considering right now are bolts going from the top plate to the U channel aluminum beneath, or some kind of  aluminum retainer piece stretching around the front or sides. 

With the front end no longer falling off, I was able to take a short powered ride. It became immediately clear that the friction fit between the sprocket and rear wheel bore was not enough to keep it from slipping under medium acceleration. Instead of messing around with trying to create a tighter fit that would eventually slip at some future point, I just put a few threaded rods between the sprocket and wheel to ensure they would rotate together:

Two of the three rods can be seen here
With the scooter in a ride-able state, I gave it an inaugural test by flooring it up and down a hill a couple times. Due to the brushless motor and sensorless speed controller, it was necessary to give it a good push-start before using the throttle. Once it was moving though, it rode well and was easy to control. I was concerned that having the rider so high above the ground would make balance a challenge, but this didn't seem to be the case. After another half hour of hill riding, I found that the scooter seemed abruptly less powerful. I brought it back in and checked out the battery by plugging it into the Smart Charger. 

In short, it turns out that I managed to turn my 8s LiPo into a 6s LiPo according to the charger. After kicking myself for being so stupid, I checked out the damage by measuring the voltage on each cell individually. One cell read 0 volts, all the other cells read in the low 3 volts. The 0 volt cell was a lost cause. By slowly charging the rest of the pack at 6s, then re-charging it as 7s however, I was able to bring it back to a 7s pack. I think the cause for the problem is probably twofold. First, driving it irresponsibly up and down a hill until the pack was nearly drained was a terrible idea with LiPo batteries. Unlike the lead-acid batteries I'm used to, this probably caused some permanent damage to the cells. Secondly, back when I was initially soldering connectors to the battery leads, there was a quick short circuit when the two wires simultaneously brushed up against the motor exterior. I didn't detect any problems back then, but that might explain the totally dead cell. 

I think I can live with the 7s pack for a little while, so until it proves problematic I won't order a new 8s. In the meantime, there are only a few small pieces to finish until the scooter is done and it can get a proper testing run.





Tuesday, July 24, 2012

Mëtal Scooter construction update #2


This will be a relatively short update on the most recent Mëtal Scooter progress. The biggest news is that the chain drive has finally begun spinning under motor power(!):


First though, I'll go over some other small stuff that has happened. After completing the epoxy etching from the last update, I painted some metallic hobby modeling paint in the groves to make the logo more apparent. Once this dried, I brushed on a final coat of epoxy to fill the remainder of the etching and give a shiny finish. It turns out that the etching wasn't cut quite as consistently as I thought; specifically the "a" letter is too deep (due to a non-level mounting on the CNC). I tried to fill it with extra epoxy to increase the strength in this section:


Next up was attaching the Razor scooter front end to the deck. The stock Razor uses a simple four hole mounting scheme to connect to the chassis. Those bolts screw in to an additional threaded steel plate on the inside of the scooter to sandwich the aluminum deck and spread the load over a greater surface area. I used the same inside plate with my deck after grinding off some pieces that didn't fit. Instead of going directly through the deck, I put in two custom 1/4" aluminum spacer plates to raise the handlebars a little and get the wheel axle at the right height. Unfortunately, a couple bend tests quickly proved that this mounting job wasn't nearly robust enough. The unidirectional carbon, while strong, flexed too much between the aluminum risers supporting it. To try and remedy this, I cut and installed four additional risers near the front to stiffen things up. If this doesn't work well enough, the back up plan is to mill out a much larger aluminum spacer plate that can double as a secondary mount into the risers.


No, I'm not about to miter saw it in half...I ran out of table space 
Meanwhile, the spacer plates for the motor mount were also being milled out (along with a throttle piece to connect to the servo tester potentiometer):


After the arrival of the new sprockets and chain, I ultimately only needed three to get the correct spacing. The sprocket installation required a little more grinding and metal cutting than I anticipated due to some poor planning, but it ultimately worked out okay. While waiting for some more hardware to mount the back wheel and motor, I also decided to get the wiring out of the way. It's a very simple setup for this scooter, just a wiring harness between the ESC, lipo, and motor with a toggle switch, charging socket, and a BEC wired in. The connectors are some cheap Deans knockoffs from HobbyKing. The toggle switch really wasn't rated for these kind of voltages or current draw. The first one stopped working after the second time, keeping the circuit closed even when turned off. I suspect the internal pieces might have gotten welded together. I've since put in an even cheaper second one, which works, but creates a sketchy spark noise every time I switch it on.

Cutting out the switch holes in the aluminum channel was another ShapeOko job. This was a truly questionable setup for a piece of this size. It took two scrap pieces of aluminum channel, duct tape, wood screws, and a cast iron drill press clamp to hold everything down long enough to cut the holes out. Luckily, the cuts went fine.


When the electronics were finished, I finally got the chance to install the chain and test out the motor. Without a chain breaking tool, I used a table grinder and a screwdriver to get the length I wanted. It took a little while to get the alignment right once it was connected, but it eventually came out pretty well:


The "motor mount slide channel" tensioning technique seems to work fine. After letting it run for 5 minutes, it became clear which parts needed thread locker or additional reinforcement. I dealt with those parts, and so far everything seems to be holding. Both the motor and wheel sprocket were welded on for simplicity (after the pain of trying to mount the old sprockets). I imagine welding to the wheel's bearing probably doesn't do anything good to its rolling friction, but then neither does the bolt and "washer spaced" axle it is on. This is an area that might be redone later.

Lastly, I began milling out the front wheel fork (the original Razor one not fitting 8" wheels). I haven't completely thought through how it will attach at the top, but it will probably involve a couple machine screws. I only finished one of the two because I ran out of cutting fluid spare air-tool lubricant. Once that piece gets cut out, only the throttle mount and a few small details need to get figured out before the scooter can get tested! Hopefully that will happen by the end of this week:









Monday, July 16, 2012

Mëtal Scooter construction update




A lot of work and progress has happened since the last Mëtal Scooter status update. Starting from the beginning:

A brand new Razor scooter about to be destroyed for parts

The McMaster-Carr, HobbyKing, Amazon, and Ebay shipments all arrived roughly on time. The first order of business after checking all the items was to remove the handle and steering mechanism from the Razor scooter. The wheels, deck, brake, and other miscellaneous pieces weren't needed. By using the Razor mechanism on my scooter, i'll not only save money but also get to take advantage of the folding feature of the handle. I did notice that the new Razor A2 design seems to have a 1-2" shorter handle (at maximum extension) than the one I had as a kid. In order to raise it to a slightly more comfortable height, I intend to add about a half inch of aluminum spacers at the bottom when I attach it to my deck. Feeling bad about just tossing the unused parts though, I decided to just try installing the front wheel directly into the deck:


This really didn't work for obvious reasons
Next I moved on to a task that I was really excited about: cutting 5052 .25" aluminum plate on the ShapeOko CNC. I had also received some proper 1/8" carbide milling bits with the Amazon order, so everything I needed was ready. Beginning with the scooter's deck risers, I started to experiment with different variables in the CAM software. At the start, about half of the cutting attempts were successful. I lowered the pass depths to about .005"  at a medium feedrate. This was more successful, but a problem with metal shards landing on the Y-axis rails created very jerky motion that ruined a few more attempts.

A successful piece



As a quick fix, I stuck some duct tape to the interior vertical sides of the rails to block most of the aluminum chips. This worked pretty well, but regular cleaning after every two pieces was necessary. The biggest improvement came with the use of a cooling/lubricating fluid (instead of the water I had been temporarily been using that the beginning). While I still haven't gotten around to purchasing some real machining fluid, the bottle of air tool oil that I found on a shelf has been doing a remarkably good job of improving the ShapeOko's aluminum cutting ability. As a bonus, it is also heavy enough to block most of the metal chips that come off the the cutter. I realize that this is probably a far from ideal fluid, but I don't really feel like spending money on the real stuff until it runs out. After this point, I could finally begin cutting pieces with more efficiency:

The bottom right riser has some visible damage from when the cut part got suck against the bit

Each piece was drilled through on the side for connection to the aluminum U-beam that acts as the scooter body. Due to a couple stupid moves on my part, two risers had to be shifted to the side after I broke off a tap in the original holes. Overall though, I think that this process ended up pretty close to the design:


Before moving on to the deck, I decided to cut the slot for the back wheel. It was pretty quick and easy using a table and band saw. The cut is still a little rough, but I might give it some filing when everything else is done:


The wheel on the back is not the one specified in the original design. Instead of pneumatic wheels that would provide some shock absorption, I opted for hard rubber wheels because I had them laying around and they were free. This might will definitely need to be changed at a later time if I decide to use this scooter regularly. While I may have cheaped out in every other aspect of this project, I did pursue the carbon fiber deck. Having done a little bit of work with carbon fiber before, this time I decided to lay out a proper area to assemble and cure the deck:

The wax paper in the center is what the carbon fiber will cure on 

I don't have any pictures of the process because my hands were in epoxy covered gloves, but it was pretty simple. I chose to use unidirectional carbon fiber from a local Tap Plastics because it was convenient and much more reasonably priced than the standard weaves. I put down four layers total (wetting each with epoxy as I went). The bottom and top ran lengthwise for looks, the 2 sandwiched layers in between ran perpendicular. When I was done, I put down a final sheet of wax paper and lowered a heavy piece of oak lumber to compress it. After 8 hours of curing (I couldn't wait overnight) I peeled off the wax paper to get a look:

The notch was cut later on a bandsaw
Overall, it was disappointingly wrinkled on the surface. Despite efforts to keep everything smooth, one side turned out badly, and one turned out OK. The OK side became the top surface. While the wrinkles didn't ruin anything (or compromise its strength), it meant that I ultimately had go through the sand down+reapply epoxy process four times to get a good finish. Four layers seems to be about the minimum thickness that is safe to use as a standing platform. There is some flexing from the deck that will hopefully be eliminated after screwing it down to the risers. On the positive side, it is extremely thin and looks kinda cool up on the risers (in my opinion).


Next I turned to the drive system. To connect the motor to the body, I needed to make a very large and unusually shaped motor mount plate:


The shape is so bizarre because it has mount in-between the back wheel and the end of the rear slot. After it rises above the deck level, it widens to fit the motor. The slots should allow the motor to slide when the bolts are un-tightened. Because the chain won't have a real tensioner, i'll just slide back the motor to take up slack. The motor mount will also need some aluminum spacers to line up the motor and wheel sprockets. This part presented a good challenge for the ShapeOko. When cutting it, I choose very conservative settings and used lots of fluid. It took about 4-5 hours at this snail pace, but the final results were great:


Also pictured are the two pseudo rectangular aluminum spacer pieces for the motor mount, and the scooter front cover/headlights. The headlights were just an idea I had for fun. I had ordered four superbright white LEDs from All Electronics a couple months ago, and I soldered them to a perf board with a resistor to run on 5 volts. The aluminum front fits into the U-beam like this:


And the LEDs do what they are expected to do too:

Much brighter in real life than the picture appears
Getting back to the drive system, I spent a couple hours working on an unorthodox method for connecting a sprocket to the rubber wheel:

Those are 5 carefully positioned and adjusted threaded rods tapped into both the wheel and the sprocket to hold it an exact distance away from the hub. It was a long process to get the sprocket completely parallel to the wheel with minimum wobble. Unfortunately, I later realized that it was impossible for me to connect the smaller matched sprocket to the motor I had purchased. These #25 sprockets and chain had come from a junked electric scooter a couple years before. That scooter used a brushed motor with a strange shaft to hold the sprocket on. Despite another couple hours of attempts to attach the sprocket to my standard-shafted motor, I ultimately couldn't find a way to securely connect it. I've finally decided to just purchase some standard #35 chain and sprockets from McMaster-Carr. The parts should be arriving later this week.

The last element of Mëtal Scooter that I have worked on is engraving the deck. Realizing that cutting letters through the carbon would probably weaken it even more, I decided to try to use the mill to engrave into the epoxy. This was a pretty scary process. I ran the code on at least two test pieces and double checked all the settings and machine parts to make sure that everything was perfect. To get the deck into the ShapeOko's 8x8" milling area, I slid it under the Y-axis rails and then screwed it down directly to the worktable through the pre-drilled riser screw holes. The deck is one of the few pieces that I can't easily replace without a lot of work. There would also be no way to hide any mistakes if I messed anything up. It took five false starts to get the zero level right on the Z-axis (the surface wasn't completely level), but it finally got set correctly:



The improved epoxy finish is more visible here. The engraving went very well, and I really like the depth of the letters. The epoxy dust that is making the words visible in the pictures will soon go away, so I think that I may brush in a metal paint on the engraving. One final coat of epoxy over that should make it durable and still slightly indented.



Construction is moving faster at this point, so I will probably post another update soon with more about the electronics and drive system. I'm also planning on adding a lot more information to the ShapeOko page, especially more details about the aluminum cutting and future modifications.






Tuesday, July 3, 2012

ShapeOko arrival! (+scooter update)




The ShapeOko mechanical kit (#236) arrived a little over two weeks ago, right on time after I had finished putting the electronics together (I've been away since then, so this is a little belated) . The kit itself came very well packed and organized. With all the parts neatly organized in individual bags, it was easy to put the mill together in less than a day. I found the only somewhat tricky element to be the instructions, but spending a little time looking through the ShapeOko wiki was enough to figure out what was going on. For stepper motor control I used the GrblShield, which was simple to connect to and run. My software stack consists of Autodesk Inventor Student (dxf or 3d file)->CamBam(free 40 use trial)->GCodeSender. Unfortunately, I was too excited about getting it working to think about taking picures of the assembly.


Obviously, the combination of a not-very-stiff pen mount and incorrectly-set-z-axis-height created some problems on the above "Hello World!" picture. Since then I've spent some time playing with feed rates and other variables to make things run faster and more smoothly. For my cutting tests I have been using a Dremel rotary tool on high speed with a 1/8" standard wood drill bit. So far I have tried cutting foam, soft wood, hard wood, and acrylic with varying levels of success. What has become most clear is that finding the correct feed rate for each material is critical for a good cut and finish. I have also recognized that a standard drill bit will not function very well as an end mill. I've put in an order for a couple of proper end mills so that I can soon begin to cut things for real. My ultimate goal is to cut 1/4" aluminum plates with this mill. I think that this will be entirely possible with some more practice and better bits.

Test cutting a riser for Metal Scooter out of some wood

Overall, I am very impressed with the ShapeOko CNC mill. Its design seems really well thought out and rigid, and the hobbyist community oriented aspect of the project is also very cool.  It is amazing that a highly funtional and legitimate miniature CNC machine can cost less than $350. I am excited to begin putting it to use for real parts and projects. I am also considering the possibility of expanding the X-Y work area to accomodate larger workpieces (due to the ShapeOko's convinient use of MakerSlide rails). I apologize for the lack of many pictures in this post; I'll be updating with those when I get back from a trip. More details about my progress with using ShapeOko in general will be posted under its page when I have the time to work with it more.

(Quick Mëtal Scooter  update

Most of the parts for  Mëtal Scooter  have been ordered at this point. For both cost and simplicity reasons, I sold out and will be using a modified Razor Scooter A2 front end instead of designing my own. In the end, I think that a $100 cost saving there will allow me to make the rest of the scooter (carbon fiber top-deck) that much more cooler. I also downgraded the motor slightly so that I wouldn't have to deal with the expense of 10s Lipo batteries, chargers, and ESCs. I will be using an 8s setup instead. This should still be dangerously fast, but at a more economical price. It will likely be about a week before enough parts arrive for work to begin.

Saturday, June 16, 2012

First post, new project, ShapeOko update

Hello,

This is my first post on this blog, which I've set up for the purpose of documenting my personal projects both for myself and anyone else who is interested. The tabs to the right link to different pages with more complete information and build logs on my past and current doings.

New project

With that out of the way, I'd like to introduce my (hopefully) next project:



The design is obviously incomplete at this point, but I'm aiming at creating a small yet powerful electric scooter for personal transportation at college next year. It will use a brushless motor and large LiPo pack  for power, while keeping with an aluminum (and maybe composite) frame to reduce weight. The drive system will be a simple #35 roller chain setup with two sprockets, and the axles will probably just be some 3/8" bolts. I'm trying to design the body around a piece of aluminum U-channel. This should make it less complicated to build with the tools I have access to, and will fit the electronics and battery easily with some modifications. Specifically, I needed to create more space between the bottom of the channel and the deck. I've illustrated my in-progress solution below:


I've modeled 12 (6 on each side) riser pieces that slide and screw onto the channel legs and attach to deck with more screws. It's easier to see from the side:



These risers lift up the deck ~.5" and free up some space for the battery. They will also (hopefully) give some airflow past the electronics (or make this scooter very non-waterproof!). My biggest concern so far is that the deck may warp or flex too much in between these small support points. The carbon fiber shown in the pictures would be great, but I may have to swap it out with something a little cheaper. It also has to be something that I can cut on a bandsaw. The handle and front wheel mechanism are still in progress, but they will definitely feature a lot more of the .25" aluminum plate that I have been using so far.



The emphasis on aluminum plate construction in this design has lead to the tentative name Mëtal Scooter. To be honest, a lot of this vehicle is serving the secondary purpose of testing a new mill kit that is coming in the mail to cut aluminum pieces. Speaking of which:


ShapeOko kit update

A couple months ago I purchased a ShapeOko mechanical kit. I'll hopefully update the ShapeOko page with my thoughts on the kit, and any other interesting things I learn or make with it. Supplementary parts have started arriving for the kit recently, and the UPS tracking page has the actual machine scheduled to come in on Monday. I now have the power supply, stepper motors, and Grbl shield for the Arduino. So far I haven't done much more than upload Grbl to the Arduino and tested the settings, but I'll hopefully have everything running by the end of next week: