A DNA Lamp That Uses the Full Genetic Code of Humanity

by DavidF6 in Circuits > LEDs

397 Views, 6 Favorites, 0 Comments

A DNA Lamp That Uses the Full Genetic Code of Humanity

This Lamp Uses The Full Genetic Code Of Humanity
Cool Patterns On My DNA Lamp
IMG_7742.jpg

This LED lamp lights up the room with the full genetic code of humanity. It slowly reads off the DNA code from an SD card and displays the genetic base pairs as colors that move up through the helix. The four bases—A, T, G, and C— are represented as red, purple, green, and blue respectively. It has a power button as well as speed and brightness dials on the base. For the helix structure, I tried to make the proportions as close as I could to actual DNA. It's a fun lamp to get lost in thought staring at. Because there are roughly three billion base pairs, it takes a long, long, long time to go through the whole thing.

One known issue

At its fastest speed, it should be showing a new base pair every 2 ms. In reality, it's moving a lot slower than that.

Originally, I had a whole chromosome stored in a single text file. The Arduino would read that file, and then move to the next chromosome/file. I noticed that over time, it seemed to be getting slower, and indeed it was. I suspect the reason for this slow down is that the code to find the next letter is having to sort through all the previous letters. This doesn't take very long when it's at the beginning of the file, but when the next letter is a couple MILLION letters into the file, it takes a second to find it.

In an attempt to fix this problem, I altered things so that instead of a whole chromosome stored in a single text file, the chromosome is split up into many, many files (1,000,000 letters a file). Unfortunately, this didn't really fix the slow down problem. Next I tried reconfiguring things so only one chromosome was saved on the SD card at a time. The idea being that the Arduino would read through the files for that chromosome, and when it was finished, the user would replace the chromosome files on the SD with the next chromosome's. This did result in a speed improvement.

Finally, it occurred to me to have the code delete the file when it was done reading it. This also appears to have helped. There's still room for improvement. I'm sure my code can be improved, but the read speeds of the SD as well as the speed of the Arduino might also be constraining things.

I'd say this project is at the level of a beginner who is approaching intermediate. Here's the guide...

Supplies

Materials

  1. LEDs (need 2 strands of 11 LEDs each (22 total))
  2. PLA-- green, grey, and clear
  3. 2x Potentiometers
  4. 1x pushbutton
  5. solderable breadboard
  6. wire
  7. 5V power cable (I used a USB cable and cut it in half so I could solder the wires to the breadboard)
  8. Micro SD card
  9. Micro SD card reader
  10. Adafruit ItsyBitsy 32u4 3V
  11. 3-5x M3x6mm bolts
  12. Power Latch Materials
  13. 1x 2N3904 transistor
  14. 1x FQP27P06 MOSFET
  15. 2x Diodes (pretty sure this is what I used)
  16. 2x 100 kOhm resistors
  17. 1x 270 Ohm resistor
  18. 1x 10 kOhm resistor
  19. 1x 13 kOhm resistor
  20. 1x 12 kOhm resistor


Files (PLA Colors I used)

  1. 1x DNA Lamp Bottom.stl (green)
  2. 1x DNA Lamp Base.stl (green)
  3. 22x DNA Lamp_crossbeam short.stl (clear)
  4. 2x DNA Lamp_pillar base.stl (grey)
  5. 2x DNA Lamp_pillar cap2.stl (grey)
  6. 20x DNA Lamp_pillar.stl (grey)


You will also need expanding/foaming gorilla glue, clear gorilla glue, hot glue, a soldering iron, and tape.

Print Parts and Initial Soldering

IMG_0AFF1EAD1C65-1.jpeg
IMG_4256.jpeg
  1. Print out parts. If memory serves, the Pillars need supports touching the build plate and need a brim.
  2. Solder the Arduino, SD card reader, power latch, and the wires connecting them to the breadboard. The photo shows what it will look like in the end. Don't solder on the input power cable. I based the power latch off this. The power latch is needed so the Arduino can save its spot in the DNA to EEPROM before shutting off.
  3. Clean up the prints.

Assemble the DNA Helix Pillars

IMG_1770.jpeg
IMG_1772.jpeg
IMG_7731.jpg
  1. Cut off a length of 11 LEDs (be sure to cut the wire in the middle between the 11th and 12th LEDs so there is a length of wire coming off the 11th LED to solder to).
  2. Thread these LEDs through 10 Pillars like in the picture. There should be a Pillar between every two LEDs.
  3. The last LED of this strand (at the very top of the first helix pillar) will be connected to the first LED of the second pillar (at the base of that pillar), so a wire needs to be soldered to the data line (white wire) coming off the 11th LED. This wire should then be threaded back through all the Pillars so all four (the three LED input wires + this output data wire) are coming out the bottom of the pillar. This output data wire will eventually be stretched across the underside of the Base to connect to the other pillar of LEDs, so make sure it's long enough (see picture).
  4. In preparation for the next step, cut off like two dozen pieces of tape to wrap the pillar to hold it together while the glue is drying.
  5. Use foaming/expanding gorilla glue to glue together all ten Pillar pieces, making sure to have the LEDs protruding from the holes between the Pillars like in the picture. The LEDs should be relatively loose and free. Wrap the joints in the tape. Try and limit the amount of glue that winds up on the outside of pillar.
  6. Cut off another Length of 11 LEDs and thread them through the other 10 Pillars.
  7. Repeat the gluing with the other pillar.

