January 27, 2019

Arduino Group Dimming Tutorial


ARDUINO GROUP DIMMING TUTORIAL


INTRODUCTION

Arduino is a microcontroller which can be programmed to do certain operations like lighting led, controlling servo, etc. This is a DIY Arduino project intended to achieve group dimming of LED’s. The group dimming or segregated dimming gives the flexibility of dimming a batch of LED’s at a time rather than dimming all at once. Group dimming is best observed during light shows where different colors of lights fade at different time. Dimming or fading is a process of gradually increasing or decreasing the brightness of light. The group dimming setup consists of 9 LED’s (3 each of red, white and blue). The 3 LED’s switch on and off gradually within a specified time. The delay time or the time interval used here is 200 millisecond.  

COMPONENTS REQUIRED

1. Perfboard and Breadboard
2. Arduino Mega 2560 and USB cable
3. 5mm Red LED’s (3)
4. 5mm White LED’s (3)
5. 5mm Blue LED’s (3)
6. 20 Ohm resistors (9)
7. Jumpers
8. A 5V DC Power supply

CIRCUIT SCHEMATICS

Fig1 Group dimming schematic

Make the appropriate connections as shown in the schematic above

CODE

This is the code for simulating Group fading or dimming of LED’s. Note that this code is valid only for the particular schematic represented in figure1. The values and choice of ports can always be changed but ensure only analog pins or PWM pins are selected. Analog pins are usually marked with a ‘~’ in front of the pin number. You must use Arduino Mega Board since it contains 12 PWM pins and we require 9 PWM pins. Copy and paste the code in Arduino IDE sketch area.

/*
Group LED dimming/fading

This example shows how to fade LED in groups

use Arduino mega, it has PWM pins 2 through 13

Created by Srinath Srinivasan
This code is in the public domain
*/

int ledPin1 = 2;    // LED connected to PWM pin 2
int ledPin2 = 3;    // LED connected to PWM pin 3
int ledPin3 = 4;    // LED connected to PWM pin 4
int ledPin4 = 5;    // LED connected to PWM pin 5
int ledPin5 = 6;    // LED connected to PWM pin 6
int ledPin6 = 7;    // LED connected to PWM pin 7
int ledPin7 = 8;    // LED connected to PWM pin 8
int ledPin8 = 9;    // LED connected to PWM pin 9
int ledPin9 = 10;   // LED connected to PWM pin 10

void setup() {
  // nothing happens in setup
}

void loop() {
  // fade in from min to max in increments of 5 points:
  for (int fadeValue = 0 ; fadeValue <= 255; fadeValue += 5) {
    // sets the value (range from 0 to 255):
    analogWrite(ledPin1, fadeValue);
    analogWrite(ledPin2, fadeValue);
    analogWrite(ledPin3, fadeValue);
    // wait for 200 milliseconds to see the dimming effect
    delay(200);
  }
 
  for (int fadeValue = 0 ; fadeValue <= 255; fadeValue += 5) {
    // sets the value (range from 0 to 255):
    analogWrite(ledPin4, fadeValue);
    analogWrite(ledPin5, fadeValue);
    analogWrite(ledPin6, fadeValue);
    // wait for 200 milliseconds to see the dimming effect
    delay(200);
  }
 
  for (int fadeValue = 0 ; fadeValue <= 255; fadeValue += 5) {
    // sets the value (range from 0 to 255):
    analogWrite(ledPin7, fadeValue);
    analogWrite(ledPin8, fadeValue);
    analogWrite(ledPin9, fadeValue);
    // wait for 200 milliseconds to see the dimming effect
    delay(200);
  }

  // fade out from max to min in increments of 5 points:
  for (int fadeValue = 255 ; fadeValue >= 0; fadeValue -= 5) {
    // sets the value (range from 0 to 255):
    analogWrite(ledPin1, fadeValue);
    analogWrite(ledPin2, fadeValue);
    analogWrite(ledPin3, fadeValue);
    // wait for 200 milliseconds to see the dimming effect
    delay(200);
  }
 
  for (int fadeValue = 255 ; fadeValue >= 0; fadeValue -= 5) {
    // sets the value (range from 0 to 255):
    analogWrite(ledPin4, fadeValue);
    analogWrite(ledPin5, fadeValue);
    analogWrite(ledPin6, fadeValue);
    // wait for 200 milliseconds to see the dimming effect
    delay(200);
  }
 
  for (int fadeValue = 255 ; fadeValue >= 0; fadeValue -= 5) {
    // sets the value (range from 0 to 255):
    analogWrite(ledPin7, fadeValue);
    analogWrite(ledPin8, fadeValue);
    analogWrite(ledPin9, fadeValue);
    // wait for 200 milliseconds to see the dimming effect
    delay(200);
  }
}

