قالب وردپرس درنا توس
Home / Tips and Tricks / How to Start Fireworks on Wi-Fi «Null Byte :: WonderHowTo with an ESP8266 board and Arduino

How to Start Fireworks on Wi-Fi «Null Byte :: WonderHowTo with an ESP8266 board and Arduino



Fireworks are the best part for the Fourth of July and other celebrations, but can easily lead to accidental injury. It's safer and more fun to activate remotely. So we hack some standard fireworks with nichrome wire, a relay and an arduino to remotely ignite them with any smartphone or computer over Wi-Fi.

Why start Fireworks Remotely?

Fireworks are fun, but they can be a real danger if they start too soon or unexpectedly. Remote lighting of fireworks should not have serious consequences of misfiring, except for damage to your alligator clips or a low-cost microcontroller.

Fireworks can be remotely detonated to allow anyone with a Wi-Fi enabled device to take off safely without having to be close enough to hurt themselves. Even small children can tap a tablet to trigger a massive firework, and the risk of confusing things would be impractical.

Finally, by remotely launching fireworks, we can automate the launch by writing programs that take over the burning for us. That is, we can set the time when fireworks should be fired with precision, or coordinate the launch of groups of different fireworks for clear patterns and effects.

The process of changing the fireworks for electrical start-up carries some risks. Z By measuring connectivity and working with voltage, starting fireworks becomes more automated and less prone to error. The time required to load a firework and test the conductivity, although not faster, provides more control and flexibility in the type of fireworks used and their placement.

How do we start fireworks remotely? [1
9659003] A relay works like a light switch controlled by turning a magnet on and off. When we energize the electromagnet, a metal switch inside is tightened and tilts, connecting the circuit. It is useful because we can switch a large power source used to heat our nichrome coil with a small, secure power supply to turn the relay on and off.

What do you need for this project?

To follow this guide, you need the following:

These deliveries give us everything we need to build a circuit that gets hot when we pass power through it. With the aluminum band and the nichrome wire we modify fireworks for heating and burning.

Image of Kody / Null Bytes [19659019] Step 1: Connect the ESP8266 and the Relay

First download the code for the project which is available in my GitHub by opening a terminal window and executing the following commands.

  ~ $ git clone https: //github.com/skickar/AirduinoFireworks.git
~ $ cd AirduinoFireworks 

Now you should have the sketch for controlling the ESP8266 as well as the firing bash script.

Next connect the ESP8266 and the relay. You should have the pin on the ESP8266 to control the fireworks, in this case pin D1, which is connected to pin D1 of the relay. If you use a shield, you can place the relay directly on the ESP8266 as shown below.

image from Kody / Zero Byte

If you do not have shielding, you need to plug the ESP8266's 5 volt pin into the 5 Connect the volt pin of the relay and the ground pin of the ESP8266 to the ground pin of the relay. You can then connect pin D1 to pin D1 of the relay, as shown below.

Image of Kody / Zero Bytes

Step 2: Access Your Board In Arduino IDE

Next, close the ESP8266 via a microUSB cable to your computer. In the Arduino IDE, which you can install from the Arduino site, you must select the correct ESP8266 card from the Tools list for what you are using, which may not be immediately possible.

If you do not want to, your board will not appear under Tools -> Board. From the Preferences menu of the Arduino IDE, click the Additional Board Manager URLs box and add the following address.

  http://arduino.esp8266.com/ stable / package_esp8266com_index.json 

Once this is done, you should be able to select ESP8266-based boards in Arduino IDE under Tools -> Board.

Step 3: Flash the code on the ESP8266

. Open the "AirduinoFireworks.ino" sketch you downloaded from GitHub in step 1. The following code should be displayed.

  / *
This is a simple example of the aREST library for the ESP8266 WiFi chip.
For more information, see the README file.

Written in 2015 by Marco Schwartz under a GPL license.
* /

// Import required libraries
#include 
#include 

// Create a REST instance
aREST rest = aREST ();

