Archive | December, 2018

My first PCB - a DS1307 based realtime clock

14 Mar13

My first PCB - a DS1307 based realtime clock

The last months at Bitraf has been quite hectic in terms of workshops & activities. First there was a soldering workshop that I helped put on, then a PCB design workshop and that was followed by a PCB etching workshop. I also organized our third 3D Printer Meetup there. Peter, Trygve and Carl at the hackerspace has now gotten my dad's old Roland CNC to drill all the required holes in a PCB based on the Eagle files, so it's really possible to make nice things at Bitraf these days.

My first PBC, an RTC for Arduino

When an Arduino looses power, it's clock will always start in 1970 when it gets power again. For a client project I'm working on, I needed the correct time after a power outage. It was easy to find several RTC's online and they all cost something between $5 and $10. My problem was that getting it fast would be expensive and I happened to have the most used IC for this purpose. The DS1307 used in most of these modules is about a dollar each and the remaining components are not much either. Here's the Bill Of Materials along with links to where I bought them:

1 x DS1307

1 x 32.768 Crystal

3 x 10k resistors

1 x 104 capacitor (0.1 uF)

1 x 2032 battery holder

2 x 6-header pins

All together this is about $2 in parts, even for a very modest volume. Not shabby and I highly recommend both TaydaElectronics (Thailand) and Spiratronics (UK). Both are great shops that ship quickly to places in Europe and I use them a lot in addition to ebay.co.uk.

Designing it

I looked online, but couldn't find something that others had made that was "free to use" and I had an idea: why not make it plug straight into one of the header rows on the Arduino? That way it would be real plug-and-play since both power and the analog pins used for i2c are on the same side. Above you can see how this turned out - it plugs right into the Arduino Ethernet shield.

I looked up the reference design and looked at how others had done it before and then made a first go in Eagle. After a couple fails (I forgot to "fill" with ratsnest + had counted the pins incorrectly) I got a couple nice looking PCB's.

Making it

The etching went really well and with all the helpful people at Bitraf, it's not hard to get this right. I drilled this one manually, but I'll definitely use the Roland CNC as soon as we have a good way to cut consistent PCB sizes. Here's how it looked after cleaning with Acetone:

I didn't have the required clock crystals, but I got these from Spiratronics in just 3 days. Today I soldered it up and plugged it in. Guess what - it didn't work… I looked over the PCB with a magnifier glass and cleaned up some excess solder along the traces and it still didn't work. Bummer. I went online and looked at how Adafruit did theirs and then it struck me - I had put the IC on the wrong side of the PCB.

Using it

After doing this, it worked like a charm! I used the Adafruit 1307 library and it works just as I hoped. I'll definitely make a couple more of these for other projects and so can you! Below you can find the Eagle schematic + board and here's the final stencil to use for the etching.

See more pictures of the PCB etching process on Flickr

 

Meetup Pocket Sign

08 Mar13

Meetup Pocket Sign

My brother is thinking about going back into the signage business and as he would start up his own company, he'll need to build himself a network. My favorite way to connect with people and communities these days is Meetup.com - a website that help you host meetings with ease. So - I set out on a mission to help people remember my brother and what his company delivers.

I've long wanted to do something with the neat little 1.8" LCD screen I picked up from Adafruit some months back and looking through their site I found that they also have this neat Lipo charger as well as slim, matching batteries. What if I made a small LCD-sign that he could drop in his pocket? I ordered the components and started modeling.

About a week later, the parts arrived and I modified Adafruit's example file a bit to load images one by one from the SD card beneath the screen. That gave me a simple, but effective slideshow. All my brother needs to do is to to change the contents is to make some BMP images and dump them onto the SD card. Easy!

After a few iterations I came up with this case. The part containing the battery is not the slimmest, but it's also meant to go inside your shirt pocket. I could have made it slimmer, but then I would have to sacrifice battery time. With it's 1300mhA battery pack, it lasts 2 hours on one charge and charging it takes a little less than an hour. I could have saved a little space by skipping the proto-board that lies in between the electronics and the battery, but it made mounting things and getting the USB-port right for charging. I might remove that if I do a next iteration.

The part that is visible on the outside of the pocket is much slimmer and it looks like the red and white Meetup.com logo. It took quite a bit of fiddling to get the case right. I learned that by slanting the print 28 degrees while printing, a lot less cleanup was required.

