Go Down

Topic: Tilt Switch and 555 Timer Astable Circuit for LED (Read 1 time) previous topic - next topic

jarus

I need to blink an LED (2.1V @350mA) @4Hz for ~30 seconds when an acceleration force is .5 g-force (+/- .1g) along one axis. The input (acceleration force) will last for 1-2 seconds. I have prototyped on an Arduino UNO and ADXL335 but now I am looking for a more cost effective solution.

I am thinking about using a tilt switch and 555 timer. I spec'd the tilt switch by converting g-force to degrees relative to the orientation of gravity (.5g = 30 degrees) . But I need help designing the 555 timer circuit.

I understand the basics of the 555 but things I am having trouble understanding are:

  • How to keep the LEDs blinking after zero input? Input is 1-2s for which the tilt switch circuit will be closed and I need to blink for 30s. Do I store energy in a larger capacitor from which the 555 circuit draws energy from?
  • How to spec the capacitor to power the LED? Once I know C, I can calculate R1 and R2 to achieve the blink frequency of 4Hz. Here's my thought process so far - the LED consumes 2.1V and 350mA = .735 Watts = .735 J/s And since the LED blinks at a rate of 4Hz, the energy needed for one blink is (.125s)(.735J /s) = .09 Joules. Then C= 2W/V2 and C=41mF. Does this make sense?? It seems off to me since that's a big cap.
  • What type of cap do I need? Aluminum Electrolytic , ceramic, etc..
I am an ME so I'd appreciate any ideas, thoughts, or direction you can provide in order to achieve the most cost effective solution. Thanks!


avr_fred

Lots of red flags here...

350ma to blink an led? That's some serious light. Please explain further.
Powered by a capacitor? No, you'll need a battery.
Still using the ADXL335? You don't mention it.

Can you post a schematic and code of what you've done so far? That will provide detail for many things not explained in your post.

jarus

Instead 555 use this

https://fr.aliexpress.com/item/100pcs-Round-Transparent-LED-5mm-RGB-2-pin-Flash-Automatically-Fast-flashing-led-Diode-Light/32278374273.html
Interesting! Can I control the frequency of blinking? Also can I limit the blinking only to the red color?


350ma to blink an led? That's some serious light. Please explain further.

The LED I have chosen is a Philips Lumiled LXM2-PH01-0070. The application is as an emergency stop light on race motorcycles. So I chose a bright LED - perhaps there might be a better tail light LED for this application?
 
Here is the spec sheet:
https://www.lumileds.com/uploads/265/DS68-pdf

Powered by a capacitor? No, you'll need a battery.
Still using the ADXL335? You don't mention it.
It is powered through AA batteries but my understanding of the 555 timer and caps was wrong. I thought the external battery charged the caps and the caps powered the LEDs and 555. Now I realize that the caps just regulate the 555, and do not power the LEDs...is that correct?

I am trying to replace the ADXL335 with a tilt switch. I arrived to this idea after learning about the mechanism that car airbag sensors use. On an inclination plane, the force of gravity is =1g*sin(theta). So if I want the switch to activate at a threshold acceleration value of .5g then a tilt switch which activates (closed circuit) at 30 degrees would work. I think it should work since I need to blink an LED at a threshold acceleration value - the actual acceleration value does not matter - if it exceeds the threshold, then I want to blink an LED.

Can you post a schematic and code of what you've done so far? That will provide detail for many things not explained in your post.
I have attached my code for my initial prototype. Basically the program self calibrates to zero the sensors and turns on the LED (pin 9) during that process. Then it blinks another LED (pin 13) if the acceleration in xyz axis is greater than .5g. I'd like to accomplish and replicate the same action/circuit with passive components. Sorry I don't have an actual schematic.


ted

It is hard to see your code,copy it from arduino and paste using this </>
Flashing LED frequency is 1Hz, cannot change, if you ok with 1 Hz look at the linkIt is hard to see your code,copy it from arduino and paste using this </>
Flashing LED frequency is 1Hz, cannot change, if you ok with 1 Hz look at the linkhttp://www.rysium.com/projects/187-luxeon-led-strobe

avr_fred

Correct, the capacitor along with the resistor(s) in series with it, only provides the pulse timing of the NE555. I would not abandon a micro-controller based solution, you'll find trying to do this with a bipolar timer circuit designed in the earlier seventies has some rather distinct disadvantages.

The fact that you need to monitor three analog values for a threshold is enough justification to use a small micro in today's world. One of the AtTiny series units will lower the device cost and size if that is a critical factor.

jarus

It is hard to see your code,copy it from arduino and paste using this </>
Sorry about that.

Code: [Select]
float Xread;
float Xrest;
const int Xpin = A0;

float Yread;
float Yrest;
const int Ypin = A1;

float Zread;
float Zrest;
const int Zpin = A2;

const int analogtoG = ((.330*1023)/3.3);
float threshold = .4; //threshold measured in g force
int ledOnTime=125; //led on time
int ledOffTime=125; //led off time
int numRedBlink=10; //number of times to blink

//Reading the ADXL335 datasheet we see that on 3.3V power, we should expect an axis to read 1.65V when it has zero acceleration, and the voltage should
//typically change by 330 mV per G of acceleration.  The signal from our analog to digital converter gives us a number from 0 to 1023.   I'll call these "ADC units". 
//0V maps to 0 ADC units, 3.3V maps to 1023 ADC units and I assume it is linear in between.

