Posted on 7 Comments

Arduino fireflies production tutorial

There are more than 10 step here about arduino fireflies production tutorail.

Step 1: What do you need.

Arduino Firefly Making Tutorial
Arduino Firefly Making Tutorial
Arduino Firefly Making Tutorial
Arduino Firefly Making Tutorial

To get your bugs flashing, you need these components:

Arduino. I started with Nano,But any microcontroller that is compatible with Arduino is fine.

Yellow LED, 5 mm. You can use up to 6 of them.

Resistors. Each LED requires a resistor to limit the current. I used 470 ohms, but anything above 150 ohms should protect your microcontroller.

Bread plate.

jumper.

To complete the backyard project, you will need:

weatherproof project box.

9 volt battery with connector. (See the note at the bottom of this section.)

Switch. (I chose these waterproof switches. If you don’t use it outside, any switch can be.)

Several yards The line puts the LEDs around the garden. I use about 10 feet of Cat5Ethernet wire per LED.

Small breadboard or Some perforated plates.

The weatherproof cable that the LED wire passes through. (If you are not using it outside, you can omit it.) It.)

heat shrink tubing to protect your LED worms.

The green shackle (ie Velcro) strip secures the LED fireflies to plants and columns in the garden.

Insert the assembly into the male side of the mini breadboard.

Tools:

Drill item box. (Use this opportunity to give yourself a good step. You will be glad that you did it).

Hot glue gun.

The soldering iron.

Rotate tool (Dremel) to make room in the engineering box when needed.

There are some precautions here:

1. The battery selection is for quick and easy startup. It is a waste of permanent use of 9 volt battery. You better use 4x AA Battery holder to extend the life (but you need a larger project box to install it).

2. If you choose Deconstruct the Cat 5 Ethernet cables for the wires, make sure they are copper cores and wrap them neatly around some PVCs to keep them neat when you work. I use the LEDs about 10 feet each LED again < /u> If you want to spread the light far away, be sure to use longer wires!

3. Finally, all the links I provide are just Recommendation. Before you build or buy anything, please read the entire Instructable carefully, as you will have a better understanding of how you want to move forward.

Step2:Build circuit。

This project uses the width modulation pin on the pulse Arduino. The microcontroller has 6 such pins, you are welcome to use it. The circuit is very Simple. Connect all the power supplies of the pulse width modulation (PWM) pins D3, D5, D6, D9, D10 and D11 to the positive terminal of the LED. Connect the negative terminal to the resistor and then to the common ground. The front or the back of the LED. Unless you want to prevent a higher current short circuit, there is no difference.) I have provided some schematics to help with wiring. (Use the Fritzing design software to create the chart.)

Step 3: Code.

If you are an experienced programmer, Then ‘I will find this code too simple. This is a good code to start learning because it introduces you to variables, pinmodes, functions and even random generators.The code is not as compact as it is, because I am sure that the same effect can be achieved with arrays and so on.

The code comments list the logic for each part. The entire code is embedded here and you can download the sketch below.

/*

This script flashes 6 LEDs (yellow, of cours e) in random order

at random intervals using PWM.

Each LED is controlled by it’s own function.

*/

int led1 = 3; // LED connected to PWM pin 3, etc. I used all 6 PWM pins.

int led2 = 5;

int led3 = 6;

int led4 = 9;

int led5 = 10;

int led6 = 11;

long randnum; // randnum controls the time interval between flashes and

long randbug; //randbug controls which bug lights up.

void setup() {

pinMode(led1,OUTPUT); //Setting all PWM pins as outputs.

pinMode(led2,OUTPUT);

pinMode(led3,OUTPUT);

pinMode(led4,OUTPUT);

pinMode(led5,OUTPUT);

pinMode(led6,OUTPUT);

}

void loop(){

randbug = random(3,12);//randbug randomly chooses a function to execute,

//thus randomly chooses a bug to light up.

if (randbug == 3) {

bug1();

}

if (randbug == 5) {

bug2();

}

if (randbug == 6) {

bug3();

}

if (randbug == 9) {

bug4();

}

if (randbug == 10) {

bug5();

}

if (randbug == 11) {

bug6();

}

}

/*

* Each of these functions work the same way. ‘for loops’ increase then decrease

* the output of that pin to control LED brightness.

* ‘randnum’ is a random time interval between 10 and 3000 ms

* and chooses a time interval between bug flashes.

* ‘delay 10’ is just for the fade effect.

*/