Putting the Helix Together

IMG_1804.jpeg
IMG_7731.jpg
IMG_0AFF1EAD1C65-1.jpeg
  1. Glue on Pillar Caps and Pillar Bases to the pillars, making sure to thread any wires through the bottom holes in the Base parts.
  2. For each "rung," two Crossbeam parts are used and sandwiched together so one cross beam part is on the top and the other is on the bottom. It can be a tight fit so be ready for that. I used clear gorilla glue to glue on the Crossbeams. Stick a Crossbeam piece into the footprint in the Lamp Base part and glue it there. Then glue the two pillars to the base making sure to thread all wires through the holes in the Base (like in the picture). Then glue on the other Crossbeam on top so it's all closed together and rung #1 is done.
  3. Glue on two Crossbeams to all the other "rungs".
  4. For these next instructions, the breadboard will eventually be installed in the Lamp Bottom piece so make sure the wires going to the breadboard from the helix top part are long enough so the top part can be removed and lain on its side to access the breadboard (like the picture).
  5. Solder the LED data line going to the start of the first pillar to pin 5 of the Arduino on the breadboard.
  6. Solder the LED data line from earlier that is coming off the end of the last LED of the first pillar to the first LED of the second pillar.
  7. Solder power and ground to both LED pillars.
  8. Install the potentiometers and the push button in the Lamp Base part and solder all the connections between them and the breadboard. I used some hot glue to help hold the potentiometers in place so they don't rotate when they're being twisted. I also labeled the potentiometers with a sharpie on the Base.
  9. Use a M3x5 bolt to mount the breadboard to the Lamp Bottom. Make sure the bolt isn't shorting/connecting any of the lines of the breadboard. I used a small piece of electrical tape as a makeshift "washer" to separate the bolt head from the board.
  10. Thread the power cable through the hole in the side of the Lamp Bottom piece and then solder it to the right spot on the breadboard.

Processing the DNA Files

Screenshot 2024-09-17 at 9.20.23 PM.jpg

The DNA files are 3GB, so I can't attach them to this guide. Here are the steps to make them:

  1. Go to https://www.ncbi.nlm.nih.gov/datasets/genome/GCF_000001405.40/
  2. Scroll to the bottom and open the RefSeq link for chromosome 1.
  3. Follow the picture to download it as a FASTA file.
  4. Repeat for the other chromosomes.
  5. The FASTA files include things like titles and Ns, which aren't wanted. Dna_processing.py gets rid of all that and creates text files with just the ATGCs. Move all the files and the DNA_processing.py file into a folder.
  6. In dna_processing.py, set chromosome_number to 1 to process the first chromosome and run the code.
  7. Change chromosome_number for each chromosome and re-run the code.

Here's one thing I didn't understand at first: 'A's always pair with 'T's, and 'G's always pair with 'C's. So all the letters in the FASTA/text files are just half of each pair. For example, an A in the file means an AT pair, and that's what gets shown on a 'rung' of the helix.

Downloads

Programming

DNA_Lamp_Clean.ino and functions.ino make up the main program for the helix. As I said before, a known issue is the base pairs not moving through the helix as fast as I want them to. Ideally (at their fastest speeds) they'd update every 2 ms, but in reality, (with every chromosome's files on the SD) I measured speeds from 80-500ms (there could be times when it's even slower than that; my tests were not exhaustive). One way to make things faster is to only have the files for a single chromosome on the SD card at a time, but it means when the Arduino's gone through those files, you'll have to put the files for the next chromosome on the SD card. You can configure either way (all the files or just a single chromosome) in the code by changing ONE_CHROM_AT_TIME.

In the main program, there are celebration patterns that play after every file, so I also attached a program of just the celebration patterns. I generated these patterns with ChatGPT, which was quite easy and fun to do. I just got to sit back, ask for patterns, and then see how cool they looked. If you want to modify the patterns for the main program, this code is helpful. Or maybe you just want to run the pattern code full time.

After it's all uploaded and working (make sure to also put the generated DNA files from the previous step on the micro SD card), use 2-4 M3 bolts to connect the Lamp Base and Bottom together. You might have to use a knife to make the holes in the Bottom piece slightly larger. Make sure none of the wires are getting pinched by the two halves as it's going together and that no exposed electrical connections on the button and potentiometers are touching/shorting anything on the breadboard.


Conclusion

IMG_7800.jpg

Pushing the power button turns on the lamp. To turn it off, press and hold the power button until the lights stop moving.

Finally, find a place for the lamp, sit back, and enjoy the light show. The entire base-code of humanity is lighting up your room.