//This means that zero acceleration on an axis should give us a reading of 512 ADC units on the pin for that axis.  Also, a change of 1 ADC unit in
//our signal corresponds to a voltage difference of 3.3V/1023 ADC units = 3.226 mV/ADC unit.  Since the datasheet says 1G typically corresponds to
//330 mV voltage difference, we expect that

//330 mV/G = 330 mV/G × (1023 ADC units) / 3.3 V = 102.3 (ADC units)/G



void setup() {
  Serial.begin(9600);      // sets the serial port to 9600 baud
  analogReference(EXTERNAL);

  pinMode(Xpin, INPUT);
 
  pinMode(9, OUTPUT); // digitalWrite (9, HIGH); //turn on LED at pin 9 on for 1 second
  digitalWrite (9, HIGH);
  delay(1000);
 
  Xrest = analogRead(Xpin);       
  Yrest = analogRead(Ypin);       
  Zrest = analogRead(Zpin);       
 
  delay(10);
  digitalWrite (9, LOW);

  pinMode(13, OUTPUT); //setup output leds




}

void loop() {
  delay(1);
  Xread = (analogRead(Xpin) - Xrest)/analogtoG;
  Yread = (analogRead(Ypin) - Yrest)/analogtoG;
  Zread = (analogRead(Zpin) - Zrest)/analogtoG;

for (int j=1; j<=numRedBlink; j=j+1){

   if ( abs(Xread)+ abs(Yread) +abs(Zread) > threshold){
    digitalWrite(13, HIGH);
    delay (ledOnTime);
 }
   digitalWrite(13, LOW);
   delay (ledOffTime);
 }

 
 Serial.print("g force ");
 Serial.print(abs(Xread) + abs(Yread) + abs(Zread), DEC); 
 Serial.println();


  delay(1);

}


The fact that you need to monitor three analog values for a threshold is enough justification to use a small micro in today's world. One of the AtTiny series units will lower the device cost and size if that is a critical factor.
Well really I just need to monitor the acceleration value along one axis - the axis that the motorcycle is moving on. What are some of the disadvantages and why do you think a tilt switch would not work for this use case? Just wondering..

ted

This is your sensor, just play with diameter of the copper ring to match your acceleration, use traditional blinking diode program, start blinking when input pin is LOW, drive the led by MOSFET as on my previous link.

http://www.instructables.com/id/How-to-make-simple-%22motion%22-sensors/

ted

No arduino option, you can adjust the frequency as you need, the ring sensor as a switch for power supply for 555http://rookieelectronics.com/555-timer-projects-flashing-led/

jarus

This is your sensor, just play with diameter of the copper ring to match your acceleration, use traditional blinking diode program, start blinking when input pin is LOW, drive the led by MOSFET as on my previous link.

http://www.instructables.com/id/How-to-make-simple-%22motion%22-sensors/
Thanks for the DIY ideas. I think the tilt switches I was looking into either used a rolling ball or photo-interrupter. A very similar idea to detect acceleration along one axis is to have a spring with a welded contact similar to the spring/ball in your link. The spring would need a thru rod to limit the movement. There would be a gap between the ball and another contact and when the spring expands, the circuit is closed.

The contact duration would be really short though. Does this cause any issues? I'm guessing it can be solved with some capacitance?


No arduino option, you can adjust the frequency as you need, the ring sensor as a switch for power supply for 555http://rookieelectronics.com/555-timer-projects-flashing-led/
How can I minimize idle power consumption (ideally to zero)? Also I'm guessing I'd need two 555's one for blinking and the other one setup as a one-shot? Or a 556?

ted

For one direction - don't use full circle use 1/10 of it will be ok;
for minimum power...... use MOSFET as power supply switch, connect sensor to gate, also to gate connect 1uF capacitor and 1 meg resistor,  another terminals RC to ground, Change R to get 30 sec.

jarus

For one direction - don't use full circle use 1/10 of it will be ok;
for minimum power...... use MOSFET as power supply switch, connect sensor to gate, also to gate connect 1uF capacitor and 1 meg resistor,  another terminals RC to ground, Change R to get 30 sec.
The sensor (tilt switch) and RC circuit are in series and connected to the gate? Correct?

Using this RC calculator I found I can use a 100uF cap and 750kOhm resistor assuming I use 3 AA batteries with Vcc=4.5V and a 2n7000 that has a threshold voltage of 3V to time the discharge to 30s to open the gate. Sound right?

What do you mean by "another terminals RC to ground"? I'm guessing you mean the mosfet source goes to battery ground?




ted

Battery Positive terminal - Drain + one of the sensor wire.
Source to your toy.
Gate - second sensor wire + R ( end A ) + C (end A)
The ends B to ground.
R has two ends A and B, the same C.
Use values from calculation if you dont have 30 sec., change them.

ted

In this arrangement 30sec start from last acceleration - it is ok ?

jarus

Battery Positive terminal - Drain + one of the sensor wire.
Source to your toy.
Gate - second sensor wire + R ( end A ) + C (end A)
The ends B to ground.
R has two ends A and B, the same C.
Use values from calculation if you dont have 30 sec., change them.
Can you do me a HUGE favor and draw this out? I am having a hard time following and rather than explaining with words a picture would work much better.

Go Up