void bug1(){

randnum = random(10, 3000);

for(int fadeValue = 0 ; fadeValue 《= 255; fadeValue +=5) {

analogWrite(led1, fadeValue);

delay(10);

}

for(int fadeValue = 255 ; fadeValue 》= 0; fadeValue -=5) {

analogWrite(led1, fadeValue);

delay(10);

}

delay (randnum);

}

void bug2() {

randnum = random(10, 3000);

for(int fadeValue = 0 ; fadeValue 《= 255; fadeValue +=5) {

analogWrite(led2, fadeValue);

delay(10);

}

for(int fadeValue = 255 ; fadeValue 》= 0; fadeValue -=5) {

analogWrite(led2, fadeValue);

delay(10);

}

delay (randnum);

}

void bug3() {

randnum = random(10, 3000);

for(int fadeValue = 0 ; fadeValue 《= 255; fadeValue +=5) {

analogWrite(led3, fadeValue);

delay(10);

}

for(int fadeValue = 255 ; fadeValue 》= 0; fadeValue -=5) {

analogWrite(led3, fadeValue);

delay(10);

}

delay (randnum);

}

void bug4(){

randnum = random(10, 3000);

for(int fadeValue = 0 ; fadeValue 《= 255; fadeValue +=5) {

analogWrite(led4, fadeValue);

delay(10);

}

for(int fadeValue = 255 ; fadeValue 》= 0; fadeValue -=5) {

analogWrite(led4, fadeValue);

delay(10);

}

delay (randnum);

}

void bug5() {

randnum = random(10, 3000);

for(int fadeValue = 0 ; fadeValue 《= 255; fadeValue +=5) {

analogWrite(led5, fadeValue);

delay(10);

}

for(int fadeValue = 255 ; fadeValue 》= 0; fadeValue -=5) {

analogWrite(led5, fadeValue);

delay(10);

}

delay (randnum);

}

void bug6() {

randnum = random(10, 3000);

for(int fadeValue = 0 ; fadeValue 《= 255; fadeValue +=5) {

analogWrite(led6, fadeValue);

delay(10);

}

for(int fadeValue = 255 ; fadeValue 》= 0; fadeValue -=5) {

analogWrite(led6, fadeValue);

delay(10);

}

delay (randnum);

}

Step 4: Build the box

Once you refresh your Arduino with code and get your fireflies as you like The way they work, you might want to put them in the garden; this means a project box and some heat shrinking to keep the Arduino and LED dry. Let’s come!

Step 5: Build Bug Butts!

< /p>

Trim the LED leads approximately 5mm.

Tear and use the wires you are using The end is also about 5 mm.

Slide 1mm heat-shrink tubing at the end of each wire.

Wire the LED to the wire. (At this point, you should choose which of your pairs is positive and which one is negative. I choose the solid line as the positive line and the white line as the negative line. Keep this strategy throughout the project to avoid Later headaches!)

Allow the heat to slide up over the bare wires and LED leads. Burn them quickly and shrink them onto the wires.

Slide another heat-shrink tubing over the LED and extend the LED lens to the end and melt it into place.

Slide several heat-shrink tubing over the entire length and then melt it every few feet to keep the wire clean.

Step 6:Prepare the project box.

Use a rotating tool with a sanding drill to remove any unwanted plastic in your project box. (Be careful not to cut off any screw mounts that might need to put the boxes back together.)

Determine where you need to switch and if the LEDs are coming out. I recommend that both parties use something that suits your needs.

Use a properly sized drill bit to drill the cable glands and switches.

Note: In the photo above, you will see that I made a “dummy” cable.”This is a set of 6 pairs of wires I use for LEDs that are bundled together by heat shrinking. I use it to make sure the cable connectors fit well with the actual cable bundles, and once switched, the cable connectors and covers open. Also, test the waterproof performance of the box. (After 24 hours of flooding in 6 inches of water, there is very little water inside. I would be happy to call this box “weatherability”.)

Step 7: Bring power!

Determine how many batteries and switch wires you need to reach the Arduino project box by roughly placing all the batteries and switch wires The three components in the trim switch and the 9V battery connector wires. Strip and coat the ends. Slide some heat shrink to the next step.

Cut off the two plugs from the strip (but stick them together).

Weld the red lead of the 9V battery connector to one end of the switch. Solder the other end of the switch to the male pin. Solder the black battery leads to the other plug pins.

As shown above, the plug pins will enter the breadboard and power the Nano for VIN (positive) and GND (negative). The VIN pin can handle 7 to 12 volts. If you plan to power the Arduino in a way other than a 9V battery, use a different power supply pin.