// WiFi parameters
const char * ssid = "printer";
const char * password = "00000000";

// The port to monitor for incoming TCP connections
#define LISTEN_PORT 80

// Create an instance of the server
WiFi server server (LISTEN_PORT);

// Variables to expose to the API
int temperature;
int humidity;

// Declare functions to expose to the API
int ledControl (string command);

void setup (void)
{
// start serial
Serial.begin (115200);

// Initialize variables and expose them to the REST API
Temperature = 24;
Humidity = 40;
Rest.variable ("Temperature", & Temperature);
Rest.variable ("humidity" and humidity);

// function to be exposed
rest.function ("led", ledControl);

// give the device name and ID (ID should be 6 characters)
rest.set_id ("1");
rest.set_name ("esp8266");

// set up WLAN network
WiFi.softAP (ssid, password);
Serial.println ("");
Serial.println ("WiFi created");

// start the server
server.begin ();
Serial.println ("server started");

// print the IP address
IPAddress myIP = WiFi.softAPIP ();
Serial.print ("AP-IP-Address:");
Serial.println (myIP);
}

void loop () {

// process REST calls
WiFiClient client = server.available ();
if (! client) {
Return;
}
while (! client.available ()) {
Delay (1);
}
rest.handle (client);

}

// User-defined function that the API can access
int ledControl (string command) {

// get status from command
int state = command.toInt ();

digitalWrite (6, state);
return 1;
} 

The code creates a Wi-Fi hotspot and allows Web requests to be sent to control the pins on the ESP8266 board. Click the upload button to the right to send the code to the ESP8266 and wait for the process to complete. After completing the process, we should be ready to test the relay control.

Step 4: Connect to the Wi-Fi Relay Control Network

Connect to Wi-Fi on the computer from which you want to start the firewall control network and name it "Fudruckers" Password 00000000 when prompted. After joining, make sure you're in the right network. At this point we need to test if the relay works as expected. We will use the auto-trigger program to send web requests that trigger the relay for testing.

Step 5: Run the script firing.sh

In a terminal window on your computer, run the trigger script to test the relay. Navigate to the folder that contains the firing.sh script downloaded from GitHub in step 1 and run it with the following command. If it works, you will hear a click when the relay turns on and off after a few seconds.

  ~ $ bash firing.sh

{"message": "Pin D1 set to 1", "id": "1", "name": "esp8266", "hardware": "esp8266", "connected": true}
{"message": "Pin D1 set to 1", "id": "1", "name": "esp8266", "hardware": "esp8266", "connected": true}
{"message": "Pin D1 set to 0", "id": "1", "name": "esp8266", "hardware": "esp8266", "connected": true} 

If this works, We are ready to connect the wires and start our live test.

Step 6: Connect two wires to the relay

Now screw the wires on the relay to the middle connector, also known as the common connector. and the normally open (marked NO) terminal. There is no connection between these two until we trigger the relay.

After they are connected, wrap the ends with tape to make sure they do not touch each other accidentally. We will later connect the cable attached to the middle (common) terminal to the positive side of the battery and the cable attached to the NO terminal to the nichrome cable.

Picture of Kody / Null Byte

Step 7: Half wrap the fireworks with aluminum tape.

If the fuse is present, wrap half of the underside of the fireworks with aluminum tape Be careful not to switch to the other half. To make sure that none of the first half of the aluminum touches, wrap the other side of the firework bottom with the fuse in tape, leaving a line with no tape in between.

You can also add tabs here to increase stability. Z When it is upright, pinch some aluminum tape and glue it to each of the halves. Before adding the nichrome wire, test the connection by touching both halves with multimeter . There must be no current between the two sides.

Recommended: Etekcity MSR-R500 Digital Multimeter

Picture of Kody / Zero Byte

Step 8: Cut and assemble The nichrome wire

Cut off a piece of nichrome wire, and then fold it into a V shape. Bend out the top of the V-shape to look like the bottom. If you are using a thicker wire than 36 gauge, wrap a small amount around the fuse instead.

