20raikai
Posts: 1
Joined: Sun Dec 20, 2015 11:36 pm

catapult project ( raspberry pi ) - physics - need help

Mon Dec 21, 2015 12:21 am

My project is there is a catapult and the raspberry pi is thrown by the catapult. Then the raspberry pi will measure the temperature, pressure, and height. My problem is what hardware would I use to get the raspberry pi to track the temperature, pressure, and height. I would then plot the values measured onto a graph.
Has any one done a similar project and can advise on the hardware available which can be used for this project ?

User avatar
liz
Raspberry Pi Foundation Employee & Forum Moderator
Raspberry Pi Foundation Employee & Forum Moderator
Posts: 5202
Joined: Thu Jul 28, 2011 7:22 pm
Contact: Website

Re: catapult project ( raspberry pi ) - physics - need help

Mon Dec 21, 2015 12:41 am

Sounds like you're in the market for a Sense HAT. (As seen in space.)

https://www.raspberrypi.org/products/sense-hat/
Director of Communications, Raspberry Pi

User avatar
jjex22
Posts: 153
Joined: Tue Feb 24, 2015 12:41 pm

Re: catapult project ( raspberry pi ) - physics - need help

Mon Dec 21, 2015 2:48 am

Agreed, the sense hat will be the easiest option in terms of attaching and controlling/reading data. I do wonder if it may not provide the most accurate data for this specific test though. I haven’t got my sense yet, so I don't know the accuracy in a real world settings or how fast they can react to change, but things like air pressure (using the barometric sensor as an altimeter) as a measure of distance from the ground aren't that accurate and will require re-calibrating before each throw to account for variations in pressure due to weather. Throwing indoors may help, but unless you've got quite a large catapult, I don't know how accurate it will be. When we were in Austria a mate had a pretty decent one, and compared to the OS maps it was 10's of meters off our actual altitude at times. You would probably also have to do some engineering wonders with the Pi's crash helmet: air tight and no pressure change, too much wind in flight and you'll risk measuring the increases and decreases in pressure around the Pi as it flies.

It occurs to me that it will probably be more accurate to film a projectile being catapulted in-front of a measured wall and experiment with some pi-cam motion analysis.. or even better, both! compare the video data of the flight, which should give pretty accurate accel, speed and height - thus force, and compare them to the data from the Sense HAT - that'd be pretty useful to the group!
I had the idea for a single board computer in every seat on airplanes... but it all just seemed a bit Pi in the Sky!

User avatar
liz
Raspberry Pi Foundation Employee & Forum Moderator
Raspberry Pi Foundation Employee & Forum Moderator
Posts: 5202
Joined: Thu Jul 28, 2011 7:22 pm
Contact: Website

Re: catapult project ( raspberry pi ) - physics - need help

Mon Dec 21, 2015 10:51 am

It's actually pretty accurate in terms of barometric sensing; we did a lot of testing by embedding one in a foam football and dropping it off the roof of Pi Towers (seriously). I believe Marc has the resulting graphs somewhere!
Director of Communications, Raspberry Pi

User avatar
DougieLawson
Posts: 36578
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: catapult project ( raspberry pi ) - physics - need help

Mon Dec 21, 2015 11:34 am

liz wrote:It's actually pretty accurate in terms of barometric sensing; we did a lot of testing by embedding one in a foam football and dropping it off the roof of Pi Towers (seriously). I believe Marc has the resulting graphs somewhere!
The problem with barometric sensing is that you either need to know pressure at mean sea level (MSL) to use your barometer to give you altitude or you need to know altitude to be able to read your local pressure (from the sensor) and calculate pressure at MSL. You can't get both unknown values for MSL and altitude simultaneously from a local pressure reading.

Code: Select all

#!/usr/bin/python
import math
import sys
import argparse

