This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
notes:c4eng:fall2022:projects:fso1 [2022/11/16 03:14] – [OVERVIEW] ilaface | notes:c4eng:fall2022:projects:fso1 [2022/11/17 14:07] (current) – [DEMONSTRATION] cmille71 | ||
---|---|---|---|
Line 13: | Line 13: | ||
====OVERVIEW==== | ====OVERVIEW==== | ||
+ | #include < | ||
+ | #include < | ||
+ | #include < | ||
+ | #include < | ||
+ | #include < | ||
+ | #include < | ||
+ | |||
+ | #define rled 28 | ||
+ | #define yled 27 | ||
+ | #define buzzer | ||
+ | #define trigPin 4 | ||
+ | #define echoPin 5 | ||
+ | #define MAX_DISTANCE 220 // define the maximum measured distance | ||
+ | #define timeOut MAX_DISTANCE*60 // calculate timeout according to the maximum m$ | ||
+ | #define gled 1 | ||
+ | //function pulseIn: obtain pulse time of a pin | ||
+ | int pulseIn(int pin, int level, int timeout); | ||
+ | float getSonar(){ | ||
+ | long pingTime; | ||
+ | float distance; | ||
+ | digitalWrite(trigPin, | ||
+ | delayMicroseconds(10); | ||
+ | digitalWrite(trigPin, | ||
+ | pingTime = pulseIn(echoPin, | ||
+ | distance = (float)pingTime * 340.0 / 2.0 / 10000.0; //calculate distance wi$ | ||
+ | return distance; | ||
+ | } | ||
+ | |||
+ | int main(){ | ||
+ | printf(" | ||
+ | |||
+ | wiringPiSetup(); | ||
+ | softToneCreate (buzzer); | ||
+ | float distance = 0; | ||
+ | pinMode(trigPin, | ||
+ | pinMode(echoPin, | ||
+ | pinMode(gled, | ||
+ | // pinMode(buzzer, | ||
+ | while(1){ | ||
+ | distance = getSonar(); | ||
+ | printf(" | ||
+ | softToneWrite(buzzer, | ||
+ | if (distance> | ||
+ | { | ||
+ | digitalWrite(gled, | ||
+ | } | ||
+ | else | ||
+ | { | ||
+ | digitalWrite(gled, | ||
+ | } | ||
+ | if (distance< | ||
+ | { | ||
+ | digitalWrite(yled, | ||
+ | } | ||
+ | else | ||
+ | { | ||
+ | digitalWrite(yled, | ||
+ | } | ||
+ | if (distance< | ||
+ | { | ||
+ | digitalWrite(rled, | ||
+ | digitalWrite(yled, | ||
+ | } | ||
+ | else | ||
+ | { | ||
+ | digitalWrite(rled, | ||
+ | } | ||
+ | |||
+ | delay(10); | ||
+ | } | ||
+ | return 1; | ||
+ | } | ||
+ | |||
+ | int pulseIn(int pin, int level, int timeout) | ||
+ | { | ||
+ | | ||
+ | long micros; | ||
+ | | ||
+ | | ||
+ | while (digitalRead(pin) != level) | ||
+ | { | ||
+ | gettimeofday(& | ||
+ | if (tn.tv_sec > t0.tv_sec) micros = 1000000L; else micros = 0; | ||
+ | micros += (tn.tv_usec - t0.tv_usec); | ||
+ | if (micros > timeout) return 0; | ||
+ | } | ||
+ | | ||
+ | while (digitalRead(pin) == level) | ||
+ | { | ||
+ | gettimeofday(& | ||
+ | if (tn.tv_sec > t0.tv_sec) micros = 1000000L; else micros = 0; | ||
+ | micros = micros + (tn.tv_usec - t0.tv_usec); | ||
+ | if (micros > timeout) return 0; | ||
+ | } | ||
+ | if (tn.tv_sec > t1.tv_sec) micros = 1000000L; else micros = 0; | ||
+ | | ||
+ | | ||
+ | } | ||
====CIRCUIT==== | ====CIRCUIT==== | ||
Line 121: | Line 219: | ||
A Liquid Crystal Display (LCD) is an electronic device, which is frequently used in many applications for displaying information in a text or image format. An LCD is used for displaying the alphanumeric character on its screen. Alphanumeric characters are the numbers 0-9 and letters A-Z (both uppercase and lowercase). The LCD display is consists of 8-data lines and 3-control lines which are used for interfacing the LCD display with 8051 microcontroller. | A Liquid Crystal Display (LCD) is an electronic device, which is frequently used in many applications for displaying information in a text or image format. An LCD is used for displaying the alphanumeric character on its screen. Alphanumeric characters are the numbers 0-9 and letters A-Z (both uppercase and lowercase). The LCD display is consists of 8-data lines and 3-control lines which are used for interfacing the LCD display with 8051 microcontroller. | ||
- | {{: | + | {{: |
Wiring the LCD | Wiring the LCD | ||
Line 133: | Line 231: | ||
The LCD recorded the distance as the object became closer or moved away. | The LCD recorded the distance as the object became closer or moved away. | ||
- | {{: | + | {{: |
=====Joystick Controlling LED Matrix 8 by 8===== | =====Joystick Controlling LED Matrix 8 by 8===== | ||
Line 181: | Line 280: | ||
val_X: 0 , val_Y: 127 , val_Z: 1 | val_X: 0 , val_Y: 127 , val_Z: 1 | ||
- | =====PROJECT 6===== | + | =====16x2 LCD with LEDs===== |
- | ====OVERVIEW==== | ||
+ | ====OVERVIEW==== | ||
+ | I used LEDs to replace the seconds component of the LCD screen and removed the seconds and milliseconds from the display so it only displays hours and minutes. This is made to separate the seconds component from the system time and mathematically derive what LEDs should be lit and which ones should not. | ||
====CIRCUIT==== | ====CIRCUIT==== | ||
+ | The LCD screen is wired like before: VCC pin being connected to 5v, GND connected to ground, SDA connected to an SDA Pi pin, and SCL connected to an SCL pin on the Pi. | ||
- | ====DEMONSTRATION==== | + | The LEDs are also wired how we have wired them in the past. Each LED is wired to a common ground with the other lead of the LED connected to a different GPIO pin, all with 220Ω resistors. |
- | =====PROJECT 7===== | + | {{: |
- | ====OVERVIEW==== | + | ====Code==== |
+ | This LCD screen utilizes a library written in python so the code for the LEDs are as well. Python is very similar to C with only minor syntax differences for what is used for this project. | ||
- | ====CIRCUIT==== | + | the '' |
- | ====DEMONSTRATION==== | + | '' |
+ | Seconds can be isolated by simply putting '' | ||
+ | =====Proximity Sensor===== | ||
+ | |||
+ | ====OVERVIEW==== | ||
+ | Basically my fso1 was a distance sensor with a buzzer and light system. As you get closer the buzzer gets higher pitched If distance> | ||
+ | ====CIRCUIT==== | ||
+ | {{: | ||
+ | ====DEMONSTRATION==== | ||
+ | {{ : | ||
=====PROJECT 8===== | =====PROJECT 8===== | ||
Line 205: | Line 316: | ||
====DEMONSTRATION==== | ====DEMONSTRATION==== | ||
- | =====PROJECT 9===== | + | =====SMART DOOR===== |
====OVERVIEW==== | ====OVERVIEW==== | ||
+ | You might have seen Automatic Door Opener Systems at shopping malls, cinemas, hospitals etc. where, as soon as a person approaches the door (at about 2 or 3 feet), the door automatically slides open. And after some time (about 5 to 10 seconds), the door closes by sliding in the reverse direction | ||
+ | This will be a smaller scale, homemade version using just a simple cardboard box. | ||
====CIRCUIT==== | ====CIRCUIT==== | ||
+ | Sensor: | ||
+ | The PIR motion sensor has 3 pins. One for ground, one for 5v, and one output. | ||
+ | LED: | ||
+ | Plug the shorter leg of the LED to a hole on the breadboard. Connect that leg to a GND pin of the Arduino, | ||
+ | Plug the longer leg of the LED to a different hole, on a different and independent line of the breadboard. | ||
+ | Add a 220 Ohm resistor between this longer leg and a digital pin of the Arduino | ||
+ | Servo motor: | ||
+ | Like the PIR sensor, the servo has 3 pins. One for 5V, one for ground, and one signal wire. | ||
====DEMONSTRATION==== | ====DEMONSTRATION==== | ||
- | + | When an object or person gets close to the door, it will automatically open. | |
- | =====PROJECT 10===== | + | =====4 Digit 7 Segment LED Display with Button===== |
====OVERVIEW==== | ====OVERVIEW==== | ||
+ | The 4 digit display when wired to the pi acts as a counter that begins at 0 and counts up to 9999. It increases by 1 second at a time so it acts as a timer of sorts. With the button wired to it in the form of a lamp switch button, it makes the counter able to be stopped. The timer begins counting when started and when the button is press once, the timer will stop. When the button is pressed again, the timer will continue counting up. | ||
====CIRCUIT==== | ====CIRCUIT==== | ||
- | ====DEMONSTRATION==== | + | {{: |
- | =====PROJECT 11===== | + | |
+ | ==========Model Rocket Thrust Vector Control (TVC)============ | ||
====OVERVIEW==== | ====OVERVIEW==== | ||
+ | In this project, I used the Adafruit Gy-521 and two Servos. These electronics were used for the goal of making sure that a model rocket is properly orientated during its flight and guaranteeing a nominal trajectory for it. | ||
- | ====CIRCUIT==== | + | The GY-521 is an accelerometer/ |
- | ====DEMONSTRATION==== | ||
=====PROJECT 12===== | =====PROJECT 12===== |