Building a Van der Graaf Generator from Ikea Parts

My son Pioneer has been going to Rock-It Science camp.  He loves it SO much.  He calls it “make it and take it” because he gets to build a lot of things and bring them home.  When he heard they were going to have a Van der Graaf generator, he assumed they were going to be building them and bringing them home.  He was rather disappointed when he found out they were just going to watch one in action. I cheered him up by telling him we could build one ourselves.

Of course I don’t know why I’m building this thing. I do not like electrical shocks. When I was in college, I worked at The Mellon Institute of Battery Technology (MIBT), and I spent enough time troubleshooting weird electrical devices that I would sometimes get shocked. I realized I was using classical conditioning to make me not like my job.  If instead the devices had been handing out food pellets, things would have been a lot nicer.  Building a device that is pretty much guaranteed to dispense a fair number of electrical shocks seems on the face of it to be a bad idea.

Bowl About To Be CutWe did have some cool stainless steel bowls from Ikea that had been been whispering to me about how they wanted to be high voltage electrodes.  I decided to take a trip to Ikea specifically to shop for Van der Graaf Generator parts.  And thus the Van Dö Kraff project was born.  I was originally going to go for the 11″ bowls like we had at home, but when I got to Ikea I couldn’t help but notice the awesomeness of the giant 14″ bowls.   I also wanted to get some sort of base for the project and saw that they had a nice wooden lazy Susan that was just the right size to go with one of the bowls to make a base.  Plus who can say no to a Snudda!

I had a secret reason for wanting to get the lazy Susan.  In order to build the generator, I’d have to cut a hole in two of these great big bowls.  They were never going to fit in my lathe, and although I could cut the holes out by hand, it would be somewhat sloppy and imperfect.  I realized that if I had a lazy Susan I could use that as an improvised lathe.   This lathe -e- Susan worked super well. Here’s what we did:

Bowl With HoleCenter the bowl on the lazy Susan using fun tack.  I just spun the bowl and used my finger to find the closest point to the edge and then nudged the bowl over until it was running without a lot of wobble.   Then I mounted a cutting disc in the Dremel tool and brought it in contact with the bowl tangent to the circle I wanted to cut out. The spinning of the cutting disc caused the table to spin, making the disc cut a perfect circle.  My son helped me with this by using his finger as a drag to keep the bowl from spinning too fast.  He also helped once the disc had cut though in some areas by turning the bowl around manually to the parts that hadn’t cut though.  I used up 4 discs cutting the first hole and 3 more doing the second.  I think with a little practice you could get it down to maybe 2, but you have to be very careful when the disc first cuts all the way though.  It’s very easy to have the discs shatter then.

My son loved the exploding discs.  He thought that was the best part!

Once the hole is fully cut out, you can switch to a sanding drum to smooth out any sharp burs and presto!  Perfect holes!  I used two random boards and a clamp to make an improvised steadying rest for my Dremel tool.  Here’s a short video showing the cutting.  Remember to keep the discs level and tangent to the cut.

Test Fit of the Column in the BaseAs you can see, you can get a very close fit using this system.  I used a Sharpie to make lines and test with the piece of pipe until I was close, and then just double checked the size once I got a groove started.  Be careful to approach the line you want from the inside since you can make the hole bigger but not smaller.


Here’s ElectroMan declaring the very first stage of this silly project a success!

Cat Door Project Comes -a- Knocking

bobertLookingExpectantOur cat likes to go out at night and his comings and goings cause us to lose a little sleep opening the door for him.   He has never put up with a collar, so I got an automated cat door that can read his imbedded ID chip so only he can get in.  I read in the Amazon reviews that the chip reader worked well, but that raccoons could learn to open it from the outside.  We live in the boonies with lots of raccoons and other critters, so I knew that was going to be an issue.

catFlapWithMotorizedCatchThe problem seemed to be that the chip reader could dynamically keep the door from being pushed “in”, but cats were free to push the door “out” from the inside.  Only a magnet keeps the door from going out.  The door is shaped to make it hard to pull it out from the outside, but apparently raccoons can manage it.  So I thought “I’ll add a beam break sensor and some extra locking so the door can’t push out unless my cat’s head is breaking the beam.”

A system like that would require an Infrared emitter detector pair and some electronics. I started designing it, and the design consisted of two timer chips, a bunch of resistors/capacitors some transistors, diodes, etc. I wanted it to fit into a pretty small space since I would have to integrate it into the existing cat door enclosure.   For a long time  I’ve wanted an excuse to try out some of those super tiny programmable CPU’s.   They come with internal clocks so you can get away with very few external components, and you can tune the behavior in software.   This cat door seemed like the perfect opportunity to give them a try.  Time to lose some sleep in the short term to try to gain some sleep in the long run.

