You are on page 1of 4

Materials Needed:

 A DC power source (e.g., a 9V battery)


 A heating element (e.g., a nichrome wire or a lighter coil)
 An on/off switch
 A resistor
 Electrical wire
 A soldering iron and solder
 A heat-resistant casing for the lighter

Steps:

1. Cut a piece of nichrome wire or a lighter coil to the desired length for your
heating element. This will be the part that will generate heat to light the cigarette.
2. Connect one end of the nichrome wire or lighter coil to the positive terminal of
the DC power source (e.g., a 9V battery). Use electrical wire to make the
connection, and solder the wires together.
3. Connect the other end of the nichrome wire or lighter coil to the on/off switch.
Again, use electrical wire and solder to make the connection.
4. Connect the switch to a resistor, which will act as a current limiter to prevent too
much current from flowing through the heating element. Use electrical wire and
solder to make the connection.
5. Connect the other end of the resistor to the negative terminal of the DC power
source. Use electrical wire and solder to make the connection.
6. Place the heating element into a heat-resistant casing, such as a metal or ceramic
tube, and secure it in place.
7. Test the electric lighter by turning on the switch and ensuring that the heating
element generates enough heat to light a cigarette.
Materials:

Arduino Uno board


HC-SR04 ultrasonic sensor
Temperature sensor (LM35)
5V relay module
Jumper wires
9V battery
Battery connector
Electric lighter
Step 1: Connect the HC-SR04 ultrasonic sensor to the Arduino Uno board

Connect the VCC pin of the HC-SR04 to the 5V pin of the Arduino
Connect the GND pin of the HC-SR04 to the GND pin of the Arduino
Connect the TRIG pin of the HC-SR04 to digital pin 12 of the Arduino
Connect the ECHO pin of the HC-SR04 to digital pin 13 of the Arduino
Step 2: Connect the temperature sensor to the Arduino Uno board

Connect the VCC pin of the LM35 temperature sensor to the 5V pin of the Arduino
Connect the GND pin of the LM35 temperature sensor to the GND pin of the Arduino
Connect the output pin (middle pin) of the LM35 temperature sensor to analog pin 0 of
the Arduino
Step 3: Connect the 5V relay module to the Arduino Uno board

Connect the VCC pin of the relay module to the 5V pin of the Arduino
Connect the GND pin of the relay module to the GND pin of the Arduino
Connect the IN1 pin of the relay module to digital pin 11 of the Arduino
Step 4: Connect the electric lighter to the 5V relay module

Connect one wire of the electric lighter to the COM pin of the relay module
Connect the other wire of the electric lighter to the NO (normally open) pin of the relay
module
Step 5: Upload the code to the Arduino Uno board

Open the Arduino IDE software on your computer


Copy and paste the following code into a new sketch:
scss
Copy code
const int trigPin = 12;
const int echoPin = 13;
const int tempPin = A0;
const int relayPin = 11;
float temperature;
long duration;
int distance;
int interval = 10000;

void setup() {
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
pinMode(tempPin, INPUT);
pinMode(relayPin, OUTPUT);
Serial.begin(9600);
}

void loop() {
distance = getDistance();
temperature = getTemperature();
if (distance <= 10 && temperature >= 30) {
digitalWrite(relayPin, HIGH);
delay(interval);
digitalWrite(relayPin, LOW);
}
Serial.print(distance);
Serial.print("cm ");
Serial.print(temperature);
Serial.println("°C");
delay(500);
}

int getDistance() {
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
duration = pulseIn(echoPin, HIGH);
distance = duration * 0.034 / 2;
return distance;
}
float getTemperature() {
int reading = analogRead(tempPin);
float voltage = reading * 5.0 / 1024.0;
temperature = voltage * 100.0;
return temperature;
}
Verify and upload the code to the Arduino Uno board
Step 6: Power the circuit

Connect the 9V battery to the battery

You might also like