if __name__ == '__main__':
   parser = argparse.ArgumentParser()
   parser.add_argument('-a', '--altitude')
   parser.add_argument('-p', '--pressure')
   parser.add_argument('-m', '--msl')
   args = parser.parse_args()
   if args.altitude is None:
      args.altitude = 112.2  # Value from my GPS for my house
   if args.pressure is None:
      print "Pressure value required"
      sys.exit(40)
   if args.msl is None:
      args.msl = 1013.25
   args.pressure = float(args.pressure)
   args.altitude = float(args.altitude)
   args.msl = float(args.msl)

   print "Alt:", args.altitude, "Pressure:", args.pressure, "MSL:", args.msl
   print "Sealevel:",args.pressure/pow(1-(args.altitude/44330.0),5.255)
   print "Alt:",(44330.0*(1-pow(args.pressure/args.msl,1/5.255)))
So with a local pressure reading of 999.91 hPa

If I use a local pressure reading and my altitude I can get MSL
pi@pi:~/bmp180$ ./msl_pressure.py -p 999.91 -a 112.2
Alt: 112.2 Pressure: 999.91 MSL: 1013.25
Sealevel: 1013.315221
Alt: 111.658393423
pi@pi:~/bmp180$


If I use local pressure and an MSL reading I can get my altitude
pi@pi:~/bmp180$ ./msl_pressure.py -p 999.91 -m 1013.315
Alt: 112.2 Pressure: 999.91 MSL: 1013.315
Sealevel: 1013.315221
Alt: 112.198164853
pi@pi:~/bmp180$

Your local airport is good for getting close enough MSL values
For example right now London Heathrow (LHR/EGLL) gives me 29.91 inches Hg (1013.0 hPa)

Barometrics isn't good for weapons ranging you really need a GPS (to get an initial fix) and a gyro to maintain it during flight.
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

gregeric
Posts: 1509
Joined: Mon Nov 28, 2011 10:08 am

Re: catapult project ( raspberry pi ) - physics - need help

Mon Dec 21, 2015 12:01 pm

DougieLawson wrote:

Code: Select all

      args.altitude = 112.2  # Value from my GPS for my house
GPS is bobbins viz accuracy wrt altitude - get your home altitude from Ordnance Survey data instead. The better cycling GPS devices include barometers for this reason.

btw nice project idea OP

User avatar
DougieLawson
Posts: 36578
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: catapult project ( raspberry pi ) - physics - need help

Mon Dec 21, 2015 1:03 pm

gregeric wrote:The better cycling GPS devices include barometers for this reason.
But you have to re-calibrate them every time the weather changes, which could by every minute when something like Storm Desmond rolls through. GPS may be off by a few metres but it's consistently inaccurate (the Z is the least accurate value from my old domestic GPS). Barometric has variable inaccuracy - which is why planes use flight levels based on a standard setting of 1013.15hPa.
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

gregeric
Posts: 1509
Joined: Mon Nov 28, 2011 10:08 am

Re: catapult project ( raspberry pi ) - physics - need help

Mon Dec 21, 2015 1:09 pm

I don't know if the commercial GPS units do it, but the android app ipBike recalibrates the barometric altitude every time it sees a known waypoint eg your house as you set off.

User avatar
DougieLawson
Posts: 36578
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: catapult project ( raspberry pi ) - physics - need help

Mon Dec 21, 2015 1:14 pm

gregeric wrote:I don't know if the commercial GPS units do it, but the android app ipBike recalibrates the barometric altitude every time it sees a known waypoint eg your house as you set off.
So it's relying on a known datum because barometric is variably inaccurate.

My GPS is as old as you can get, it can take the old beast five minutes to get an initial fix.
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

gregeric
Posts: 1509
Joined: Mon Nov 28, 2011 10:08 am

Re: catapult project ( raspberry pi ) - physics - need help

Mon Dec 21, 2015 1:22 pm

Barometric is very sensitive (as good as10cm afaicr) but subject to drift over time. For the purposes of the flight of a hand thrown projectile and not an ICBM it's perfect.