The supports came off really easy and printing the parts like this actually made them much stronger and easier to glue together in the end. I usually use PLA plastic for all my 3D printing, but for this I used ABS since it can be grinded and polished (PLA can't). Towards the end of the project I didn't quite get the time required, but it was a fairly polished thing I gave away. It took me 4-5 evenings to make this project and I think it was worth it. I could of course have bought a CD or something from a shop, but this was a personal gift that (as far as I know) nobody has. Much more fun!

Here's a shot of junior showing off the final sign and if you want to make your own - grab the files on Thingiverse and components from Adafruit.

 

A two dollar programmable FM radio

07 Jan13

A two dollar programmable FM radio

It's been ages since I posted anything on electronics, even though I keep playing to learn more. I also frequent dx.com quite a bit and a fun little thing I picked up was a $2 radio-curcuit-board. It's a fully programmable FM radio that is 11 x 11 x 4 mm in size. As usual with electronics from China, the website barely says anything about the product. You just have to buy one and see if you can make it work.

The circuit came without any documentation, but Google is your best friend. The datasheet was all in Chinese, but thanks to Google Translate I figured out that this circuit was very similar to many other implementations of the TEA5767 radio chip. These chips all have the same pin-density as ZigBee modules, so I soldered on some ZigBee-headers to make connecting it easier. As you can see from the picture above, my cables were all over the place. Below is a cleaned up sketch of how to connect the TEA5767 radio module from dx.com (click to view full size). The audio amp obviously goes in between the speaker and the TEA5767 output.

The TEA5767 can be controlled using either Serial or I2C, so it's really flexible. It's not very powerful, so you'll need an audio amplifier to hear anything. I used an Adafruit MAX98306 amp breakout that I had from a former project. I won't get any style-points for this setup, but I'm glad I got it to work almost right away. This instructable made the code part really easy. Using a 10k pot to control the frequency also highlighted that more than 10-bit resolution would be nice (for better precision) or maybe one should rather use an encoder? Good learning fun anyway. Here's a vid of it working.

 

Heated Build Platform for Ultimaker

19 Jun12

Heated Build Platform for Ultimaker

Note: updated description available here! While this is written for the Ultimaker, it should also work the same for any RepRap printers with similar RAMPS electronics.

One thing I disliked with using a Makerbot was it's dependance on printing with ABS plastic. ABS comes from fossil fules and is thus a limited resource. PLA usually comes from Corn and is thus fully renewable and to some degree also biodegradable. This was one of my main reasons to get a Ultimaker in the first place, but then it dawned on me that the 60 degree celcius melting point for PLA was going to be a problem for many of my projects. I had to make my Ultimaker capable of using both plastics: PLA for prototyping and ABS for lasting models.

Why

When you are printing with PLA, all you need is some blue painters tape to print on. ABS however, won't stick to that. In addition - ABS requires that you keep the model warm while printing and ideally it should be allowed to cool off slowly to avoid cracks due to the material shrinking. How warm the heated build surface should be will vary a little based on the plastic, but I found these tables in the Makerbot Wiki a good reference. 110-120 celcius seems to make the ABS that I use stick well.

You can also use a heated surface for PLA, but then you keep it at about 70 degrees celcius. A nice plus when printing PLA on a heated surface is that it requires virtually no force to remove the model once the surface has cooled. What I needed was a Heated Build Platform (or HBP for short).

What and Where

How does one make such a thing? The RepRap wiki has many suggestions but after reading through all the links, there was one design that really appealed to me. It's basically a PCB that barely has any components, but rather lots of copper. When power is applied to the PCB, the copper turns hot - just like in an electric oven or a hair dryer. 

This PCB was designed by Josef Prusa and it's a perfect size for the Ultimaker (20 x 20cm). It also has a feature that I appreciate - it's made for 12 volt operation so no need to mess with AC electricity that could kill you! There are many similar methods used in various industries today and if I didn't want to use 230v, I'd probably get the SRFG-808 from this site (GBP 44).

Josef's design is called MK1 but the wiki also contains an alternate version here is a derivative version with a hole in the center. This one is called MK2. These both work the same, but there's really no need for the hole in the middle. This description should work for both though. After reading some warnings and sad stories from people that bought "cheap" PCB copies on Ebay, I decided to get a MK1 from a reputable supplier that would also give a little back to the creator of the PCB. I didn't find any good tutorial on how to set the heated bed up, so I figured that I'd write how I did it for others to find.

The nice thing about shopping from companies like Ultimachine is that they know what else you need. I also picked up a 100k Thermistor with PTFE sleeving from them to measure the temperature. I also picked up some 100mm Kapton tape for covering the print surface. You can also use thermistors with 10 or 200k resistance or a thermocouple based on AD595. Thanks to Daid's great Marlin Builder, you can adjust your Ultimakers firmware to reflect the correct hardware. Speaking of Daid - if you're not using his Cura software for your Ultimaker - you're missing out Big Time. To me it's been the difference between a good purchase and a bad one!

The Power Supply that comes with the Ultimaker cannot drive both the machine and a heated bed. Due to this, most others have gone the path of adding an additional power supply. Some have even replaced the existing one, but due to the limited space beneath the Ultimaker I had a hard time finding one that could both fit inside as well as provide a decent airflow to keep things cool. What I ended up getting was an external power brick that could deliver 12.5Amps of 12 volt. The PCB only pulls 10A maximum so I figured that would be sufficient. Having two power bricks isn't "sexy", but it does not require any big changes to the Ultimaker's stylish wooden body and it does not add more noise. Also - they had one at my local computer supply store, so I could just pick it up. It's a little pricey at GBP100 / $150 but I still like the solution.

So I had the heating element, a way to power it and a way to measure the temperature. Now I just needed a way to turn it on and off when required. I was thinking of building my own solution, separate from the Ultimaker. The Streacom PSU had both 5v and 3.3v so I could easily add an Arduino Mini to control the heated bed. I would need a screen or at least one 7-segmentd display, some buttons for control and with this I could even pimp my Ultimaker by letting this control some RGB LEDs. Yeah. That's what I'll do! I ordered a bunch of components from Adafruit and Sparkfun, but as I waited for these it started to annoy me that I couldn't combine this with the Ulticontroller.

I started digging and it turns out the Ultimaker PCB had lots of what was needed. There's a connection for the thermocouple and a PWM output with a solid MOSFET… I wonder if that couldn't drive a standard relay for a car? I picked up a 30 amp relay at my local car supplies and it worked like a charm with the 19 volt output of the Ultimaker. I got great help from this Instructable measuring the Relay. The relay cost $6.50 and I also got a nice socket for $4 that I could use for simple mounting and replacement (if required).

This is how the end result looks and below is a tutorial on how to do this yourself.

Bill of Materials

Here's the list of components I've used:

  • MK1 PCB. See RepRap wiki for suppliers. ($50 from Ultimachine)
  • 100k Thermistor ($2.75 from Ultimachine)
  • Streacom 150 watt external PSU ($150 at my local PC store)
  • 360 watt industrial type PSU from Ebay ($50 with shipping)
  • Relay + relay socket with cables. Make sure it's a 5-pin one, so it's both open/closed. ($10.50)
  • ATX 24 to 20 pin conversion cable ($8 at a local computer store)
  • 25 x 25cm plywood piece, 10-12mm thick, as flat as possible ($2 at a woodshop)
  • 24 x 24 cm sheet of 4 mm glass with 4 holes spaced 209mm apart ($30 at my local glass-shop)
  • A 4.7k resistor
  • A few 3mm o-rings (rubber gaskets) that fit the holes in the glass sheet
  • Four 4-6cm, 3mm bolts
  • Some 3mm nyloc nuts, washers and other spare parts that came with your ultimaker
  • Kapton tape

Tools

  • multimeter
  • basic soldering kit
  • Drill
  • Having an Ulticontroller is a huge plus for reading the temperature

Alltogether, the cost for my heated bed was about $150. I also could have saved a little by not getting holes made in the glass but rather use bulldog clips like Josef Prusa did. That would have saved a few dollars as well, so the total cost could have been as low as $100. Also note - these prices are from Norway ( = everything is expensive) so your bill will probably be lower than mine.

How

So - how to put this together then? It's not hard at all and I've also made some custom 3D parts to make it easy to mount the hardware.

1. Print the adjustment screw pieces

Printing these before removing the old build platform will save your fingers later on!

2. Drill 8 holes in the plywood square

Make 4 holes (3mm) that match the position of the adjustment screws of the original build platform. Then make 4 holes that match the position of the holes in the PCB. Make sure you drill all these very precisely or it won't fit.

3. Remove the old platform

Remove the acrylic and unscrew the screws. Save the screws as you'll use these later.

4. Mount the new adjustment screws

Take one long screw, one nyloc hex nut and one plastic screw-handle (eye-shaped) and put these together. These provide a solid adjustment screw for the bed and the screw-handle makes them much easier and precise to use than the hex-wrench. Once all four are put together, screw them into the delrin holes - but this time screw them in from the bottom. Using an electric screwdriver/drill is recommended. Tiresome!

5. Mount the PCB on the Plywood

For this, you can use the old "adjustment" screws. I put a hex-nut between the Heater PCB and wood, and another hex above to keep things in place. On top of this, I added a washer. In the picture below I've also added the springs from the old setup. Don't do this. It was just an experiment. O-rings are smarter.

 

6. Mount the Thermistor

It is nice to have a way to measure the temperature before you hook the Heater PCB to it's power. There are two things to do here. First you need to solder a 4.7k resistor on the Ultimaker's PCB. Unscrew the Controller PCB and take it out of the machine. The resistor should be added where it says R4 on the Controller PCB.

Next, make two wires that are about 70 cm long. These should be of the standard, thin type used in the rest of the machine. Guide the cables down through the rear, right cable duct. Connect these to the outer two pins on the connector marked "Temp 3" (as shown in this picture). Next, put the fan-thingie back on the Ultimaker Controller PCB. If you forget this, you'll easily destroy it.

Connect the other end of the wires to the Thermistor. I used a 2-pin terminal block as the thermistor can be hard to solder due to it's ability to withstand high temperatures. Now it's time to turn on the Ultimaker and test it! To do this, you'll need a custom firmware version. I assume you already use Cura for slicing and printing your models? Then you already know that Daid makes some great software! Making the custom firmware is really easy with his Marlin Builder script. Be careful to not adjust anything you don't know what is… Under "Heated bed temperature sensor", select the sensor you got. There are several 100k thermistors in the list, but if your isn't listed (or even marked in any way) just go with the "100k thermistor" option. If you have the Ulticontroller, check that one off the list as well and click the "Build Marlin" button.

At the top of the page there will now be a download link for a ZIP with the windows install file (that I used), as well as the .HEX file itself. Once the firmware is updated, it's time to test! If you have the Ulticontroller, you should now see another temperature reading and if you touch the temperature sensor, the display should change to reflect that you are (hopefully!) warmer than your surroundings. If you want to test it at higher temperatures, stick the thermistor to the printers extruder-head and set a new temperature with the Ulticontroller.

PS: Don't worry about the heat damaging the thermistor. It should be rated for more than 300 degrees and you should not go above 240 to avoid blocking your print head with burnt filament… Just test that the temp is fairly correct up to 110-120 as that's the highest you'll need to go.

7. Mount the relay

Solder a couple of wires (about 80 cm) to the heater PCB. According to this chart, these cables should be no less than 1.3mm thick to carry 10 amps safely. I used 2mm to be on the safe side, but that's probably not required. Guide the cables down through the rear, right cable duct as you did for the thermistor. Don't pull all the cable to the bottom as you'll want to be able to move the Build platform up and down without pulling the wires.

Next up is the Relay. I used an automotive relay since I know that they are made to withstand a lot of power and they are dirt cheap. Any relay rated above 10A(mperes) should be fine as long as the voltage is more or less the same as the 19v the Ultimaker will output. Autos use 12v and are rated for 30A so that should work for most relays.

Measure the relay according to these instructions and make a note of what color the different cables are and what they should do. If you got a relay like the one I got (5 cables), there will be_

  • Two cables where you apply power to close the relay (connected to the Ultimakers output)
  • The two cables that will be connected when the relay is closed (external power goes through here)
  • One unused cable

In the linked tutorial, the first two are referred to as COM and NO. On the relay that I was using, these are referred to as 86 and 85:

Between these, you should be able to measure a connection but the resistance should not be very high. Connect these to the Heated Bed output, close to your Ultimakers power jack.

On my relay (see below) the pin marked 30 is common and pin 87a is the normal position. When I measured these and found a fairly high resistance (as indicated in the tutorial). That meant pin 30 amd 87 should connect when the relay became energized. So by simply connecting one of the cables for the heated bed through pin 30 and 87, the Ultimaker would toggle power on/off as required.

8. Prepare the ATX connector

It's not much that you need to do with the power supply itself, but you'll need to tweak the ATX conversion cable a little. Start by cutting off the 24-pin side of it and then remove the wires you don't need. Since the PSU has some amperes to spare and it's easy to keep the 3.3 and 5v cables, I saved some of these in case I want to add an Arduino for some custom lighting or something. According to what I've read, the pins in the ATX connector are rated for 6A each, so to safely use 10A I connected two grounds and two 12 volt together. 

Yellow = 12v, red = 5v, orange = 3.3v, black = ground (ref)

9. Testing time

Make sure you re-attach the fan over the Controller PCB and then flip the Ultimaker over to normal position. Now you can test if you connected it correctly by setting the heated bed temperature to something above room temperature.

If you are using the Ulticontroller, just select the Heated bed from the menu. If you don't have the Ulticontroller, you will need something that can connect to the printer and send it commands. Both Printrun and ReplicatorG can do this. In Printrun, there's a separate window for entering commands directly. In ReplicatorG, you just make a new file, type the command into the gcode-tab and then send it to the printer as you would when printing. The command to send is:

M140 S70.0

This should set the temperture of the bed to something near 70 degrees. When the Ultimaker reads the Thermistor to be too cold, it will apply power to the Heated Bed output and close the relay. When the relay closed, I could measure a decent resistance from pin 30 to 87, but no longer from 30 to 87a. The connection was confirmed! My next step was connecting it all to the Heatbed PCB, place the thermistor on the Heated bed and test the complete setup.

Note: Since 1.5.4 of the electronics, the Ultimaker has a 55A MOSFET on the heater connection. This should be sufficient to switch the power to the bed directly, but I don't know enough about electronics to confirm this. Using a relay is within my scope of knowledge, it's totally clean and also separates the two completely in the case of an error. It would be great if someone wiser than me could comment if direct switching is now possible!

I tested thoroughly and measured with an IR thermometer what components became hot as the bed heated. On the tiny PCB that distributes and converts power became hot after 3 hours continous heating. It's the square, black component that becomes warm - about 70 degrees. I made a mounting bracket for attaching it to the bottom of the Ultimaker and on this one, I added screw-holes for a 20mm PC fan. These can be bought in any computer supply store. They operate at 12 volt and it keeps the ATX connector at room temperature even when the bed is constantly on for 10 hours or more.

10. Mount it all on the Ultimaker

Once you are sure the electronics work as intended, you can wrap up the build. First, secure the electronics in place beneath the Ultimaker. For this purpose I've made some more printed parts. Make sure that the holder for the ATX-plug-holder is printed in ABS and not PLA (so it handles heat better). You just slide this one onto the connector and screw in place a 20mm fan. Connect the fan directly to the 12v lines on the connector, drill the one missing 3mm hole under the Ultimaker and fasten the holder with some of the 3x10mm spare screws that came with the machine as well as some nylock nuts.

Next, mount the power jack. This requires some drilling to get perfect, but I'm quite happy with the result.

When this is in place and the cables have been adjusted a little, it doesn't look too messy beneath:

You can see the connections more clearly in this image (click for full rez):

I mounted the 4.7k resistor on some header pins to see if I could get more precise temperture readings by tweaking the resistor values. In the end, I ended up going with the 4.7k anyway so I should probably remove the headers and solder it permanently.

Put the plywood/pcb on to the adjustment screws. Cover the glass plate with kapton tape and put it onto the PCB. Adjust the height of the Heater PCB screws, so the top is flush with the glass surface. Add o-rings (rubber gaskets?) between the 3mm screw and the glass. This ensures that the glass lies steady, but still can expand a bit as it gets hot.

Next we need to make sure the bed is entirely level. The standard rule about being able to pull a sheet of paper between the print head and the surface applies. Move the print head around the entire surface to make sure it does not touch the glass/kapton surface.

Adjust the length of the wires for the Heater PCB and the Thermistor. Make sure to leave some centimeters of wire so that the platform can move all the way up/down without pulling the cables.

That's it. Set the temperature of the bed depending on your plastic type and print away!

The result

The Heated Bed works just as intended and I'm very happy to have it all working. Before doing this, I thought that the constant clicking of the relay would drive me crazy bt it's really no problem. The printer itself is so loud that it's merely a drop in the ocean. The setup has been working non-stop for almost two weeks now. For PLA printing, it's simply fantastic. Models stick like glue when the platform is at 70 degrees, but come loose very easily when the platform cools off.

For ABS, it works but it's not perfect. It takes about 10 minutes to get up to 100 degrees. This is decent, but quite a long time. To get to 110, it's even longer and I can just barely go beyond that. The thing is that I need the bed to go to 110 and maybe also 120 for the ABS to stick properly. Now, it works fine for models that have a large area of contact, but smaller models often come loose since the plastic isn't sticking well enough. Due to this I'm now experimenting with closing the gap around the build surface using high-temperature silicone. This looks good so far, but I'll update here once I get to test a little more.

Update June 23rd 2012:
Closing the gap around the Heater PCB gave no measurable effect! Have to say I'm a bit stunned by that one. It takes just as long to get up to temperature and it's just as hard to go higher. I guess that means that my Power Supply is too weak. I'll test this with a computer PSU and update here later.

Update July 25th 2012:
Tried with a 450 watt PSU (12V/16A) and found no noticable difference. Could it be that I need to bundle the two 12V lines? Thinking aloud: 12V * 16A = 192 watts. Multiplying this with two seems like an idea, but I'll need to find documentation on how this PSU (KDM-1UFX425) is built then. I don't want to start a fire...

Update 3 August 2012:
Turns out that my idea of maintaining some distance between the glass and the PSU wasn't such a good idea after all. When testing with a different PSU today, the glass cracked since the glass was bigger than the PCB and thus wasn't heated equally. I have a spare 20 x 20 cm glass that I'll fix to the PCB with bulldog clips like all others do. I have those already.

Update 5 August 2012:
Turns out I simply did not have enough power. Instead of using the 120 watt Streacom PSU, i will be using a 360 watt industrial type PSU (12V / 30A) that I got from Ebay for about $40 (plus shipping). You can see this PSU in the image below. The drawback of this one is that I sort of have to deal with 220 volt, but it's quite well protected so it's not scary in any way. I will also have to print some feet for the Ultimaker before mounting this permanently as it's a little too tall (5cm), but it'll fit nicely just behind the front of the machine. This PSU also has the extra power to drive LED's and such so I can now "pimp" my Ultimaker a little more ;-)

 

 

RGB LED - Common Cathode or Common Anode?

05 Mar12

RGB LED - Common Cathode or Common Anode?

One of this things I initially found odd about electronics is how it's not really about the 5V plus and ground, but rather the difference between plus/minus. Some components like diodes and electrolytic capacitors will only allow power to flow one way, so direction matters when you're ordering your RGB LEDs.

For my cube project, I've gotten some nice, diffused 10mm RGB LEDs but I didn't really pay attention when I ordered them, so when I started playing around tonight I was fumbling with what to apply to wich LED leg. So for future reference - here's the rule:

  • A RGB Common Anode LED should have it's longest leg (leg 2) connected to the 5V pin on your Arduino (Current sink)
  • A RGB Common Cathode LED should have it's longest leg (leg 2) connected to the ground pin on your Arduino (Current source)

In both cases, you'll connect the R, G and B legs of the LED to IO pins on your Arduino through some suitable resistor (200-330 Ohm) to not burn out the LED. So when should you get what version? Your Arduino can drive a couple of RGB LEDs, but you only have 7 PWM channels and you can't draw more than 40mA from each of these. If you want to drive more LEDs using for example shiftout, you'll need custom driver chips like the TPIC6B595N (that I've used before). This chip can only SINK power, so you should use it with Common Anode LEDs. In other words, a little research may be required.