January 20, 2019

Super sonic doppler shift in military jet pt4


SUPER SONIC DOPPLER SHIFT IN A MILITARY JET PT4


INTRODUCTION

We know that Doppler Effect or Doppler shift occurs between a source and observer when they are in relative motion with respect to each other. In this case we’ll determine the Doppler shift that occurs when an observer in a supersonic military jet is moving away from a stationary source in a building. A supersonic military jet is a jet that moves faster than the speed of sound thereby leading to a sonic boom. A sonic boom is an explosion that occurs when any object travels faster than sound. Consider a military jet [Observer] moving at Mach2 receding away from a stationary source which is inside the building. We’ll determine the apparent frequency of the source as registered by the observer.

ASSUMPTIONS

1. The atmospheric air has standard temperature and pressure conditions
·         Temperature T = 298 K or 25°C or 77°F
·         Pressure = 1 bar = 105 N/m2
2. The effect of humidity on sound is negligible
3. The amplitude of sound is unity
4. The air molecules do not move with respect to source and observer

CALCULATION

The equation for Doppler shift is given by,
f’ = f0*{[V ± Vo]/[V ± Vs]} (Eqn. 1) 
f0 – Original frequency (Hz)
f’ – Apparent or observed frequency (Hz)
V – Velocity of Sound in air at standard temperature and pressure conditions (m/s) {V = 343 m/s}
Vo – Velocity of observer [Jet] (m/s)
Vs – Velocity of Source (m/s)

Since the source is stationary,
Vs = 0 (Eqn. 2)

Substitute equation (2) in equation (1),
f’ = f0*{[V – Vo]/V} (Eqn. 3)

The ‘–’ sign in the numerator of equation (3) indicates that the observer is receding away from the source.

The velocity of jet Vo = Mach2
           = 2*speed of sound                                           {⸪ Mach1 = speed of sound}
           = 2*343
           = 686 m/s (Eqn. 4)

Frequency of stationary source f0 = 1000 Hz (Eqn. 5)
Speed of sound in air V = 343 m/s (Eqn. 6)

Substitute equations (4), (5) and (6) in equation (3),
f’ = 1000*{[343 – 686]/343}
f’ = 1000 Hz

This is the frequency of sound as registered by the observer in the supersonic military jet when it approaches the stationary source. The negative value of apparent frequency indicates that the object [jet] is traveling faster than sound waves. Since the observer is traveling faster than sound, the sound waves from the source will never catch up with the observer. Therefore the observer in the jet will hear nothing. 

Difference in frequency = f’ – f0
                                       = – 1000 – 1000
                                       = – 2000 Hz

CONCLUSION

We thus determined the apparent frequency as registered by the observer due to Doppler shift and concluded that the observer will not be able to hear any sound from the source.


January 13, 2019

Super sonic doppler shift in military jet pt3

SUPER SONIC DOPPLER SHIFT IN A MILTARY JET PT3


INTRODUCTION

We know that Doppler Effect or Doppler shift occurs between a source and observer when they are in relative motion with respect to each other. In this case we’ll determine the Doppler shift that occurs when an observer in a supersonic military jet is moving toward a stationary source in a building. A supersonic military jet is a jet that moves faster than the speed of sound thereby leading to a sonic boom. A sonic boom is an explosion that occurs when any object travels faster than sound. Consider a military jet [Observer] moving at a speed of Mach2 approaching a stationary source which is inside the building. We’ll determine the apparent frequency of the source as registered by the observer.

ASSUMPTIONS

1. The atmospheric air has standard temperature and pressure conditions
·         Temperature T = 298 K or 25°C or 77°F
·         Pressure = 1 bar = 105 N/m2
2. The effect of humidity on sound is negligible
3. The amplitude of sound is unity
4. The air molecules do not move with respect to source and observer

CALCULATION

The equation for Doppler shift is given by,
f’ = f0*{[V ± Vo]/[V ± Vs]} (Eqn. 1)
f0 – Original frequency (Hz)
f’ – Apparent or observed frequency (Hz)
V – Velocity of Sound in air at standard temperature and pressure conditions (m/s) {V = 343 m/s}
Vo – Velocity of observer [Jet] (m/s)
Vs – Velocity of Source (m/s)