railOfChips I decided on the ATTiny85 because it has 8k of program space, features a wide selection of internal timers/interrupts/analog to digital converters, and cost only about $.85 each.  They’re the kid brothers of the chips used for Arduinos. They use the C programming language and have GCC as the compiler. This sounded like very familiar turf.  I ordered 25 of the little guys to get the lower price point, make sure I had plenty of extras, and avoid the embarrassing situation of paying more for shipping than for the parts themselves.

USBTinyISPInPiecesSmallerUSBTinyISPAssembledI also ordered a USBTinyISP In Circuit Programmer that you get in kit form.   This past weekend the parts came, and I soldered up the programmer.   It’s all through-hole components and was pretty easy to put together.  They have a detailed step by step build of it documented on-line, although I personally prefer just a parts list and a population diagram.   There’s less scrolling around, and if you don’t happen to have a computer near your soldering area, having a giant scrolling assembly document is unwieldy.

ZIFprotoboardI also soldered up a board that has a Zero Insertion Force(ZIF) socket that wires the programmer to the program pins on the ATTiny85s.

I then downloaded the USB device driver for the USBTinyISP and the WinAvr tools, which include the compiler and a tool called avrdude that can use the ISP to program the chips.   By the end of that day, I managed to get avrdude to talk one of my tiny chips.  So far so good.

schematicForProgrammingHere’s a schematic of what I wired up to be able to program the chip.  The 6 pins of the programmer header are shown from above.

It wasn’t until the next weekend that I got a chance to try to run some code on the chip.   For the cat door project I need a 38khz signal to drive the Infrared LED.   That is because the IR receiver filters out all non 38khz signals so it can reject ambient light level changes and all kinds of other noise in the signal.   This is how pretty much all IR remote controls work and that’s why you can get a fancy receiver that does all the filtering for  cheap. Be careful when choosing a receiver module. Since they are used for IR data transfer, many of them can’t handle continuous 38khz signals.   If you just go get the receiver at Radio Shack, you’ll have to use bursts of 38khz to keep the receiver paying attention. That’s code complexity I’d like to avoid.

The ATTiny85 has timers/counters that can be set up to drive an output pin directly so I can setup the LED and forget about it.   That’s much nicer than trying to toggle the pin myself with a bunch of interrupts or code loops.   I found a nice overview of ATTiny timer programming and read though that.  I then read the ATTiny85’s datasheet to figure out exactly how to set it up on my chip.  With a full understanding of the chip, I should be able to avoid an unintended Rise of the Machines.  I did, however, only skim some parts of the datasheet ,so if you get word that I’ve been mauled by raccoons, head for the hills.


Sorry this is so small

To set up the timer, there’s really only 3 bytes you have to fiddle with: two Timer/Counter Control Registers and the Output Compare Register ,which is the 8-bit number the counter compares against.  To have the counter run in a retriggering loop and have it toggle the output pin A each time it matches, I only really need to set these bits, and only two of those are non zero.

COM0A1 COM0A0   
  0      1        Toggle output pin A on Compare Match
  0     1     0   Clear Timer on Compare Match

My first attempt at programming the timers worked, but there were a number of problems:

  1. outputting on the wrong pin
  2. totally at the wrong frequency

The funny part was that my programmer was upstairs in the house, and the protoboard/power supply/test equipment was in the garage.  I had to program the chip, pull it out and hoof it out to the garage.  I went back and forth about 10 times.  Who says hacking doesn’t provide exercise?

attiny85With38kI managed to get the output going to the correct pin. Then I got the clock prescaler turned off so the counter was getting the proper 1 Mhz clock.  Finally I tuned the output frequency in to as close to 38khz as I could get.  The counter counts up to a given number and then resets and toggles the output pin.   I’d originally calculated the count should be 26 since 1Mhz/38Khz is about 26.  Then I realized that the output pin toggles each time the counter is reset, which means the output frequency is actually half of what I was expecting.   So 13 was what I was looking for.   In the end I used 12, since the 1Mhz clock is only approximate (the chips running without a crystal) and it ended up being a better frequency match.  Or it could be that you want n-1 since we’re counting from 0.

What do I think of the 8pin CPU’s VS a pile of timers and discrete parts?

I won’t really know until I finish this project.  At the very beginning, this way has me spending more time installing device drivers, downloading and installing software, and fiddling with makefiles,  etc.     The other way lets you get right to the protoboard but is less flexible in terms of fine tuning the results.   Now that I have the tool chain up and running, the rate of progress has really increased, and the the rest of this project should be less annoying.   Tuning the output frequency might not have been as fast as adjusting a trim pot, but so far the only component I have is the chip!  I really should move the programmer closer to my test bench.

I’m starting to get the sneaking suspicion that I should have just sprung for the AVR programmer that Atmel makes.  It works natively with AVRStudio, which is the free IDE that they produce for their chips.  You can get the USBTinyISP to work with it too, but it sounds like you have to go though some wacky contortions to do it. I think the only real advantage the USBTinyISP has over the native one is that it can also power the external board via USB.  It also has a 10-pin programming header, but since I’m not trying to work with some board that has a 10-pin header, it isn’t much of an advantage.

