The easiest way to do this is to chose one axis at a time and tilt the accelerometer so that axis is either straight up or straight down relative to the ground. Basically once you have your device reading the Voltages from the A1-A3 analog pins, you have to figure out what your output voltage is from the accelerometer when it measures no acceleration. I have not had the chance to do this step yet because I have not yet received my latest accelerometer. If you are using and ADXLxxx accelerometer connect Vs to 3.3V gnd to Ground Z-axis to A1 Y-Axis to A2 and X-axis to A3. If you have the MMA7361 attach each V to a 5V pin, each Gnd to a Ground pin and Z-axis to A1 pin Y-Axis to A2 and X-axis to A3. If you are still unsure you can easily tell which one is the 3.3V by removing the shield and it is marked on the Arduino. It is directly to the left of the 5V hole. If you need the 3.3V source (for accelerometers without voltage regulators) it is located on the bottom of the shield as a hole. They start on the left with A1 and go through A5. The third and last row is marked S, but they are the Analog outputs of the Arduino. There are three rows of pins on the bottom of the LCD shield (each row has 5 pins) The other option is very bulky you can wire the accelerometer on a breadboard to the Arduino. You also do not have to solder with this option. This works MUCH better because it has a 3.3V voltage regulator and female adapters that fit pins on the LCD shield. I now have ordered an even easier accelerometer: MMA7361 with cable attachments also from DFrobot. I had to touch it for long periods of time to solder the wires and I am sure this is what broke my accelerometer (ADX元30 and ADX元35). Īccelerometers easily overheat so only touch the soldering iron to the chip for 2 seconds max! I did not realize this and bought a cheap soldering iron which did not get hot at the tip. To make the accelerometer more compact I wanted to solder wires directly to the board so I could easily connect them to the shield. This is the step I messed up twice! (note: most accelerometers can only be connected to 3.3V! Luckily there is a 3.3V source on the Arduino Uno r3.) Lcd.setCursor(8,1) // move cursor to second line "1" and 8 spaces over Lcd.print(analogRead(A2)) // display number between 0-1023 corresponding to voltage Lcd.setCursor(8,1) // move cursor to second line "1" and 9 spaces over Switch (lcd_key) // depending on which button was pushed, we perform an action Lcd_key = read_LCD_buttons() // read the buttons Lcd.setCursor(0,1) // move to the begining of the second line Lcd.print("ACCELERATION:") // print a simple message Return btnNONE // when all others fail, return this. If (adc_key_in > 1000) return btnNONE // We make this the 1st option for speed reasons since it will be the most likely result we add approx 50 to those values and check to see if we are close my buttons when read are centered at these valies: 0, 144, 329, 504, 741 define some values used by the panel and buttonsĪdc_key_in = analogRead(0) // read the value from the sensor It was then changed for an accelerometer project Make sure it works by uploading the following sketch (code for Arduino): ( Or wire an LCD screen yourself to the microcontroller) MMA7361 Accelerometer (or any other accelerometer)Īttach your DFrobot LCD shield to your arduino. Here is a link to my Physics Lab Notebook with more details on what I did: Materials you will need: (It will just be an estimate because the main car I will be using does not have an ECU and therefore I cannot measure real engine RPM.) I am planning on using this device in many cars to measure acceleration, calculate real torque put to the wheels, and even estimate real brake horsepower. It measures the acceleration along three axes (Linear and Lateral g as well a Vertical g), which can be changed between by pressing buttons. This project is a hand held g-meter that constantly outputs acceleration on a screen. You can create most of these parts from their cheaper components, but I chose to use pre-made parts like the DFrobot LCD shield for Arduino and accelerometers pre-soldered to boards. It is not yet completed but the whole idea is here for anyone to replicate. I made this project for my Physics 308L class.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |