Portable Altimeter using Arduino and pressure sensor (MPL3115A2)
HTML-код
- Опубликовано: 18 сен 2024
- This video shows you how ta make a poratble altimeter based on the pressure sensor MPL3115A2, using an arduino nano.
If you have any questions, ask in the comments !
////////////////////////////////////////////////////////////////////////////////////////////
pull down resistor for the push button of 10kohms
1khm for MPL3115A2
arduino nano:
fr.aliexpress....
7 digits diplay TM1637:
fr.aliexpress....
pressure sensor MPL3115A2:
fr.aliexpress....
battery:
fr.aliexpress....
pcb board:
fr.aliexpress....
7 segments display TM1637 library:
github.com/ree...
Pressure Sensor MPL3115A2 library:
github.com/spa...
Music:
• Adventures - A Himitsu...
TM1637 library :
github.com/ree...
SparkFunMPL3115A2 library :
github.com/spa...
//////////////////////////////////////////////////////////////////////////////////////////
Arduino code + additional libraries:
www.dropbox.co...
if you can to add wireless transmitter to transmit the data to ground arduino with a display then it will be very useful and we can see the alti in real time while controlling the quad... (adding nrf24i01wireless transmitter module )
Hi Kusal !
Sure it will avoid putting electronics in front of the quad and thus unbalancing the quad. However, do you think this module can transmit on such a big distance?
In addition, this module is emitting on a 2.4Ghz frequency which is the same frequency that the radio control of the drone so maybe it is not the best idea.
how do I see the altitude of my model rocket without having to use a camera to see what the rockets max altitude? Many thanks, and by the way, an amazing video. Much more helpful than most others.
Hi JRoxas,
After your flight, pressing the push button will give you the max altitude reached.
However if you want to get the altitude in real time, you should add a wireless transmitter in order to get the altitude during the flight. For example you could use a LoRa module, which is an RF transmitter Arduino friendly module:
www.banggood.com/LoRa-SX1278-Long-Range-RF-Wireless-Power-Mental-Module-For-Arduino-p-1159089.html?gmcCountry=CH¤cy=CHF&gclid=Cj0KCQjwgMnYBRDRARIsANC2dfkHt7C3QBMqbzefDvrYkRAWZaX9cpK06ZGuho8brwXCC3HaL3keOj8aAmoTEALw_wcB&stayold=1&cur_warehouse=CN
I did not try it myself but it should works fine.
@@mrpoulay6121 i was thinking to put the pressure sensor in some vacuum container and apply pressure using some pressure pump will it work? if yes then how much pressure will it sustain
@@ganeshgoli2426 As long as your container is airtight, it should be fine.
The pressure sensor works between 20 to 110kPa. Outside this range, you will have wrong values.
@@mrpoulay6121 ok thnks bro..
Which is maximum altitude attained by the sensor in display
It was 299m
@@mrpoulay6121 I need to use this divice in near space. So I need 700000 feet measurement. How can I measure
@@Independentscientist The altimeter used cannot measure properly a pressure inferior of 110kPa which is around 11km.
I would recommend you to use a GPS. GPS satellite circle the earth at around 20000km which is way behond your objective. So check in that direction and be careful with the temperature and range specification (it can be quite hot or cold up there).
Very nice project well done
Cool video, but it looks like the I2C pull down resistors are not placed correctly. The resistors should not be between the altimeter and the arduino. The altimeter and the arduino should be directly connected, the pull down resistors should be connected from the I2C data lines to GND to pull down the signal when it's low.
Hey Jester!
Those resistors are there to adapt the 5V voltage of the arduino lines and the 3.3V I2C linea of the Mpl3115a2. And your are right I2C requires pull resistors but pull up and not pull down. Those pull up resistor are already on the red PCB of the MPL3115A2.
For more details:
learn.sparkfun.com/tutorials/mpl3115a2-pressure-sensor-hookup-guide/hooking-it-up
@@mrpoulay6121 I stand corrected. You are right, the resistors are placed correctly. I got my altimeter from adafruit. I like the documentation on sparkfun much better. Thanks for the reply!
very helpful thanks a lot can we use BMP180 instead of MPL3115A2 ?
thank you
I need data log to sd card module ... 😕
You can add a sd card module by using the SPI pin on the arduino which are not used.
@@mrpoulay6121 can you prepare me the complete code needed for that
Sent me to gokulgates7@gmail.com
@@Independentscientist It will depend on the module you will use. You can probably find a library to use with the module you choose. Then the code will be quite straightforward.
@@mrpoulay6121 thanks
There seems to be no display. I followed all the instructions and the code was uploaded just fine. Any solutions?
Did you check that your 7 digits display is working proprely ?
@@mrpoulay6121 yes. I am currently trying a sample code. And it seems to be working just fine
@@gemsilog9157 Try to make each components work separatly before combining everything.
@@mrpoulay6121 I guess its the mpl3115a2 pressure sensor thats not working.I bought a chinese one. Im buying a different one right now
error in status 1( altimeter code )
Would you share how to integrate audible alerts at different altitudes?
Hey, on a drone I would not put an audible alert due to the big sound made by the propellers. However, if you intend to use it in a calmer environment, you could easily add a buzzer to it. Here is the link on how to use a buzzer with Arduino, it is quite easy.
create.arduino.cc/projecthub/SURYATEJA/use-a-buzzer-module-piezo-speaker-using-arduino-uno-89df45
HI there, just used this plan to complete my own model. Added a TP4056 charging board too. Works great, tho can you help me with a code to enable the button to cycle through options? such as max pressure and minimum? I also want to go to a negative value based on our start position (using it for measuring altitude for pumps) any insight would be awesome thanks!
Hi Matthew,
I am glad you could improve my project! For the negative value, it is easy just delete the lines 42,43 and 44 of my code which force the altitude to be always positive.
Displaying the minimum pressure will be a little bit more difficult but if you reach this point you should be able to do it. Create a variable called altitude_min and update it each time you reach a new minimum altitude.
To cycle through options either you add another button, either you use a variable to count the number of time you press the button and each time it increases, you display a different option. When your variable reachs the last option, it could go back to the first one.
Good luck!
Mr Poulay thanks very much for your reply I'll see how I go. Great project, thanks for your work
Very good job!!!
Thanks !
Thank you !
Nice
how could I have the sensor output deploy a parachute after a certain altitude is reached?
Once your altitude reached, you can toggle a GPIO pin of the arduino and plug into that whatever parachute mechanism you have.
What is the maximum altitude it can read
Hello
I am having some issues with my sensor. It is indicating always a 0 altitude. When i checked what the sensor is reading, I got a -999 value for the altitude.
Can you help ?
Hello Jad,
Did you connect the MPL as on the schematic? If not maybe you will have to adapt the code. As for the code did you copy the same lines? Don't forget the initialisation it is important for the arduino nano to be able to "talk" to the MPL.
@@mrpoulay6121 I have the same problem I use the code from the download an i checked the schematic multible times
@@yarnevansteenwinckel Weird behavior indeed. Unfortunatly I don't have THE solution. Your best chance to find the problem is to try each piece separately. Just plug the pressure sensor to the arduino and try to get some value of it. Maybe this component arrived broken. Is your arduino fine? Try another component on the I2C pins to be sure it working properly. You could also recheck the value of the resistor to be sure they are 1k ohm. Good luck!
Hi, I have a problem with your .ino Sketch. It does not want to compile/verify. I hope you can help
Hey I can probably help, I don’t know which errors you get but it is maybe due to the fact that I added 2 libraries to make it work (TM1637 library and SparkFunMPL3115A2 library). I just added the links in the description and add them on the dropbox link.
i have the same problem . can you help me !
can i put the pressure sensor in a vaccum container and apply pressure using pressure pump to the container will it work??
There is no reason it should not work, just keep in mind that the pressure sensor is rated for 20 to 110kPa. Outside this range, you will have wrong values.
got it thanks bro..
@@mrpoulay6121 bro the code is not getting complied its showing
"1:20 fatal error :TM1637.h no such file or directory"
@@ganeshgoli2426 You probably did not install the TM1637.h library
@@mrpoulay6121 should i decrease the pressure to get the value or to increase the pressure if i put the sensor in an airtight container
I want to use a bmp 180 .
How can I use it ?
Yes you can use it, the schematic will be the same but the library you have to use will be different and the function will probably have different names.
@@chandanvudala6778 If you add an sd card module and some code to work with, it can definitely work.
Heyyy can you use Arduino Uno instead if using Arduino Nano?
Hello, yes you can use an Arduino Uno instead of the Arduino Nano, it takes just a little more space but pins will be the same.
is the arduino an 5v or 3v
I powered it through a 3.7V battery
where is the battery connected it isn't clear in de vid
It is connected to Vin and to gnd