Most of the tutorials you'll find out there are for Common Cathode RGB LEDs, but I eventually found one showing the Common Anode setup as well.

 

The economics of electronics

19 Feb12

The economics of electronics

I loved doing my first LED cube prototype and I want to take it to the next step - towards a feature complete version. For this I will need a chip to hold the software and control two RGB LED's as well as the sensor that I'll be using for user input. I've looked at specialized PWM chips that can control the different channels of RGB LEDs but in the end it's both cheaper and easier to just use the chip that the Arduino platform is based on - the Atmel 328's.

If you buy more of these, the price improves a lot. If you order enough, you'll actually get it near half the price of just a single one and this seems to be a rule of thumb for electronics in general. This is the difference between mass production and one-offs. If you sell enough of anything, you can make a lot more money.

MintDuino on the cheap

So what do you need to make your own Arduino then? Some time ago I picked up a MintDuino from MakerShed. It's a fully working Arduino - delivered in an Altoids tin (pictured above). This version comes with a breadboard, but how much would it cost just to get just the electronic components used? The content of the MintDuino box is almost the same as this list on the Arduino site that tells what you need to build your own minimal version.

So - what would it cost to build this using todays prices from Mouser.com? Here's the list for 1, 10,100,1000 and 10k units:

  1 10 100 1000 10000