Step 8: If you need to modify the Nano.

Because my project box is very shallow, I need to remove the ICSP plug pin To be able to adapt. These pins are the auxiliary interface of Arduino. Deleting them will not damage your Nano, because you can always load the script via the USB port.

< p style=”text-indent: 2em;”>Note: If your Nano requires soldered connector pins, omit these pins when assembling the Arduino.

Step 9: Connect the inside.

Connect the cable gland port to the project box for which it is drilled. If you are confused about how to use the cable connector, the video I found on YouTube shows the video being assembled. (Fast forward to 0:57.) You may have a rubber washer. This is in the project. Between the box and the outer nut of the cable gland.

Collect the loose ends of the LED wires. Take this time to trim them to equal lengths, peel off Apply both ends. Pass the end through the cover of the cable gland and bundle the ends together with a heat-shrink end to leave enough length to reach the breadboard inside the box.

Feed the wiring harness through the cable gland port into the engineering box and twist the gland to lock the wirelock.It is best to surround the heat shrinker used to tie them together.

Separate the ground wire from the positive line (remember the ones you selected earlier). Solder all ground wires together. Connect a short wire from the bundle and complete with one plug. Protect your exposed solder joints with heat shrink.

welding male ends at each end of the positive line. Again, use heat shrink.

Insert the male end into the breadboard and connect to the PWM pin on the Arduino.

Insert the common ground into the breadboard and pass it through the current limiting resistor, then through the GND on the Arduino.

Put the battery and pass the switch through the hole in the previously drilled box. Install the rubber gasket between the project box and the nut. Insert the power cord into the breadboard.

Snap the lid onto the box. You are done!

Note: Note that I use a current limiting resistor for each LED in the schematic and development phases. Typically, each LED should normally use its own resistor to illuminate multiple LEDs at a time. This code does not allow multiple LEDs to be lit at a time, so the Arduino can be protected with only one resistor. This also saves space on the breadboard or time-welding each LED with a series resistor. That said. .. ..caveat! ! ! If you plan to change the code to light multiple LEDs at a time, each LED requires a separate resistor.

Step 10: Use it.

Use the Velcro belt or a small amount of hot glue to fix the LED to the plant, fence, pink Colored flamingos or anything else in the yard. Tuck them into the wine rack, behind the curtains, and even hang the wires on the ceiling in the dark for a 3D floating effect! These are for parties, weddings, movies and photography. It’s a good choice.

Step 11: Go further…….

As mentioned earlier, this is an early version of the project, but it is full of potential! Run more LEDs by connecting the shift register (see JColvin91 for instructions on how to do this) Add a light sensor, solar charger and timer,Used to “set and forget it” feature! Confused with the code to add your own flares for bugs. Share your achievements and enjoyment! !

Advertisements

7 thoughts on “Arduino fireflies production tutorial

  1. The like you browse my mind! Creative ideas knowa significant concerning this,
    as you written born to run involved something like that.In my opinion you can utilize a number of pictures to drive the
    material residential home some more, nonetheless insteadof in which,
    this really stunning blog. A superb read. I’ll undoubtedly be back.

  2. Wow, this paragraph is pleasant, my younger sister is analyzing
    these things, thus I am going to convey her.
    It’s very straightforward to find out any topic on web as
    compared to books, as I found this article at this web site.
    I have been browsing online more than 3 hours today,
    yet I never found any interesting article like yours.
    It’s pretty worth enough for me. Personally, if all webmasters and bloggers
    made good content as you did, the internet will be a lot more useful than ever before.

  3. Hi! I realize this is kind of off-topic however I had to ask.
    Does operating a well-established blog like yours take a lot of work?
    I’m brand new to operating a blog but I do write in my journal everyday.
    I’d like to start a blog so I will be able to share my own experience and views
    online. Please let me know if you have any kind of suggestions or
    tips for brand new aspiring blog owners. Thankyou!

  4. Hey there! Do you use Twitter? I’d like to follow you if that would be ok.
    I’m undoubtedly enjoying your blog and look forward to new posts.

    1. Hi, phototrans
      My twitter is @3Celectrons, you can also subscriber my blog by using your email.

  5. Everything is very open with a really clear description of the issues.
    It was really informative. Your site is very helpful. Thank you for sharing!

    1. Thank you for your admiration,..
      I will try my best to provide more interesting and aviable post here.

Leave a Reply

Your email address will not be published.