jahboater
Posts: 4846
Joined: Wed Feb 04, 2015 6:38 pm

Re: catapult project ( raspberry pi ) - physics - need help

Mon Dec 21, 2015 1:34 pm

The last GPS I had with a barometer would (by default) auto calibrate the barometric altitude from the GPS! It was sensitive to very small changes in height compared to the GPS though.

Modern 60+ channel GPS sets receiving both GPS and Glonass, with differential corrections, are fine for altitude (for hill walking anyway).

BMS Doug
Posts: 3824
Joined: Thu Mar 27, 2014 2:42 pm
Location: London, UK

Re: catapult project ( raspberry pi ) - physics - need help

Mon Dec 21, 2015 1:56 pm

As the interest in the altitude gained is relative (Height above ground rather than height above sea level) could a baseline calibration be taken just before catapult launch and all further calculations show relative altitude above baseline?

This would save any worries about launch position height above ground and give a relative height from the launch device.
(there may well be a reason that this won't work, not my field of expertise).
Doug.
Building Management Systems Engineer.

User avatar
DougieLawson
Posts: 36578
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: catapult project ( raspberry pi ) - physics - need help

Mon Dec 21, 2015 2:15 pm

With barometric measurements that's the best you can do. Correcting for absolute values is non-trivial.
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 24188
Joined: Sat Jul 30, 2011 7:41 pm

Re: catapult project ( raspberry pi ) - physics - need help

Mon Dec 21, 2015 2:18 pm

jahboater wrote:The last GPS I had with a barometer would (by default) auto calibrate the barometric altitude from the GPS! It was sensitive to very small changes in height compared to the GPS though.

Modern 60+ channel GPS sets receiving both GPS and Glonass, with differential corrections, are fine for altitude (for hill walking anyway).
Commercial GPS update rate will be too slow I think (about a second per measurement?). It also has issues with heights and speeds over a certain altitude (to stop it being used for rocket guidance). But perhaps worthwhile adding for completeness.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
“I think it’s wrong that only one company makes the game Monopoly.” – Steven Wright

jahboater
Posts: 4846
Joined: Wed Feb 04, 2015 6:38 pm

Re: catapult project ( raspberry pi ) - physics - need help

Mon Dec 21, 2015 5:46 pm

Commercial GPS update rate will be too slow I think (about a second per measurement?). It also has issues with heights and speeds over a certain altitude (to stop it being used for rocket guidance). But perhaps worthwhile adding for completeness.
Yes indeed, once per second - I agree it sounds unsuitable for a catapult.

jahboater
Posts: 4846
Joined: Wed Feb 04, 2015 6:38 pm

Re: catapult project ( raspberry pi ) - physics - need help

Wed Dec 23, 2015 9:04 am

Perhaps this one from Adafruit might be of interest?
10 updates per second, built-in datalogging, works up to 32km apparently.
http://makersify.com/products/adafruit- ... hz-updates
-165 dBm sensitivity, 10 Hz updates, 66 channels
5V friendly design and only 20mA current draw
Breadboard friendly + two mounting holes
RTC battery-compatible
Built-in datalogging
PPS output on fix
We have received reports that it works up to ~32Km altitude (the GPS theoretically does not have a limit until 40Km)
Internal patch antenna + u.FL connector for external active antenna
Fix status LED

User avatar
karrika
Posts: 1072
Joined: Mon Oct 19, 2015 6:21 am
Location: Finland

Re: catapult project ( raspberry pi ) - physics - need help

Wed Dec 23, 2015 10:47 am

What about just measuring 3D acceleration. With a little integration over time you get the flight path relative to the catapult. No need for other sensors. Except temperature and pressure logging during the flight.

Heater
Posts: 13926
Joined: Tue Jul 17, 2012 3:02 pm

Re: catapult project ( raspberry pi ) - physics - need help

Wed Dec 23, 2015 11:11 am

karrika,
What about just measuring 3D acceleration. With a little integration over time you get the flight path relative to the catapult.
Won't work. An object launched from a catapult and following a parabolic trajectory experiences no acceleration during flight. As far as it is concerned it is travelling in a straight line at constant speed.

You can verify this for yourself by jumping off a tall building and observing how you feel no acceleration as you drop. Or think about the weightlessness of the guys up there in the space station as it orbits the Earth.

This is an observation made by Einstein that led to special and general relativity theory.

Unless you meant integrate the accelerations experienced during the actual launch and calculate the trajectory from that. Might be tricky.
Memory in C++ is a leaky abstraction .

User avatar
karrika
Posts: 1072
Joined: Mon Oct 19, 2015 6:21 am
Location: Finland

Re: catapult project ( raspberry pi ) - physics - need help

Wed Dec 23, 2015 12:02 pm

Newton is enough. You don't need Einstein.

If you know the acceleration you can calculate the velocity

dv = a * dt

and distance

ds = v * dt

If dt is very small like 100ms you get the path.

The projectile may roll during the flight. But we know the two main forces affecting the projectile in flight. Acceleration towards ground and deceleration caused by the air. The air component is strongly related to the speed.

Of course you need to run this during the launch to be able to get the launch speed right,

Heater
Posts: 13926
Joined: Tue Jul 17, 2012 3:02 pm

Re: catapult project ( raspberry pi ) - physics - need help

Wed Dec 23, 2015 4:11 pm

karrika,

You are right, we don't need Einstein here, Newton will do fine. Sorry, I did not word that well.

Newton says it won't work. Not during flight anyway. Ignoring air resistance for a minute, the projectile will experience no accelerations during it's flight. It is basically in orbit around the Earth. Any accelerometers it is carrying will read zero in all directions. As they will if carried on the space station in it's orbit.

We can see this by considering a spring standing on a table with a weight on the top end. Gravity will pull the weight down and compress the spring. Now take the table away, the spring and weight are now free to fall. The spring will extend to it's normal uncompressed length. During the fall to ground the spring and weigh might as well be floating in free space with no gravitational forces acting on them.

We have no a to integrate during flight.

Gyros will work tell us our orientation but that is not much help.

As you say we could measure acceleration during launch and predict the trajectory from it. My feeling is this would be tricky. Launch happens so fast. Then we only have prediction that will get messed up my air resistance, which can be compensated for I guess, and any wind. Any spin of the projectile will require some quite complex sensor fusion so as to figure out which way were are accelerating, perhaps using quaternions. That is probably more than my mathematical chops are up to so I'll leave it at that.

Would probably be much easier if shooting the projectile out of a barrel. Then newtons laws give as what we want as you describe.
Memory in C++ is a leaky abstraction .

gregeric
Posts: 1509
Joined: Mon Nov 28, 2011 10:08 am

Re: catapult project ( raspberry pi ) - physics - need help

Wed Dec 23, 2015 4:38 pm

The sensor, while in flight, may not register that it's experiencing gravity (it experiences weightlessness like in those parabolic flights astronauts & fun-seekers train in).

But when we have retrieved the projectile and recovered its recorded acceleration data, should we want to view the flight profile from our frame of reference, we can assume a downwards force of gravity -g in the z direction & integrate twice too get the trajectory. Of course this becomes all very messy in reality when we have to consider it's likely rotating & the xyz from the accelerometer no longer align with our ground-based axes.

User avatar
karrika
Posts: 1072
Joined: Mon Oct 19, 2015 6:21 am
Location: Finland

Re: catapult project ( raspberry pi ) - physics - need help

Wed Dec 23, 2015 7:31 pm

The rotation does not really matter.

The goal was to find out the height only. So we can assume that the acceleration is always vertical. This means that we can calculate the absolute value of the acceleration instead of a 3D vector.

At start the acceleration = -g (gravity downwards)

When the catapult applies force upwards the acceleration will be something like a-g. (a = catapult acceleration upwards)

When the projectile leaves the catapult the acceleration will be -g-f(v) where f(v) is some force caused by the air resisting the projectile.

When the projectile is at the highest point the acceleration is just -g

During the way back to earth the air will cause a smaller acceleration like -g+f(v)

If we want to also calculate the length of the flight we need to split the acceleration into components and rotate the matrix. As gravity towards earth is constant and the speed along the length axis is almost constant it should be fairly easy to do.

So I would choose acceleration instead of GPS.

If the sensor gives absolute acceleration or changes in acceleration is a detail we may have to deal with and perhaps integrate the values once more. I don't know as I have merely been interested in the small changes.

User avatar
davidcoton
Posts: 4260
Joined: Mon Sep 01, 2014 2:37 pm
Location: Cambridge, UK

Re: catapult project ( raspberry pi ) - physics - need help

Wed Dec 23, 2015 8:47 pm

Heater wrote:
Newton says it won't work. Not during flight anyway. Ignoring air resistance for a minute, the projectile will experience no accelerations during it's flight. It is basically in orbit around the Earth. Any accelerometers it is carrying will read zero in all directions. As they will if carried on the space station in it's orbit.
I don't think you are right. Newton says there is a force (gravity) acting, which, assuming a denser-than-air object, results in acceleration towards the ground. Otherwise an object released with no vertical velocity would float. What is missing is the opposing force we all experience from the ground we stand on. In the case of an object on the ground, the downwards force exerted by gravity and the upwards force of the ground on the object are equal and opposite, and therefore cancel out, so no acceleration relative to the ground.

The problem with measuring acceleration from a catapult is that it can be a high acceleration for a short time, so that even ten readings per second may not give enough resolution to provide valid data for integration.
Signature retired

Heater
Posts: 13926
Joined: Tue Jul 17, 2012 3:02 pm

Re: catapult project ( raspberry pi ) - physics - need help

Wed Dec 23, 2015 11:43 pm

I think we may all me talking at cross purposes here.

Are we wanting to measure acceleration, with accelerometers on the device itself, during flight, during launch, or both?

During flight there is no acceleration registered by the accelerometers, they will read zero in all directions, the object is effectively in free fall. Except of course for the deceleration caused by air resistance, which I'd like to ignore for now.

We could record the accelerations during launch. As karrika says. Given a known starting position, velocity and orientation then measuring the accelerations and rotations (gyros required) during launch should enable us to calculate the resulting parabolic trajectory from the catapult.

My feeling is that this is very hard to do. The launch happens very quickly. A catapult is swinging the projectile through an arc as it throws. The projectile may be rotating this way and that. Integrating all those readings to arrive at a final launch velocity (speed and direction) may accumulate significant error. I may well be over estimating the difficulty here, It's just a feeling.
Memory in C++ is a leaky abstraction .

Heater
Posts: 13926
Joined: Tue Jul 17, 2012 3:02 pm

Re: catapult project ( raspberry pi ) - physics - need help

Wed Dec 23, 2015 11:57 pm

davidcoton,

We should not get confused by "acceleration".

Does that mean actual physical movement at an increasing velocity through space? Like taking distance/speed measurements of a rock falling from a tower. Or measuring the 0 to 60mph acceleration of my Ferrari?

Or does it mean the measurement you get out of an accelerometer stuck to that rock or Ferrari?

Recall that an accelerometer sitting on your desk will record 1g of acceleration due to gravity. Whilst it is permanently stationary!

This is why I mentioned Einstein. He observed that a falling object experiences no effects of acceleration itself whilst falling, despite accelerating at 9.81m/s/s as far as we the observer are concerned.

The thought experiment with a spring and a weight I mentioned above should help make this clear.
Last edited by Heater on Wed Dec 23, 2015 11:58 pm, edited 1 time in total.
Memory in C++ is a leaky abstraction .

Return to “General discussion”