How to detect if a light bulb is burned out or blown in Arduino

I want to detect if an Light bulb is broken or burned out, if so than small led must be blinking but if not then small led must also glow. Here I am new to Arduino. Also I don't want to use LDR or Photoresistor since they can turn on from external light source and my Interviewer also don't want me to use LDR. Someone please help me with this assignment.
I need to do it in Tinkercad only. So I tried this.

And here is my code:
void setup()
pinMode(3, OUTPUT);
pinMode(A5, INPUT);
pinMode(4, OUTPUT);
void loop()
delay(1000); // Wait for 1000 millisecond(s)
digitalWrite(3, HIGH);
if (analogRead(A5) != HIGH) {
digitalWrite(4, HIGH);
} else {
digitalWrite(4, HIGH);
delay(10); // Wait for 10 millisecond(s)
digitalWrite(4, LOW);
delay(10); // Wait for 10 millisecond(s)
digitalWrite(4, HIGH);
delay(10); // Wait for 10 millisecond(s)
digitalWrite(4, LOW);
Problem is Led is Blinking even when current is correctly flowing dont know what mistake i did

When a light bulb is energized it draws current. If the switch is in the on position and the light bulb does not draw current then the bulb might be broken. So measure light bulb current when the switch is in the on position.

Tricky! Neither do I! :face_with_raised_eyebrow:

Of course, you omitted some of the most critical details.

Why don't you show us the whole text of the assignment? Otherwise we just have to keep asking questions until we have it all anyway. :roll_eyes:

How do you detect if the LED has failed?

Can you show me connections of it?

Thanks for correcting the question

He asked me to create a Navigation Lights Control Panel of a Ship in Arduino in Tinkercad where on click of buttons bulbs has to glow if the bulb is failed/blown/burnt then a mini led near button must blink else if bulb is working correctly than mini led must on high state and not blink on turning it off bulb must be turnoff first then mini led must turnoff. And I am not allowed to use LDR or Photoresistor I must do it using Voltage or current readings

I cannot show you the connections to it for obvious reasons.

Modern ships use a communication system for all devices, similar to what is used in modern automobiles. Are you supposed to duplicate that in your assignment?

I Don't know about that I am just to told about these light stuff

Ok, then the very first step is be able to disconnect each light from it's connections so you don't damage the ships electronics. You can do that using a double pole relay. Begin there.

Thanks dude

Yeah, in a real-life situation, that's a good start.

However, for this assignment, it's going to take OP into the woods where he'll get lost and be eaten by the wolves, and you know it.

Ok, let's start there. Remember what @Idahowalker said:

So ask yourself - how could you detect current?
Hint: you'll have to do it indirectly, as an Arduino by itself doesn't measure current. It can only measure voltage.

Feed your head.

A possibility would be a ACS712 Hall Effect Current Sensor Module.

A voltage detector module.

Avoid any reference to "ground" as there is none on a ship. All wires make direct connections for both positive and negative ends of the circuit.

In the Power Supply biz it's Return (RTN) or Common (COM). I think RTN is most prevalent.

@serverandom123 --
What is the lamp current (mA)?

Since it is only a simulation, it is not so important, but best practice would be to put a current limiting resistor in series with the LED attached to pin 4 (post #1) . It would actually be interesting to know how Tinkercad handles the effect of overloading of an Arduino pin.

Runaway Pancake has the right approach. Though the OP will never get there with the drawing he has. If you know the approximate CURRENT of the lamp, put a small resistor in series with the emitter of the transistor, then connect the emitter to an analog input. Size the resistor such that you have a few hundred millivolts going to the input. This is how it's done in automobiles. My BMW X3 got very upset when I changed turn signal bulbs to LEDs. It was looking for more current, or a higher voltage at the analog input. Since most light bulbs are running with one end grounded, it takes a bit more circuitry to sense at the "high end" but the principle is the same.

I guess you get unpopular if you run a ground... :wink:

1 Like