Image of Kody / Null Byte [19659011] Now place the lower part of the "V" where the fuse is in Fireworks fits.

Picture by Kody / Null Byte [19659011] Finally, stick the nichrome wire to the fireworks to close the gap between the two aluminum sides. Use more aluminum tape for this. Make sure that the aluminum band does not bridge the space between the two halves – only the nichrome wire will do that.

Now it's time to measure the connection between each half of the slide – but take the fireworks outside first. By measuring, some current flows through the circuit, and although this is very unlikely, there is a possibility that it will not trip at zero.

Step 9: Test the Connection and Attach the Fireworks

Place the fireworks in a location where it is safe and away from anything that could cause a fire. Make sure you support the base of everything you use to get it started well.

If the fireworks are safe, take your multimeter and test the passage between both sides of the fireworks with crocodile clips. When power can be passed from one side to the other through the nichrome jumper wire cable, we can get started.

Image of Kody / Null Bytes

If a "1" is displayed on the multimeter, no current flows. Add more aluminum tape with a small pad to the back, as the adhesive that bonds the tape is not very conductive and can block the connection you start a fountain or a Roman candle fireworks.

If your fireworks start like a mortar or a rocket out of the tube, you have to create a trouble-free design. You can search for ideas for building a launcher in the Github repo . As you can see in the photo above, attaching the slots made of aluminum tape to the launcher, into which the aluminum flaps of the fireworks fit.

Step 10: Connecting the Battery

The last step is attaching the positive terminal of the 9 volt battery to the common terminal of the relay. As soon as we do this, the energy can drain from the "normally open" circuit as soon as we send it an instruction from the D1 Mini. The circuit should look something like this without the fireworks:

Image of Kody / Zero Byte

After connecting the battery, go Get back to a safe distance and get ready to start the burning sequence.

Step 11: Connect to the Control Network and Run firing.sh

Now connect to the Wi-Fi network on your computer. Fi-network created by ESP8266 named "Fudruckers", if you disconnected at any time, and enter the password 00000000 to become a member. The AirduinoFireworks folder should display a bash script named "firing.sh" that controls the triggering of the relay. You can see the contents of the script below.

  #! bin / bash

sleep 5 && say "The computer is in control, countdown from 5" && ​​curl http://192.168.4.1/analog/1/1&& sleep 5 && say "Firing" && curl http://192.168.4.1/ digital / 1/1 && sleep 5 && say "Safe" && curl http://192.168.4.1/digital/1/0[19659022[Tofireofftherelayclearthefollowingsectionandexecutethefollowingcommand:[196659018] $ bash firing .sh 

This will indicate that the Relay is triggered loudly and then tripped for five seconds before it is switched off again.

Starting fireworks from any telephone

Starting fireworks Launch the program from a smartphone, such as an iPhone or an Android phone, and connect to the Wi-Fi network "Fudruckers "here. Then run the following commands one at a time in the URL bar of any Web browser. Alternatively, you can do this from your computer in a terminal window by setting curl and a space in front of the URL.

To enable and fire the relay, send the command to turn pin 1 to pin 1 on. This turns on the relay LED but does not trip the coil.

  http://192.168.4.1/analog/1/1 

To activate the armed pen, send the following command.

  http://192.168.4.1/digital/1/1 

To turn off the igniter, this request instructs the stylus to return to Digital 0 or Off.

  http://192.168.4.1/digital/1/0 

A word of warning: anyone who is affiliated with the Fudrucker's control network may find that they may or may not use it as if they are setting up a setup that can be used to trigger the reminder

Stay Safe, Zero Bytes!

Here are some safety instructions Warnings about working with fireworks in this project:

I hope you liked this tutorial on launching firecrackers over Wi-Fi! If you have questions about this WI-FI fireworks tutorial or if you have a comment, please contact me at Twitter @KodyKinzie .

Do not miss: Detect when a device is nearby with the ESP8266 Friend Detector

Cover photo of Kody / Null Byte

Source link