22pF capacitor 0.249 0.249 0.195 0.143 0.104
22pF capacitor 0.249 0.249 0.195 0.143 0.104
ATMEGA328-PU 3.05 2.95 2.52 2.30 2.15
16Mhz crystal 0.529 0.455 0.27 0.227 0.208
7805 regulator 0.652 0.563 0.49 0.276 0.220
10 uF capacitor 0.109 0.073 0.06 0.055 0.046
10 uF capacitor 0.109 0.073 0.06 0.055 0.046
220 Ohm resistor 0.02 0.02 0.02 0.01 0.01
220 Ohm resistor 0.02 0.02 0.02 0.01 0.01
10K Ohm resistor 0.02 0.02 0.02 0.01 0.01
5mm LED (red) 0.086 0.079 0.063 0.052 0.044
5mm LED(green) 0.086 0.079 0.063 0.052 0.044
Tactile switch 0.162 0.14 0.097 0.078 0.071
 
Total price in $ 5.34 4.97 4.07 3.41 3.07

* I've since learned that apart from the lower price the ATMEGA328P-PU uses less power, thus the extra P in it's name. These are about $2.5 extra a piece, but probably worth it given the lower power consumption.

So - if you manage to sell 10k units, these will cost 57% of buying a single one. I dunno the price of the breadboard and the printed Altoids-tin, but it would seem that Makershed has a decent profit from this. It's still worth the money to their customers since they don't have to source the components and it's a great little project - in a tin. Keep in mind that the list above is just the MCU and the power regulator bits. You'll certainly need a few more bits to actually make something, but it's still facinating that you could build an almost complete microcontroller for just $3.

