2009-10-30

Starting assembly of a 3D printer

A CupCake CNC Kit that I recently ordered from MakerBot Industries arrived today.

I spent about 6 or 7 hours working today working on assembling it.  This is what I've accomplished so far.

Assembled the optical end stops:


Painted the large pieces that make up the exterior case (white on the inside, blue on the outside):


 Assembled the X and Y stages:

 
 
It's really neat how this is designed.  It's all laser cut plywood, held together with slots and tabs, and bolts with captive nuts.  I never knew you could do so much with plywood.

The assembly has gone pretty smoothly so far.  The instructions are very comprehensive.  I've only had a few tiny snags:
  • I dented the side of a bearing trying to get it to fit into the printed pulley.  I was afraid that I'd have to order a replacement bearing and wait for it to arrive.  Luckily the bearing still turns smoothly despite the dented side.  I ended up pressing it into the pulley using a vice.
  • The Y stage looks a bit different than the one in the instructions.  Not enough to cause any problems, though.
  • I don't seem to have any of the M3 washers that are needed in a couple places.  I had some small washers on hand that work OK.
  • It wasn't very clear to me how to attach the pulley to the X stage.  To start with, the instructions call for a M6 22mm bolt.  If my calipers are to be trusted, the closest bolt included is more like M5 25mm.  It also wasn't clear to me which way the plastic pulley goes on (directions show a wooden one), or how many nuts and washers go under the pulley.  By experimenting, I managed to find a combination that seems to hold the pulley at the correct height for the belt.  I also had to move the drive pulley on the stepper motor out further on the shaft than the instructions said.
I'd say that so far, this is extremely easy to put together.   The little things above are just enough to keep it interesting without getting frustrating.  I'm probably less than a third of the way done with the assembly though, so I'll have to see how the rest of it goes.

2009-10-19

Arduino Oscilloscope

I have some testing I'd like to do that would benefit from an oscilliscope.  Unfortunately, I don't have an oscilloscope, and there's no room in the budget to buy one at the moment.  So I thought I'd see what kind of oscilloscope I can make out of an Arduino microprocessor.

I know an Arduino oscilloscope has been done any number of times before.  This is just my version of the concept.

I originally thought I'd have to do some moderately complex programming to make the Arduino act as an oscilloscope.  I figured I'd have to buffer readings, and have a communication protocol to transfer the data, set up trigger conditions, etc.  Luckily, I decided to run some tests before I started the serious coding.

A quick test app reveals that the analogRead() function 112 or 116 microseconds to execute (the micros() function has a resolution of 4us, so the actual time is somewhere between those two values.)  Serial.write() of a single byte takes only 8 microseconds.

The slow analog conversion time and the fast time to send a single byte gave me an idea: instead of having a complicated Arduino program to act as an oscilloscope, I could use an extremely simple program that just constantly streams measurements from an analog input pin.  For my purpose, I doubt I need the full 10 bits of A2D resolution; 8 bits should be enough.  This means that I don't even have to worry about synchronizing with the data stream from the microcontroller, since every byte is an valid independent reading.  A sample rate of 5000 Hz (200 us between samples) would only be 40kbps, which should be easily handled by a 115200 baud rate.

Unfortunately, further testing revealed that a 5000 Hz sample rate caused the serial data to arrive in large chunks about once a second.  I guess that some part of the serial line was being overwhelmed.  I don't know if it was in the microcontroller, the PC, or in the FTDI USB to serial chip.  Wherever the problem lies, a sample rate of 4000 Hz (250 us between samples) seems to cure the problem.

The resulting Arduino application is so simple that I'm going to post the whole thing here:
void setup()
{
  // need fast serial rate to keep up with 1 byte data every 250 us
  Serial.begin(115200);
}
 
void loop()
{
  static uint16_t analogVal;
  static uint32_t nextReadTime;
  static uint32_t nowTime;
  
  // start by calculating time that next read will take place
  nextReadTime = micros() + 250;
  
  // read analog value
  analogVal = analogRead(0);  

  // send analog value (as single byte)
  Serial.print((uint8_t)(analogVal >> 2), BYTE);
  
  // wait for right amount of time to do next read
  nowTime = micros();
  if(nowTime < nextReadTime)
    delayMicroseconds(nextReadTime - nowTime);
}

Pretty simple, isn't it?

Of course, now all the oscilloscope logic has to go in a program on the PC side.

I started trying to write an application in Python, pySerial, and pygame.  It was going a little slowly though, so I ended up throwing togeather a quick program in C# instead.  Here's what it looks like after a few hours of messing around:




