This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
notes:c4eng:fall2022:projects:fso0 [2022/11/09 19:41] – [COMPONENT 10] dfabbri | notes:c4eng:fall2022:projects:fso0 [2022/11/10 06:06] (current) – [APPLICATION] cmille71 | ||
---|---|---|---|
Line 67: | Line 67: | ||
{{ : | {{ : | ||
====APPLICATION==== | ====APPLICATION==== | ||
+ | The Keypad Matrix is best used when there is a need for a large number of buttons. Such a component can be used for something such as a pin code, but it is basically just a grid of 16 buttons that function the same way a single button does, and a button is a component that, when pressed, sends an electrical signal to some sort of output. | ||
====DEMONSTRATION==== | ====DEMONSTRATION==== | ||
+ | A great way to demonstrate the Keypad Matrix is a program that prints a message telling the user when a button has been pushed, and which button. | ||
+ | |||
+ | The first thing that someone would need to do to do this is to go to | ||
+ | |||
+ | [[https:// | ||
+ | |||
+ | and download the files here onto their raspberry pi. Once in the command terminal for your raspberry pi, you can type a series of commands to run the sample code provided in these files. | ||
+ | |||
+ | * Use cd command to enter 22.1.1_MatrixKeypad directory of C code. | ||
+ | < | ||
+ | |||
+ | * Code of this project contains a custom header file. Use the following command to compile the code MatrixKeypad.cpp, | ||
+ | < | ||
+ | |||
+ | * Run the generated file " | ||
+ | < | ||
+ | After the program is executed, pressing any key on the Keypad Matrix, will display the corresponding key code on the Terminal: | ||
+ | {{ : | ||
=====ultrasonic proximity sensor & lcd 1605 display screen===== | =====ultrasonic proximity sensor & lcd 1605 display screen===== | ||
Line 190: | Line 208: | ||
-Distance from proximity sensor | -Distance from proximity sensor | ||
- | }====DEMONSTRATION==== | + | } |
+ | ====DEMONSTRATION==== | ||
+ | |||
+ | {{: | ||
+ | |||
+ | {{: | ||
+ | |||
+ | Programming a simple function of sequencing the lights down and then back up the LED Bar Graph is rather simple. If you follow the diagram depicted above, you will command the pin low to turn on the LED since we are wiring the GPIO to the cathode side of the LED. | ||
+ | |||
+ | For the code, we will use an array with our wiringPi pin assignments and ensure we set the pins as outputs. Then we will use index to cycle through the array and light our LED's in sequence | ||
+ | |||
+ | {{: | ||
+ | |||
+ | |||
+ | |||
=====HC-SR501 SENSOR===== | =====HC-SR501 SENSOR===== | ||
Line 207: | Line 240: | ||
====DESCRIPTION==== | ====DESCRIPTION==== | ||
+ | This device requires nothing but the display itself and 11 wires to attach the the breadboards pins. There is no ground or voltage pins require either. There are 12 pins on the display but 11 of them are used to attach to the pins of the breadboard. 7 of the pins will control the segments that light up on the display to create the number desired. The other 4 pins will control the position of the number displayed because the display is up to 4 digits. The display should be positioned in a specific direction for it to work and the pins on the wiringPi should exactly match the pins from the Arduino example. | ||
====APPLICATION==== | ====APPLICATION==== | ||
- | ====DEMONSTRATION==== | + | This device allows for 4 digit counting, similar to the LED counting we did weeks ago. This device clearly shows the numbers being displayed however and can count down or up to any number depending on the code written. |
+ | ====Wiring==== | ||
- | =====COMPONENT 11===== | + | {{: |
- | ====DESCRIPTION==== | + | =====LCD Display==== |
+ | ====DESCRIPTION==== | ||
+ | The LCD display contains 2 lines of 16 characters that can display any string of letters, number, or any ascii character. It can be used to display many data inputs such as time or temperature reading from a temperature sensor. It requires four pins: 5v in on the VCC pin, ground to the GND pin, a data connection to from an SDA pin on the pi to the SDA pin on the display, and finally a clock connection from an SCL pin on the pi to the SCL pin on the display. | ||
====APPLICATION==== | ====APPLICATION==== | ||
+ | The library I used was made by the user TheRaspberryPiGuy on github and is a very useful library for running the display. However, it requires the code to be written in python, but he provides many sample programs for learning. | ||
- | ====DEMONSTRATION==== | + | All of the proceeding steps should be executed on your pi, not Lab46. |
- | =====COMPONENT 12===== | + | 1. Download the library |
+ | |||
+ | Run: | ||
+ | < | ||
- | ====DESCRIPTION==== | + | 2. Enter the newly created directory |
+ | |||
+ | < | ||
- | ====APPLICATION==== | + | 3. Install the library |
+ | |||
+ | < | ||
+ | if you are given the error ' | ||
+ | < | ||
+ | to give setup.sh permission to excecute | ||
+ | |||
+ | 4. Reboot your pi | ||
+ | |||
+ | 5. View or run any demos | ||
+ | |||
+ | You can view or run any of the programs labeled demo after running ls. | ||
+ | Programs can be excecuted by running: | ||
+ | < | ||
+ | The code can also be viewed by using nano. | ||
+ | |||
+ | |||
+ | // | ||
+ | |||
+ | **Description** | ||
+ | The GY-521 contains both a 3-Axis Gyroscope and a 3-Axis accelerometer allowing measurements of both independently, | ||
+ | |||
+ | **Specification** | ||
+ | Accelerometer ranges: ±2, ±4, ±8, ±16g | ||
+ | Gyroscope ranges: ± 250, 500, 1000, 2000 °/s | ||
+ | Voltage range: 3.3V - 5V (the module include a low drop-out voltage regulator) | ||
+ | This simple module contains everything required to interface to the Arduino and other controllers via I2C (use the Wire Arduino library) and give motion sensing information for 3 axes - X, Y and Z. | ||
+ | ====APPLICATION==== | ||
+ | The GY-521 can be used to measure the orientation of the device. It can sense motion including vertical and horizontal rotation. There are a lot of practical uses of gyroscope especially in aerospace. It can be used as a stability assistance device to make sure that a rocket, a spacecraft, or an aircraft maintains the correct orientation. | ||
====DEMONSTRATION==== | ====DEMONSTRATION==== | ||