I don't know for sure, but I think it's sort of a rule of thumb that with the added packaging and parts, most kitmakers should have at least a 100% profit on what they sell. In other words - if it seems to the end user that the parts are about the same price as they would have to pay themselves to make the same, they may just as well buy it from you. So to use the example above - $6 would appear to be cheap for $3 worth of components. You could probably make good money selling it for more such as the neat $13 Diavolino kit despite the fact that a fully soldered Arduino Duemilanove only costs $15.

UPDATE: by August 2013, the prices in the table above have improved a lot, so the ATMEGA above would now be almost a dollar less for volumes above 100.

LED cube electronics

In my case, I won't need the 5mm LED's and the tactile switch in the list above, but I'll need a few other parts. I'll need the tilt-switch to turn the cube on/off, two 10mm diffused RGB LEDs, coin cell battery holders and an input solution. I'm not sure if the vibration switch from Sparkfun will do the job, but I'm quite sure that I can solve it with some sort of touch-chip. These are fairly cheap, but they'll require more testing. Should be fun!

So with all the parts I'll need (apart from the PCB) the electronics for each cube would cost $11 if I make just one, $9.35 if I make ten or if the unlikely happens and I have to make 10k of these - the electronics will only cost $5.55 per cube. I doubt that'll ever happen, but it's still fascinating to do the maths. Plus - if it did - I'd probably outsource the whole thing. I just can't see myself solder even a hundred of these by hand…