Since the source is stationary,
Vs = 0 (Eqn. 2)           

Substitute equation (2) in equation (1),
f’ = f0*{[V + Vo]/V} (Eqn. 3)
The ‘+’ sign in the numerator of equation (3) indicates that the observer is approaching the source.

The velocity of jet Vo = Mach2
           = 2*speed of sound                                           {⸪ Mach1 = speed of sound}
           = 2*343
           = 686 m/s (Eqn. 4)  

Frequency of stationary source f0 = 1000 Hz (Eqn. 5)          
Speed of sound in air V = 343 m/s (Eqn. 6)

Substitute equations (4), (5) and (6) in equation (3),
f’ = 1000*{[343 + 686]/343}
f’ = 3000 Hz

This is the frequency of sound as registered by the observer in the supersonic military jet when it approaches the stationary source. We observe that the apparent frequency is thrice the original value. This means that the observer will register thrice the original frequency. Since the observer is traveling really fast toward the source, he receives sound waves quickly compared to a stationary observer. The greater the observer’s velocity the greater is the apparent frequency. However the observer will hear sound of different frequency when he moves away from the source which we’ll discuss in the next post.

Difference in frequency = f’ – f0
                                       = 3000 – 1000
                                       = 2000 Hz

CONCLUSION

We thus determined the apparent frequency as registered by the observer due to Doppler shift and concluded that the observer will be able to hear thrice the original value.

January 6, 2019

Super sonic doppler shift in military jet pt2


SUPER SONIC DOPPLER SHIFT IN A MILITARY JET PT2


INTRODUCTION

We know that Doppler Effect or Doppler shift occurs between a source and observer when they are in relative motion with respect to each other. In this case we’ll determine the Doppler shift that occurs when a supersonic military jet is moving away from a stationary observer in a building. A supersonic military jet is a jet that moves faster than the speed of sound thereby leading to a sonic boom. A sonic boom is an explosion that occurs when any object travels faster than sound. Consider a military jet [source] moving at a speed of Mach2 receding away from a stationary observer who is inside a building. We’ll determine the apparent frequency of the jet’s noise as registered by the observer.

ASSUMPTIONS

1. The atmospheric air has standard temperature and pressure conditions
·         Temperature T = 298 K or 25°C or 77°F
·         Pressure = 1 bar = 105 N/m2
2. The effect of humidity on sound is negligible
3. The amplitude of sound is unity
4. The air molecules do not move with respect to source and observer

CALCULATION

The equation for Doppler shift is given by,
f’ = f0*{[V ± Vo]/[V ± Vs]} (Eqn. 1)                                                                                                   
f0 – Original frequency (Hz)
f’ – Apparent or observed frequency (Hz)
V – Velocity of Sound in air at standard temperature and pressure conditions (m/s) {V = 343 m/s}
Vo – Velocity of observer (m/s)
Vs – Velocity of Source [Jet] (m/s)

Since the observer is stationary,
Vo = 0  (Eqn. 2)                                                                                                 

Substitute equation (2) in equation (1),
f’ = f0*{[V]/[V + Vs]} (Eqn. 3)         
The ‘+’ sign in the denominator of equation (3) indicates that the source is receding away from the observer.

The velocity of jet Vs = Mach2
           = 2*speed of sound                                           {⸪ Mach1 = speed of sound}
           = 2*343
           = 686 m/s (Eqn. 4)      

Frequency of jet exhaust noise f0 = 1000 Hz (Eqn. 5)           
Speed of sound in air V = 343 m/s (Eqn. 6)

Substitute equations (4), (5) and (6) in equation (3),
f’ = 1000*{343/[343 + 686]}
f’ = 1000/3

f’ = 333.33 Hz
This is the frequency of sound as registered by the stationary observer in a building when a supersonic military jet moves away from him. We observe that the apparent frequency value drops to one third of the original value. It means the observer will only hear one-third of the original value. The one-third factor is due to the high velocity of the jet, the greater the jet’s velocity the lower is the apparent frequency.

Difference in frequency = f’ – f0
                                       = [– 1000/3] – 1000
                                       = [– 2000/3] Hz
   = – 666.66 Hz

The negative value indicates that the apparent frequency is less than the original value but the magnitude is always positive.

CONCLUSION

We thus determined the apparent frequency as registered by the observer due to Doppler shift and concluded that the observer will be able to hear one third the original frequency of jet noise when the jet is receding away from him.