In the first two pictures, the signal is just whatever is picked up with the analog input pin of the Arduino disconnected.  It makes a nice sine wave for testing the display application.

The third picture is the output of a pin set to output PWM with a 25% duty cycle.  The 4000 Hz sample rate of the scope is just barely enough to see the 500 Hz PWM waveform: each cycle gets 4 samples.

I don't know if this will actually be useful for anything, but it was fun to do.  I got to play with microcontrollers and computer graphics at the same time!

Evaluating LEDs for the low voltage warning device

The most recent design idea for the low voltage warning device will require a dual color indicator LED.  One of the colors should be green to indicate the "OK" state, and the other should be orange, yellow, or maybe red for the error condition.

The LED will have to be a 5mm T1 3/4 size to fit in a panel mount LED holder.

I went to Digikey and looked through the available LEDs.  I found 5 differerent ones that may work, and ordered a couple of each:

(I apologize for using a screen shot of a spreadsheet here, but I don't feel like messing around with table formatting right now.)


After receiving the Digikey order, I put the LEDs on a breadboard side by side to compare them.  There are two of each LED, one green and one other color.  Here is what they look like:



LEDs from the front in dim light.


LEDs from the side in dim light.


LEDs in bright light (shaded daylight.)


LEDs in direct sunlight.

My observations about the LEDs:
  • Amber, orange, or yellow are all too close to green.  The indicator LED will have to be a red/green LED.
  • The diffuse LEDs look better than the clear one (though the clear one here is also much dimmer than the others.)
  • LED #3 is the best of this bunch.  It's also the brightest one.
  • The LEDs are very hard to see in direct sunlight.  LED #3 in red mode is visible, but you have to be looking for it to notice it.
If I want the indicator LED to be visible in direct sunlight, I'm probably going to need a brighter LED.  I didn't want too bright a LED because it should not be blinding if used in the dark, but maybe that's not much of a concern since the LVW device is now slated to have a dimming function.

There is one LED from Digikey that looks like a good candidate; I wish I had included one in the order.  Digikey P/N 754-1235-ND has specifications similar to the #3 LED, except that the red component is twice as bright.  It's also a bit cheaper. 

2009-10-15

Low Voltage Warning UI Prototype

In my last entry about the low voltage warning device, I said that the requirements have changed.  Among other things, the device has to have a green LED active when the voltage is OK, and the LEDs have to be dimmable.

Based on the new requirements, I think that a microcontroller is justifiable.  I have no doubt that this could still be done without one, but I like microcontrollers, and that's where my experience lies.  I plan to use one of the small AVR uCs which are under $1 in quantity.

The device will now have to have both a bi-color LED and a single button.  This single button will have to both toggle the state of the LED and allow for dimming.  I think that this calls for a UI prototype to see how well this works.

As a side note, I'd much prefer a lit button, but all that I can find are prohibitively expensive.

This is how the button and LED should interact:
  • While in the normal (voltage good) state, pushing the button should toggle the green LED on and off.
  • While in the low voltage state, pushing the button should toggle between flashing orange and solid orange.
  • In any state, holding the button down for a few seconds should start dimming the LED.  When the button in released, the LED will maintain this brightness.
  • If a low voltage state occurs, the LED should always go to the flashing orange mode (as opposed to solid orange) in order to catch the attention of the operator.
For a prototype, I glued a couple of switches, an LED, and an Arduino to a piece of cardboard.  Rather crude, but it works.  Here's a video demonstration:


LVW UI Prototype from James Wilkins on Vimeo.


Sorry for the poor video quality.  My camera just died on me today, so I had to resort to a web cam for recording the video.  It was either that or a cell phone, and the cell phone would have been worse.

I think that this will work.  Of course, I'll have to run it past some actual users to see if it proves too confusing.

2009-10-13

Low Voltage Warning initial prototypes

I'm still working through the backlog of project information.  It's the second day of posting one update per day, and I think I might have enough stuff to keep this up for two or three weeks.

After creating an intial design and schematic of the low voltage warning device, the next task was to make a prototype.  The very first prototype, made to verify that the circuit actually worked, was on a breadboard.  After that, I decided to make a couple more permanent prototypes to use in testing the concept.

I wanted to use stripboard for the prototypes.  I bought some stripboard a few years ago, but this was the first time that I actually tried using them for anything.

I discovered that creating a layout for stripboard is more complex than I had expected.  I suppose it would be very easy to simply transfer a breadboard layout to the stripboard, but that would not be very space efficient.  I tried a couple of different stripboard layout programs, and ended up using the free version of VeeCAD.  It's far from perfect, but it gets the job done.  I liked the fact that component footprints are very easy to add.

One feature that I'd really like to see is an option to highlight all traces and wires that are electrically connected.  After doing a layout, I ended up saving a picture of the design and using GIMP to trace over it in various colors to verify that all components were connected correctly.  It would be easier to have this done automatically by the stripboard designer application.

This is what the stripboard design looked like (colored version):



Here is the first board that I made:




This board worked fine, and would have been suitable for a permanent installation, but it was not all that convenient to test with.  So I made another prototype, with a few changes.  The third prototype was build into a re-purposed case from a cigarette lighter power supply, and had a built-in flashing LED.  I also added a diode to protect the circuit from reverse polarity, and re-did the stripboard layout to cram it into a smaller space.  Here's the third prototype:



This version was used to do some real-world testing of the concept.  These were the observations:
  • The LED needs to flash, to ensure that it will be noticed.
  • There should be a green LED lit up when nothing is wrong, to indicate that the device is functioning.
  • The LED is too bright at night, so it needs to be able to be dimmed.
  • There should be both a 12V version and a 24V version (some airplanes use a 24V power system.)
This is suddenly getting a lot more complicated!  Maybe I can now justify using a microcontroller.

Here are some observations of my own about the design:
  • When buying the cheapest resistors from Digikey, pay attention to the power rating.  1/2 watt resistors are larger than 1/4 watt resistors.
  • I accidentally used a 16V rated filtering capacitor in the power supply.  Since a vehicle power bus can be 15V and spike even higher, and capacitors should not be used near the rated limit, this is far too low.  If I want this to work on a 24V system, I should probably use a 36V or 50V rated capacitor.  Unfortunately, 100 uF 36V or 50V caps are generally considerably taller than the 16V one I had here.  I'll have to be careful that the new capacitor will fit in whatever case is used.
  • I need to add a lot of protection circuitry to this design.  A fuse, reverse polarity protection, over voltage protection, etc.
I don't especially enjoy having to take all of these things into consideration.  It's much more fun to just build prototypes and never worry about the robustness of the design!

2009-10-12

Low Voltage Warning concept and initial schematic

I have a few projects in progress that I can talk about here.  I'm going to try to make at least one post per day until I've worked through the backlog of information.

One project I've started recently is a simple device to monitor a voltage level and warn when it drops below a certain level.  The specific application this is meant for is to monitor the 12V power in an airplane, and issue a warning if the alternator stops working.  It should work equally well in an automobile.

I've been asked by someone to design this device, with the intention of manufacturing and selling a small quantity.  These would obviously be for experimental aircraft only.  Since my electronics experience is at best "amateur hobbyist" level, whatever design I come up with will be examined by an EE before selling anything.

My little bit of electronics experience is in working with microcontrollers, and mostly on the programming side.  This project seems a bit too simple to justify using a ┬ÁC, so I went in search of appropriate components to use.

A bit of googling revealed that I probably wanted to use a "voltage comparator."  I also found a number of schematics demonstrating how to use them.  These are the two pages that I found most useful for my purpose:
http://home.cogeco.ca/~rpaisley4/Comparators.html
http://www.solorb.com/elect/solarcirc/lvbeep/index.html

Based on those two schematics, I created my own circuit.  I don't have a copy of the original circuit, but if you just ignore the PTC and diode in this one it's pretty much the same:


Operation of the circuit is very simple.  There's a regulator providing a 5V source to one input of the comparator, and a trim pot acting as a variable voltage divider on the other input.  The trim pot is used to set the voltage at which the warning triggers.  When the voltage through the divider drops to less than the 5V from the regulator, the comparator activates the transistor, which turns on the LED.

2009-10-11

Blog Reactivate!

I've been intending for quite a while now to set up a blog to use as a project log.  I had forgotten that I already had one set up here, from 3 years ago when I created the account and made just one post to the RepRap Builders blog.  So after going through a few 'upgrade' steps and messing with layouts a bit, I now have a blog ready to be used again.

I plan to use this space as a project log for all the various things I work on.  I like to create and build a wide variety of things, but I have a bad habit of starting many projects while finishing very few.  I hope that publishing my projects in progress will somehow encourage me to finish more of them.

The RepStrap that I posted about 3 years ago is an excellent example of a project started but never finished.  I had the 3-axis positioning system half done, and the extruder half done, but never got any farther than that.  Actually, that project ended up going backwards: I've moved a couple of times since then, and the MDF framework was demolished to save space.  I'm sort of resuming that project now in a less ambitious way: I recently ordered a MakerBot CupCake CNC Kit.