They do look pretty though, don't they? ;-)

 

Making a Blinky cube

17 Feb12

Making a Blinky cube

Inspired by various LED cube projects, I wanted to see how long it would take to prototype a small interactive toy. The basic idea is to make a plastic cube that displays beautifully diffused light and uses a simple way to turn on and off. Tapping the cube with a finger could be a good way to do this and it also makes it possible to start different "color cycle programs".

Making the cube

My friend Jim at VariousArchitects (VA) has this really nice Makerbot standing around in our office. It would be a shame not to play with it a little? Maybe I could even find a complete cube on Thingiverse?

Turns out that nobody had done something similar, so I had to make the model myself. Through the years I've played with different 3D programs and lately I've used Modo a lot. After fiddling a while in both Modo and Sketchup, Kyrre @ VA suggested that I try Rhino. My friends @ pivot.no have always been big Rhino proponents and after some initial fiddling, I really started to like the software! Poor Kyrre had me pestering him with noob questions all eve, but the result turned out quite nicely?

Breadboarding the prototype circuit

Next I needed to make a small test circuit to see that I could fit the electronics. The final version will use some sort of ATMEL chip, but since the hardware is still on it's way (switch from Sparkfun and RGB LED's from Evil Mad Science) I had to just throw something simple together that would show me how the LEDs worked with the materials.