I think if I were doing complex development with actual debugging, I’d go with the Atmel programmer just because it works natively with AVR Studio.   As it is I’m just doing code dumps without any interactive debugging, so it’s basically:  use your favorite code editor, write the code, and type “make”.   There’s even a make target that downloads the code to the chip, so you end up typing “make program ” a bunch.  Firing up AVRStudio for that would be way overkill.  So for this kind of dev a USBTinyISP is nice since I don’t need an external power supply for my programming board. This WinAVR way is simple, pretty much worked right out of the box, and it’s much smaller and less bloated than an AVRStudio install.

Here’s the code so far.  It just defines what pins I think I’m going to use, sets direction of the various pins, and configures the timer to toggle out of pin 5 of the chip.   In my next installment, I’ll try hooking up the IR receiver    I’ll also start dissecting the cat door, come up with a plan for how I’m going to lock it, and figure out what sorts of feedback and control I’m going to need.  Hopefully I’ll get to play with using the external interrupts and maybe I can even try out some power-saving modes.   I’d really like to put these chips though their paces and get a feel for many of the chips features.   Clearly with 25 of these little guys, they’re going to be showing up in lots of projects.

#include <avr/io.h>
#include <avr/interrupt.h>

#define IR_LED_OUT_PIN    (1 << PB0)
#define MOTOR_OUT_PIN     (1 << PB1)
#define SWITCH_IN_PIN     (1 << PB2)
#define IR_RECIVER_IN_PIN (1 << PB3)
#define OUTER_DOOR_IN_PIN (1 << PB4)

int main (void) {
    // Make it so the input from the switch will use the internal
    // pull up resistor.  Other inputs will have no pullup, and the
    // outputs will all be low.

    // Configure the motor and IR leds as outputs, and all the
    // other pins as inputs.

    // Configure the timer 0 to output on 0C0A with no pre-scaler
    // and so it'll  CTC (count down and auto reset) toggle every time
    // it gets to the compare.
    TCCR0A = (1 << COM0A0) | (1 << WGM01);
    TCCR0B = (1 << CS00);

    OCR0A = 12;  // 1Mhz/38khx = 26.3  Then you have to divide by 2
                 // you have to toggle twice to make the full wave.
                 // so that's about 13.  With my clock 12 ended up
                 // being closer.  No prescaler needed for these high freq.

   for (;;) {

Turning A Magic Wand

Trying out the gripIn the run up to Christmas our family went to Dickens Faire, and my son really wanted to buy a wand at the wand shop.  I told him we could make one at home.   Now that the Christmas rush has passed we’ve finally gotten around to making one.

We chose a length of dowel rod, and I marked the hand-grip section out with a pencil.  Then I put it in the lathe and turned it out freestyle.  We did it out in the driveway to keep my shop from getting full of wood shavings.  I really should put some roller wheels on the end of that lathe.  It’s kind of small but still not much fun to haul out from under the workbench and lug out to the driveway.

Hand on Wand

My son tries the wand’s grip to test the comfort level.

I couldn’t find all my turning tools, but was able to track down a big gouge and I made do with some chisels I had around.   My son seemed to enjoy the process.  He was amazed at how the dowel seemed to stand still after the not-so-centered wobbly parts were turned down and it was running true.  The wand is not going to win any awards but he can hardly put it down.

This summer we dug for Herkimer Diamonds and we’re planning on gluing one to the tip of the wand.   I also will try to make  a secret compartment in the handle by cutting that trailing ball off, center drilling, and re-attaching with a dowel.   Lord only knows how I’ll hold the wand in the lathe for center drilling.   I guess I should have though of that first.

Making Custom Moomin Pastry Cutters

moomintrollAndLeafEvery year I do some sort of Big Christmas Project.  This year I decided to keep it kind  of low-key.   We have some pastry cutters in the shape of leaves.  They’re nice because they let you stamp the veins of the leaf on, and cut the leaf out in a simple sequence.  When we make pie we often also make “Cheese Leaves” from left over crust so the kiddos can have some fun stamping them out, and sprinkling on cheese.  That way they also get a tasty snack long before the pie itself is done. I thought it would be nice to make some of these awesome cutter/stamper in more personalized fun shapes.

I’m a big fan of  Tove Janson.   My mom read me many of her Moomin books when I was a kid, and I have in turn read them to my kids.   Tove Janson’s illustrations are fantastic, and The Moomins have a nice way of dealing with life.  When a flood traps them on the second floor of their home they don’t moan and complain.  They cut a hole in the kitchen ceiling and marvel as seeing  that room from a new perspective.  They take turns diving for breakfast fixings.   I decided it would be fun to make some Moomin themed pastry cutters.

I knew I could make food safe parts out of laser cut acrylic, and I went to work in illustrator making a prototype out of clear acrylic scraps.  I had to see if quarter-inch acrylic could be stacked and glued to make the fairly deep cutter.  Here you can see the rough initial prototype of the Moomintroll cutter next to the commercial maple leaf that inspired this project.