Devices & Components
Terminal strip block
Male/Female Jumper Wires
2S LiPo battery 300-1000 mah (XT-60 connector)
HC-05 Bluetooth Module
A plastic box with detachable lid
Breadboard (generic)
Heat Shrink Tubing
3 AAA enclosed battery case
XT-60 LiPo connector
Wire Cable - By the Foot
Male/Male Jumper Wires
0.25 mm Nichrome wire
RobotGeek Relay
Arduino Pro Mini 328 - 5V/16MHz
Hardware & Tools
Wire stripper
Screwdriver
Wire cutter
Soldering flux
Cutter
Lighter
Usb to TTL adapter
Soldering iron (generic)
Project description
Code
The code that should be uploaded th the pro mini
arduino
The code establishes a software serial connection (for HC-05) bluetooth module. Then in the loop it listens to the serial connection for incoming communication (from the phone or tablet). When something is received it will be checked for validity in the isPinNrValid function ( it should a pin number from 3 to 9), and then it toggles the pin on for "igniteTime". Ignite time is a constant initially defined by me for 2500 ms, you can change that to whatever you like, i've found out that my fireworks would ignite successfully given that interval.
1#include <SoftwareSerial.h> 2 3SoftwareSerial bluetooth(12, 13); // 4 RX, TX 5const int igniteTime = 2500; 6 7void setup() 8{ 9 Serial.begin(9600); 10 11 bluetooth.begin(9600); 12} 13 14void loop() 15{ 16 if (bluetooth.available() 17 > 0) { 18 char received = bluetooth.read(); 19 Serial.println(received); 20 21 if (isPinNrValid(received)) { 22 togglePin(received); 23 24 } 25 } 26} 27 28bool isPinNrValid(char pin) 29{ 30 return 31 pin >= '3' and pin <= '9'; 32} 33 34void togglePin(char pinNr) 35{ 36 Serial.print("Toggle 37 pin:");Serial.println(pinNr); 38 String pin; 39 pin += (char) pinNr; 40 41 int number = pin.toInt(); 42 pinMode(number, OUTPUT); 43 digitalWrite(number, 44 HIGH); 45 delay(igniteTime); 46 digitalWrite(number, LOW); 47} 48
The code that should be uploaded th the pro mini
arduino
The code establishes a software serial connection (for HC-05) bluetooth module. Then in the loop it listens to the serial connection for incoming communication (from the phone or tablet). When something is received it will be checked for validity in the isPinNrValid function ( it should a pin number from 3 to 9), and then it toggles the pin on for "igniteTime". Ignite time is a constant initially defined by me for 2500 ms, you can change that to whatever you like, i've found out that my fireworks would ignite successfully given that interval.
1#include <SoftwareSerial.h> 2 3SoftwareSerial bluetooth(12, 13); // RX, TX 4const int igniteTime = 2500; 5 6void setup() 7{ 8 Serial.begin(9600); 9 bluetooth.begin(9600); 10} 11 12void loop() 13{ 14 if (bluetooth.available() > 0) { 15 char received = bluetooth.read(); 16 Serial.println(received); 17 if (isPinNrValid(received)) { 18 togglePin(received); 19 } 20 } 21} 22 23bool isPinNrValid(char pin) 24{ 25 return pin >= '3' and pin <= '9'; 26} 27 28void togglePin(char pinNr) 29{ 30 Serial.print("Toggle pin:");Serial.println(pinNr); 31 String pin; 32 pin += (char) pinNr; 33 int number = pin.toInt(); 34 pinMode(number, OUTPUT); 35 digitalWrite(number, HIGH); 36 delay(igniteTime); 37 digitalWrite(number, LOW); 38} 39
Downloadable files
The circuit schematic
The circuit schematic

Comments
Only logged in users can leave comments