Using my newly aquired knowledge about the 555 timer, I set up a small breadboard circuit that toggles two LEDs. I added a couple of 10k pot's so I could change the blink speed. Looks like this would work fine?

Making it smaller

I can't fit a breadboard in the cube, so I made a copy of the circuit on a little piece of perf-board that I thought would fit inside the cube. It took a couple hours to fit it all, but I only had one incorrect solder (the 555 was the wrong way, duhh) so it wasn't all that bad. It also turned out quite small.

The blue dials are the pot's that'll adjust the blink-rate and the black tube on the top is a tiny switch that'll turn the circuit on/off based on the physical orientation.

Putting the pieces together!

Kyrre had printed the bottom of the box that evening so when I came to the office the next day - all that was missing was the lid and some batteries for the circuit. While the lid printed, I mounted two 3V coin cell batteries together (the 555 needs at least 4.5 volts to run) using some Gaffa-tape and wait for the lid to finish printing. The lid required that the Makerbot made some "supports" - extra plastic that you remove when the print is finished. I'm amazed by how easily these supports came off and the pieces looked really good! Now it was time to fit it all together.

The result

Below you can see a video of the completed bits. The LEDs are not very visible inside the box while it's daylight but they look lovely when it's dark. The video is a little blurry since I just used my iPhone, but it shows the result quite well. Very happy with it given that it's only taken about 1.5 days to get this far! Makes me feel comfortable taking the project to it's next step - using RGB LEDs that can run different programs and turn on/off with just a tap.

