Introduction: The Small Hadron Collider
So you can't afford a Large Hadron Collider of your own? No, I can't either. Anyway, where would I put it? I've got enough clutter around here already.
So I decided to build a Small Hadron Collider, and now you too can build one of your very own! You can watch it in action here:
Watch the particles zip around the track and help them on their way, if you like, by tipping it one way or another. Watch them collide and interact in different ways, and eventually decay.
But what is the significance of the different colours and brightnesses, and how many different ways can they interact and decay? And can you spot an elusive particle of Dark Matter? There's a challenge on to see who can deduce the physical laws that control the particles, but until then, the source code remains a tightly guarded secret!
For best results you'll need the big 60 pixel Neopixel Ring from Adafruit (Far Eastern WS2812 clones should work though I haven't tried), but if you're on a budget you can use any smaller size, which the firmware will detect down to 12 pixels. The 24 pixel ring is a good compromise but will only show 2 particles at a time.
If you've already built my Glowy Disco Badge then this project uses the same hardware. All you'll need to do is load the firmware, and if you like, fit a larger Neopixel ring.
Step 1: The Parts You'll Need
You will need the following active parts:
- Arduino Pro Mini (5V 16MHz)
- MPU-9150 Accelerometer and Magnetometer
- Bidirectional 3.3/5V level converter.
Make sure they are as illustrated otherwise you will have to modify the layout. In particular, there is more than one type of level converter. The one I use is a 4 channel one (though we only need 2 channels). It has LV and Gnd as the middle two pins on one side, and HV and Gnd as the middle two on the other.
All of the above can be obtained cheaply from Far Eastern sellers.
There is a cool alternative MPU-9150 device from Drotek which includes an on-board level converter. This would make a neater finished product but at a higher total cost. You would also have to modify the layout and wiring (take SCL and SDA direct from the Arduino instead of through the level converter), and use the alternative firmware in Step 7.For the display you will need:
- Adafruit Neopixel Ring.
(There are similar but cheaper rings also based on the WS2812 chip or a clone, available from Far Eastern traders. These might work equally well but if you get a faulty one you might find it harder to get satisfaction from the seller.)
You will also need the following miscellaneous items:
- One piece of 65x95mm stripboard
- Solid and stranded connecting wire
2.54mm female SIL header socket strip.
There are many different ways you could mount the ring and house the electronics. Mine is very cheap and cheerful and not particularly to be recommended. (I'd spent all my pocket money on the Adafruit Neopixel ring.) I had a piece of 1/4 inch plywood left over after cutting a hole in the back door for the cat flap, which happened to be just the right size. A piece of acrylic would be much nicer, and if you use white or frosted or simply put a sheet of paper between the ring and the acrylic in front it will nicely hide the individual WS2812 pixel chips and diffuse their light somewhat.
Step 2: Tools
You will need to be able to solder, but that's not hard - there are plenty of Instructables and other materials online to get you started, such as this brilliantly simple and entertaining tutorial from Technology Will Save Us (though the safety instructions are a bit excessive and you don't actually need an expensive soldering iron).
For tools, you will need wire cutters, wire strippers, small pliers and a stripboard track-cutting tool, though with care you can use a small craft knife or scalpel. And of course, you'll need a soldering iron.
For programming you will need an FTDI232 serial/USB adapter and you will need to install the Arduino IDE on your computer.
Step 3: Adding Power
There are two ways of powering your Small Hadron Collider. If you have a rechargeable lithium power bank with a USB socket as designed for recharging a smartphone, you can use that. Get hold of a cheap USB charging or sync cable and cut off the unwanted connector. You can then solder the cut end directly to the stripboard, having made sure you correctly identify the 5V and Gnd wires.
The cheapest alternative is a 3V battery box taking 2 AA batteries, plus a 3 - 5V boost converter. If you use a converter (as shown) with a USB socket you can use it with a USB lead as above. Solder the red and black wires from the battery box to the IN+ and IN- pads (respectively) on the boost converter. Wrap them around the opposite end of the boost converter for strain relief, then insert it into a piece of heat shrink sleeving for protection. Warm with a hot air gun or hair-dryer to shrink the sleeving. Or you can wrap it in PVC insulating tape.
Step 4: Construction - 1
You can use the stripboard as it is, but we won't be needing it all so if you like you can cut it down to have 32 holes along the length of the copper strips and 20 holes across its width.
Using a stripboard track cutter or craft knife, cut the copper tracks at the positions marked by red dots in the diagram. To avoid mistakes you might like to mark the positions with a felt tip pen before starting to cut. (The components and the wiring to be fitted to the other side of the board in the next step are shown at 50% transparency.)
Before continuing, it's a good idea to examine the board with a magnifying glass to ensure that there are no remaining slivers of copper bridging any of the cuts, or bridging adjacent tracks.
To simplify programming, solder the SIL header socket strip to the 6 pads at one end of the Arduino Pro Micro (component side).
Cut 2 lengths of solid core wire around 3cm long, strip the insulation from one end of each, and solder them to the two pads inset from the side of the board, either side of the pad marked A3. Solder them on the under side of the board. (These pads are harder to solder to after the Arduino is fitted to the board.)
Step 5: Construction - 2
Solder the Arduino Pro Mini, IMU and level shifter to the stripboard as shown in the diagram as follows.
Strip a few centimetres of insulation from some solid core connecting wire. Place the Arduino Pro Mini in the correct position on the board and thread the wire through the board and then through the Arduino at one of the positions marked by a purple dot. Solder the wire to the Arduino on one side and to the copper strip on the other, making sure the Arduino is seated flat on the board. Trim the wire on both sides.
Repeat for all the other purple dots on the Arduino, and then likewise for the IMU and the level shifter.
The two wires soldered to the Arduino in the previous step can now be trimmed to length, the ends stripped, and soldered in position as shown in the diagram.
Using the solid core wire, complete all the other connections shown in purple.
Solder the positive and negative leads from your USB plug or boost converter to the copper tracks marked Vcc and Gnd respectively.
At this point it's a good idea to double check your wiring, and that you don't have any slivers of solder bridging adjacent tracks.
Step 6: Construction - 3
Connect the NeoPixel ring. You can use solid core connecting wire but stranded is probably better. I like to use just 4 strands of rainbow ribbon cable. The length will depend on how you are mounting the board and the ring.
All NeoPixel rings have just 4 connections marked Power (or Vcc), Gnd, Data-In (or IN) and Data-Out or (OUT). If using ribbon cable, split the wires at one end sufficiently to reach the NeoPixel connections. Solder the 4 wires (or 4 separate lengths of connecting wire) to the 4 NeoPixel connections.
Now solder the other ends of the wires to the stripboard as shown by the green connections in the diagram in the previous step.
The diagram shows a schematic of the completed project.
You are now ready to mount the board and the ring in whatever way you have chosen. Note that the ring and the components on the board must face in opposite directions. (On mine, they are fitted to opposite sides of the piece of plywood.) Also, the first pixel in the ring (fed directly from the D-IN connection) should be at the top (with the board the way up shown in the previous steps).
Step 7: Programming
For this you will need a FTDI232 serial/USB adapter. (If you have an Arduino Uno you should be able to programme it with that instead, but I'll have to leave you to work out how for yourself.) I assume you'll be using a Windows PC or laptop, though you could use a Mac or Linux by modifying this step.
You will also need the Arduino IDE installed on your computer, which you can download from the Arduino Download page. Check that it's installed in C:\Program Files (x86)\Arduino. If not, you will have to modify the file path at the end of this step.
Finally, you will need to know which COM port the FTDI adapter is using. If you don't know, launch Device Manager (from the Control Panel) and select Ports (COM & LPT). In my case, I get a line "USB Serial Port (COM10)" but you may get something different from COM10. Note what it is.
There are 2 versions of the firmware provided. If you're using the same or similar MPU-9150 board to the one shown in Step 1 and you followed my wiring, download the attached file SHC.hex to your Downloads folder.
Should you be using the Drotek MPU-9150 board or any other which uses address 0x69 instead of 0x68, or if you wired AD0 to 3.3V in order to allow you to add a DS1307 real time clock for other applications, then download the file SHC-0x69.hex instead. Use this file name instead of SHC.hex in the last command below.
Now launch a command prompt (If you're not sure how, check out this article.) You should get a prompt such as:
(but with your login name instead of mine). Type the following commands. If your COM port isn't COM10, substitute your COM port in the first command, and if your Arduino IDE isn't installed in the same folder as mine, substitute your install folder in the second command.
set COM=COM10<br>set ARDUINO=C:\Program Files (x86)\Arduino<br>cd Downloads<br>dir
Check that the downloaded file SHC.hex appears in the file listing generated by the last of the commands above.
You are now ready to upload the code and start your Small Hadron Collider working! Make sure your FTDI adapter is plugged in to the Arduino and to your PC, copy the following command and paste it into the Command prompt. (To paste into a Command prompt, right-click on the title bar and select Edit - Paste.)
"%ARDUINO%\hardware\tools\avr/bin/avrdude" -C"%ARDUINO%\hardware\tools\avr/etc/avrdude.conf" -v -patmega328p -carduino -P%COM% -b57600 -D -Uflash:w:SHC.hex:i
You should see it writing then reading back the hex file, after which your Small Hadron Collider will spring to life! The FTDI adapter will power the board initially, but after disconnecting it, it will require its own power supply.
Should you just get rotating patterns, this means the Arduino has been unable to communicate with the IMU. Check your wiring. If you used a different MPU-9150 module it could mean that it uses address 0x69 instead of 0x68, as does the Drotek module. Try using the alternate firmware SHC-0x69.hex instead.
Step 8: Going Further
As I said earlier, this project uses the same hardware as my previous Instructable, the Glowy Disco Badge, optionally with a different size Neopixel ring. You can very easily reprogramme it with the firmware for that.
Once someone has cracked the physics of the particles I will release a set of source files, which optionally incorporate both functions.
If you want to use it with different size Neopixel rings, you can connect them to the stripboard with a 90 degree pin strip on the board and female jumper leads connected to the ring. A great feature of this project is that it automatically detects the size of ring in use by counting pulses for missing pixels on the data-out line. But you must double check you've connected it correctly before switching on otherwise there is a risk of damaging the ring.
Adafruit recommend connecting a 1000μF 16v capacitor across the power connections to the Neopixel ring (negative side to Gnd) and a resistor (220Ω should do) in series with D-In. I've never found these necessary but should you get unreliable operation, certainly try the capacitor, and additionally a 22nF capacitor between Vcc and Gnd on the board. Try the resistor as well if you like though all I can see that that would do is reduce the likelihood of damage if you connect the ring incorrectly.