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!
[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
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!
PS: Are you secretly hoping someone will write the code for you?
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.
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.
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.
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.