Thanks a bunch to Kyrre for helping me with Rhino and the printing and to Jim for letting me play with his toy! I've also uploaded the 3D model to Thingiverse in case anyone needs something similar. I've also posted some more pictures of this on Flickr for anyone curious to see more.

 

 

Racing along with Make:Electronics

15 Feb12

Racing along with Make:Electronics

Finally had a long day without other interuptions than snowboarding and dinner. Not shabby! Made the quiz-engine in Experiment 21 and even modified the layout so it was more user friendly. A tad annoyed that there's no breadboard-friendly SPDT-switch (single toggle between two states) in Make:Electronics Kit 2. I had some lying around, but it'd be nice if the kit was really complete and everything working. The two dead 5V relays yesterday were also annoying.

Experiment 22 was just a quick primer, but experiment 23 was a good reminder about how super-easy it is to use microcontrollers rather than IC's to solve a problem. While it's possible to represent a dice with 7 LED's using clever wiring, a counter chip and a NOR chip, it would take much more effort to take this to a complete LED dice kit. It's much, much easier to solve such tasks with a small computer like this one from SpikenzieLabs. It's still useful to see how this would be solved before, so I'll complete all the experiments as there's always something to learn from them.

Have also started to publish images of the finished and working experiments on my Flickr account as seeing pictures there saved me a couple times when I started out. A tiny effort that can help others a lot. Below is video's of todays projects.

 

Make:Electronics - Experiment 20

14 Feb12

Make:Electronics - Experiment 20

Lot's of stuff to do other than play today, but I managed to finish experiment 19 - a "code lock" based on the 74xx series of chips. This part of the training is sort of a "repeat" in that I've read it so many times during school, however building circuits with it makes it a lot more fun. I couldn't complete the project entirely as the relays I got from Make didn't work at all (same for others) but the main part works like it should.

Really looking forward to tomorrow - I should manage at least two more experiments! :-D

Make:Electronics, experiment 18

13 Feb12

Make:Electronics, experiment 18

Was able to spend about half the day on electronics today and did experiment 18 from Make:Electronics. Nice to learn about counter chips (4026) and 7-segment displays, but I really didn't want to do all the cabling for setting up 3 of these as I got the point. Hooking it up to a 555 timer went easy and I later added a pot and some resistors so I could adjust the speed just as I wanted. I also spent a lot of time just playing with components and measuring to see how things worked and how precise my meter was.

In the evening I got sucked up, browsing the Sparkfun and Seeedstudio sites for component bits I was missing and ended up ordering a bunch of stuff while I was at it. Anyone running an online electronics shop should learn from these. Having a "wishlist" feature made me order almost twice as much as planned…

Reading specs carefully before ordering…

Among the things I ordered were two RainbowDuino's from SeeedStudios. I already have two 8x8 RGB LED panels from them, but after a lot of browsing I realized that none of the chip vendors offer a good solution for driving these. I wonder why there's no I2C or SPI chips that do PWM for more than 24 channels? The best circuit I could find were the TLC5951 from TI and I would have to use eight (!) of these $5 SMD's just to drive one of the panels. Since they're SMD you would also have to make your own PCB, so it's much easier to just get the premade $25 solution from SeeedStudios.

Some time ago, I browsed the Sparkfun site and saw these awesome rubber buttons. I was SO bummed out when I got the shipment and realized that I had only ordered the rubber part - not the PCB, electronics, plastic covers or RGB LEDs. In a few days I'll have the complete 4 x 8 button pad here - at the total price of $136 and not the $19.90 that I initially thought. Now I'll just have to figure out what to use it for ;-)

Oh - and please do check out my brand new App - Arduino Companion!