Using a BMP180 to find altitude, and turning on a led at a certain altitude

I am trying to use the BMP180 Barometer to turn on a LED at a certain altitude.
I am having a lot of problems with libraries for it, and downloading them, but what I really need is for someone to help me write some code.

(I am putting the arduino and BMP180 in a model rocket by the way)

The goal is:
Measuring the altitude of the rocket and displaying it to the serial plotter. Once the barometer realizes that the altitude is decreasing, (the rocket is falling) the arduino is going to turn on a led.

(the LED is actually going to be connected to a pyro charge that is going to deploy a parachute)

It seems like a fairly simple idea, but I am having a whole lot of problems. It would be greatly appreciated if someone could help me out!

Thanks to anyone who can help!

Post what you have so far.

Also search the forum, I’ve seen similar requests multiple times, one within the last week I think.

Honestly, I have nothing yet. I tried to use some code of of the internet, but the libraries it told me to use were seemingly non-existent.

I will keep looking though.

[quote="Give it air: Remember that the BMP180 needs access to ambient air to measure its pressure, so don’t put it in a sealed case. Providing a small vent hole should be adequate.

But not too much air: On the other hand, exposure to fast-moving air or wind can cause momentary pressure variations that will affect your readings. Shield the device from strong air currents.

Keep it cool: Because an accurate temperature reading is needed to measure the pressure, try not to expose the device to rapid temperature changes, and keep it away from nearby hot parts and other heat sources.

Keep it dry: The BMP180 is sensitive to moisture. Don’t submerge it or allow it to contact liquid water.

Don’t blind it: Surprisingly, the silicon within the BMP180 is sensitive to light, which can enter the device through the hole on the top of the chip. For maximum accuracy, shield the chip from ambient light.
[/quote]

I am not going to discuss the code with you, but does your design take all of the above into account? Especially the air movement around the rocket and the port that allows air to the sensor.
Paul

It is easier to help you if we focus on one or two problems at a time.
So, please, ask more specific questions, other wise we waste our time guessing.

Lets start with measuring the altitude and turning on the led once the BMP realizes that it is falling.

Does that sound good?

I would start with less than that - read and display the pressure reading.

I think you are going to need a very long USB cable. :slight_smile:

I have the Adafruit BMP805 Library installed. The “BMP085test” example displays temperature, pressure, and altitude.

And that begins with you showing us what you’ve written so far, even if it’s rubbish (don’t be embarrassed - we all wrote rubbish when we were newbies).

Also, we are going to need a proper description of what the problems are; “a whole lot” is no good! :grinning:

PS: Are you secretly hoping someone will write the code for you?

Okay! thanks!

I found a way to wirelessly connect the arduino to the serial port, so that takes care of that problem!

Are you referring to the libraries? (with the" a whole lot)

And, maybe, maybe not hoping someone will write it lol!
Unfortunately, i have no idea where to start with writing code. On a Word doc. I wrote out what the arduino SHOULD do, but it was not actually in code…

As you could probably tell, I am fairly new to writing code, but I do know somethings.

Why do you want to do that?

We do need to know just what you have done so far - connections and code.

I have two suggestions:

  1. Find the most used BMP180 Library. Install it, then load one of the examples that seems to come with every library. Once you get the BMP180 working you can concentrate on the next step.

  2. I don’t know if you need the altitude vs time in real time or can it be stored on an EEPROM? If EEPROM it will be much easier than adding radio communications as you are somewhat of a novice at this type of project.

After you get the system working and have some time to wring out the bugs, then you can consider if you still want the radio link.

One of the biggest mistakes a novice makes is to try to make all the system at one time. I’ve done this sort of thing before and whenever I start working with a new device I write a small program to exercise the new device. Then I move on to other parts of a project.

That is absolutely fine, and it’s where we all start. However, you have at least three simultaneous challenges:

1/ learning how to write software
2/ learning the C/C++ language
3/ learning the Arduino platform

It’s a significant learning curve to climb. Having said that, I do think it’s doable, and having a goal to motivate you is a tremendous help.

I think @JohnRob has got it spot on: break the end goal into little steps and get each working. It is very common for a newbie to take bites which are too big. As JohnRob says, the first step would be try reading the BMP180 - perhaps once per second - and printing out the result up the serial lead to the PC. Get an idea of what the data looks like; is it steady, or does it have jitter?

Then think about how you will decide when the projectile is falling - how many consecutive pressure readings before you are confident?

Make sure you can turn an LED on and off.

Try to find a way to test it that doesn’t involve risking the rocket - can you rig up some kind of chamber? It could be very crude, maybe just connected to a bicycle pump, or something.

So: break the job into little pieces, implement and test one at a time, build it up. I think it’s a great project and very achievable.

start with doing some of the examples offered in the free Arduino IDE

we cannot offer suggestions if you don’t have some sort of code.

Once you can use a button to turn an LED off and on, and can get the board to read out on your serial monitor, yes, on the bench…

google : Adafruit BMP805 Library installed. The “BMP085test”

down load the example

it is a starting point

it should tell you pressure.

I assume pressure will go

100
99
98
97…
98
99
100
101

and you would be able to say is the new reading is higher than the last reading, then blow something up.

You can bench test in a soda bottle.
Or plastic bag.

Put your sensor in a bag
Close with a clip
Push on the bag with a clip.

Okay, that sounds like a good plan! I will start with getting that example, and get that working first.

Thanks for the guidance! I will keep everyone updated on my progress and go from there!

1 Like

When you are testing blinking the LED, use the Arduino sample “blink without delay”. This will give you a good example of running a program without stopping the code from running between the loops. This will be good to time how often you read the BMP180.

The “bad” way is to use a delay() to time the blinks. The issue is during the delay nothing else can happen.

1 Like

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.