![]() |
Forum Index : Microcontroller and PC projects : Micromite beginner questions
Page 1 of 2 ![]() ![]() |
|||||
Author | Message | ||||
Lee3 Regular Member ![]() Joined: 17/09/2014 Location: AustraliaPosts: 57 |
Hi all... New member from Newcastle. I picked up a little box of goodies from Mick, and am planning on a few projects involving the micromite. I haven't so much as taken them out of the packaging yet, let alone have a flashing LED, and I'm wistfully thinking of a project I'd like to do... My sons and I like to launch model rockets - I'm keen to make an altimeter. I'm planning on using a Bosch BMP085 break-out board with a micromite, and as little else as possible (for weight reasons). I've seen some MMBASIC code to drive a BMP085, and am quietly confident of eventually sorting that part out.... ideally I'll have something compact that will quickly log and record measurements during the rockets flight, so I can review it after landing. Larger rockets could carry a little LCD module on-board - smaller ones would likely prefer to not to have to carry that weight - should it be possible to have the micromite log readings, then plug in a display module afterwards to read the data?? This MMBASIC really brings back memories of my old Amstrad CPC464, many teenage days spent making all sorts of programs, oh to have that much spare time these days! Cheers Lee |
||||
WhiteWizzard Guru ![]() Joined: 05/04/2013 Location: United KingdomPosts: 2927 |
Hi Lee3 - and welcome! The MicroMite is a very versatile micro controller that is both FUN and EASY to program. There are many ways to implement the ability to log data and Im sure many people here will post their ideas. Just for starters, it would be very easy to add an SD card and write the data to that (assuming a fair amount of data). To read data, you don't necessarily need an LCD. SD card could be read by a laptop; however if a laptop is a bit too big for 'field' use then an LCD is very easy to implement to read data on. Out of interest, I have been involved in the development of a MicroMite for use in High Altitude Ballooning. I have a plugin module for my 44-pin MicroMite Module that has GPS, RTC and battery boost circuit onboard. This may be of interest to you although it is limited to low G (3G rate of ascent) which I don't know is within your requirements. It is not on my website yet but will be very soon hopefully. The first home computer I owned was a CPC464 (green monitor). The first project I did was added a high resolution colour monitor (everyone said it wasn't possible!) but got it going a treat. Anyway, welcome - keep posting, and most importantly, have FUN with your MicroMites! WhiteWizzard |
||||
Lee3 Regular Member ![]() Joined: 17/09/2014 Location: AustraliaPosts: 57 |
Thanks - I'll keep an eye out for that module - sounds educational/useful. My estimations are these little rockets make 100-200m altitude in 2-3s, which my calcs would suggest average accelerations of approx 2-4G, maybe I should look at an accelerometer project too.... :) |
||||
TassyJim![]() Guru ![]() Joined: 07/08/2011 Location: AustraliaPosts: 6224 |
You will need to look at how quickly the BMP085 does it's readings. You don't have a lot of time to play with. I would also look at serial eeproms for data storage, assuming that you will be able to recover the payload. Jim VK7JH MMedit |
||||
WhiteWizzard Guru ![]() Joined: 05/04/2013 Location: United KingdomPosts: 2927 |
An alternative solution (which is perfect for data logging) is to use FRAM chips; all the speed benefits of dynamic RAM, yet all the non-volatile benefits of flash memory but WITHOUT any read/write life cycle issues. Example part code from RS: 733-2253 (many other variants exist - just had these to hand next to my desk!) WW |
||||
Lee3 Regular Member ![]() Joined: 17/09/2014 Location: AustraliaPosts: 57 |
The datasheet indicates 7.5ms for standard resolution readings of (uncalibrated) barometric pressure.... I'm hoping to be able to get even 10-20 per second, should be enough to resolve the apogee of flight well enough? Each reading is only 2 bytes (I think!) - I was thinking the micromite would have enough spare RAM to record several seconds worth of flight. |
||||
Grogster![]() Admin Group ![]() Joined: 31/12/2012 Location: New ZealandPosts: 9502 |
FRAM chips - very interesting. I did not even know they existed. I always went right to the EEPROM memory chips if I needed one. ...but I digress... Smoke makes things work. When the smoke gets out, it stops! |
||||
TassyJim![]() Guru ![]() Joined: 07/08/2011 Location: AustraliaPosts: 6224 |
If you don't have the BMP085 yet, I have this code running on a micromite: ' reading the BMP085 pressure sensor
' TassyJim 06 JAN 2014 'Cls Dim BMPData(2) ' store data from BMP085 dim cal(11) ' calibration data oss = 0 ' over sampling 0 to 3 alt = 240 ' your altitude in metres BMP085calMEM = &HAA ' start of 11 calibration values BMP085address = &H77 ' BMP085 address BMP085control = &HF4 ' BMP085 control register BMP085temp = &H2E ' BMP085 temperature command BMP085pres = &H34 ' BMP085 pressure command BMP085pres = BMP085pres + oss*&H40 ' adjust command for oversampling BMP085reading = &HF6 ' register for results of reading I2C open 400, 200 ' Enable I2C. use slow speeds for long leads pause 20 z = Calibrate() ' read the calibration data do 'logfile$=mid$(Date$,7,4)+mid$(Date$,4,2)+mid$(Date$,1,2)+". log" timer = 0 t=temperature() p=pressure(oss) readingtime=timer p0=Psl(p,alt) print time$;" T:";str$(t,3,1);" P:";str$(p/100,5,1);" P(sl):";str$(p0/100,5,1);" Time: ";readingtime;" mS" pause (10000) ' delay 10 seconds between readings loop until k$ = "q" or k$ = "Q" 'pin(0)=1 end function Calibrate() ' needs to be called once for each module. ' safest to do it on every program start. local n, calMEM calMEM= BMP085calMEM for n = 1 to 11 I2C write BMP085address, 0, 1, calMEM ' first calibration location pause 1 I2C read BMP085address, 0, 2, BMPData(0) 'print BMPData(1), BMPData(0)*256 + BMPData(1) cal(n) = BMPData(0)*256 + BMPData(1) if n < 4 or n > 6 then ' need to convert some to signed numbers if cal(n) > 32767 then cal(n) = cal(n) - 65536 endif endif 'print n,cal(n) pause 1 calMEM=calMEM+2 ' advance to the next calibration location next n end function function temperature() ' returns the temperature in degrees C to one decimal place local UT, x1, x2, b5 I2C write BMP085address, 0, 2, BMP085control, BMP085temp pause 5 I2C write BMP085address, 0, 1, BMP085reading I2C read BMP085address, 0, 2, BMPData(0) UT = BMPData(0)*256 + BMPData(1) 'calculate true temperature x1= int( (UT-cal(6))*cal(5)/32768) x2=int( cal(10)*2048/(x1+cal(11))) b5=x1+x2 temperature = int((b5+8)/16)/10 end function function pressure(oss) ' returns the pressure in pascals. Divide by 100 for millibars ' recalculates the temperatre. ' time could be saved by reading the temperature once evry 10 minutes ' when taking readings at short intervals local UT, UP, x1, x2, x3, b5, b6, b7, pres, p pres = BMP085pres + oss*&H40 I2C write BMP085address, 0, 2, BMP085control, BMP085temp pause 5 I2C write BMP085address, 0, 1, BMP085reading I2C read BMP085address, 0, 2, BMPData(0) UT = BMPData(0)*256 + BMPData(1) I2C write BMP085address, 0, 2, BMP085control, pres if oss = 0 then ' different oversampling requires different pause 5 ' reading times elseif oss = 1 then pause 8 elseif oss = 2 then pause 14 else pause 26 endif I2C write BMP085address, 0, 1, BMP085reading I2C read BMP085address, 0, 2, BMPData(0) UP = BMPData(0)*256 + BMPData(1) I2C write BMP085address, 0, 1, BMP085reading+2 I2C read BMP085address, 0, 1, BMPData(0) UP=(UP*256+BMPData(0))/2^(8-oss) 'calculate true temperature x1= int( (UT-cal(6))*cal(5)/32768) x2=int( cal(10)*2048/(x1+cal(11))) b5=x1+x2 t=int((b5+8)/16)/10 'print "Temperature: ",t 'calculate true atmospheric pressure b6 = b5 - 4000 x1 = int((cal(8)*(b6*b6/4096))/2048) x2 = int(cal(2)*b6/2048) x3 = x1 + x2 b3 = int(((cal(1)*4+x3)*2^oss +2)/4) x1 = int(cal(3)*b6/8192) x2 = int((cal(7)*(b6*b6/4096))/65536) x3 = int(((x1+x2)+2)/4) b4 = int(cal(4)*x3/32768+cal(4)) b7 = int((UP - b3)*(50000/2^oss)) p = int((b7*2)/b4) x1 = int(int(p/256)*int(p/256)) x1 = int((x1*3038)/65536) x2 = int((-7357*p)/65536) pressure = int(p+(x1 + x2 + 3791)/16) end function function Psl(p, alt) 'given local pressure and altitude, returns pressure at sea level Psl= p/(1-alt/44330)^5.255 end function function uFormat$(x,p) ' given a number (x) and the required number of decimal places (p) ' returns formatted string. Negative and zero p is permitted local f$ f$=str$(cint(x*10^p)) if len(f$)<=p then f$=string$(p+1-len(f$), "0")+f$ endif if p>0 then uFormat$=left$(f$,len(f$)-p)+"."+right$(f$,p) elseif p = 0 then uFormat$=f$ else uFormat$=f$+string$(abs(p),"0") endif end function function myAlt(p, p0) ' given local pressure (p) and pressure at sea level (p0) ' returns altitude in metres myAlt = 44330*(1-(p/p0)^0.1903) end function It outputs a reading every 10 seconds. You can telnet to it at tassyjim.ddns.net port 3002 You have full access so you can stop the program with ctrl-C and start again with RUN You can also edit without causing any disaster at this end. (My coffee machine is controlled by a different micromite). I recommend TeraTerm but you may need to edit the INI file to change the line at a time mode to OFF It takes 28mS for a reading with this program so that is OK. I am not sure how fast the module responds to changes in pressure or how much time you need to leave between readings. At least their data sheet is comprehensive. I will be using these units for water level meters and I want to map my property using GPS and pressure. I will have one set stationary and the other set on the mower/tractor/backpack. I can then use differential readings to hopefully get reasonably accurate profiles. Jim VK7JH MMedit |
||||
G8JCF![]() Guru ![]() Joined: 15/05/2014 Location: United KingdomPosts: 676 |
Hi Jim I've just telnet'ed in and 17:50:11 T: 21.2 P: 983.4 P(sl): 1011.8 Time: 27 mS It's quite warm there I see !! Take care Peter The only Konstant is Change |
||||
TassyJim![]() Guru ![]() Joined: 07/08/2011 Location: AustraliaPosts: 6224 |
That's on a shelf in the office, but yes, it go up to 19 today... Jim VK7JH MMedit |
||||
Juri74![]() Senior Member ![]() Joined: 06/02/2012 Location: ItalyPosts: 162 |
since weight is the problem i would use less components possible: i would use a 44-pin MicroMite MX170 with really minimal pcb (power wires, serial wires and connection wires to the bmp085. if you make 20 reads per second it would need 40 bytes of ram per second. 10kb of ram can log 250 seconds. the mx170 does have 54kb of free ram. using, for example, 40kb of ram you can hold about 1000 seconds! that just an idea :) Juri |
||||
Lee3 Regular Member ![]() Joined: 17/09/2014 Location: AustraliaPosts: 57 |
Thanks for the memory info Juri - I suspect the weight limiting factor may the battery rather than the chip though.... Lee |
||||
Geoffg![]() Guru ![]() Joined: 06/06/2011 Location: AustraliaPosts: 3272 |
The program running on the Micromite could put itself to sleep immediately on startup. Then a simple acceleration detector could be used to wake it up and start logging. Finally, when it had filled its RAM (say 1000 seconds), the program could put itself back to sleep again. A single CR2025 miniature button battery (weight 2.4g) would last for a dozen or more flights. The battery would weigh less than a SD card. Geoff Geoff Graham - http://geoffg.net |
||||
ajkw Senior Member ![]() Joined: 29/06/2011 Location: AustraliaPosts: 290 |
Hi Lee, Sounds like a very interesting combination of technology. I look forward to hearing your progress. Sorry for the thread hi_ack (Gee do you want to type that word into a public forum these days???) @TassyJim If I may, what is your configuration file setting for SER2NET? (Perhaps PM) |
||||
TassyJim![]() Guru ![]() Joined: 07/08/2011 Location: AustraliaPosts: 6224 |
Not very special: 3002:telnet:1000:/dev/ttyUSB0:38400 banner1 Jim VK7JH MMedit |
||||
Lee3 Regular Member ![]() Joined: 17/09/2014 Location: AustraliaPosts: 57 |
Geoff - I thought CR2025 and the like were really only good for <1mA drain - do you think it will be adequate driving the umite/BMP085? Would it be pushing it to try and include a small LCD module as well??? I've got about 20g I can add to the small rockets I fire locally, before I hit their safe lift-off weight.... Cheers Lee |
||||
Geoffg![]() Guru ![]() Joined: 06/06/2011 Location: AustraliaPosts: 3272 |
Good point, the internal resistance can get quite high on them... so that was a bad choice ![]() But there are plenty of other batteries - my point is that by putting the Micromite to sleep you only have to power it for the flight time (which I assume is short). This means that you can use a small capacity battery which also should be lightweight. I will leave the battery choice to you. Geoff Geoff Graham - http://geoffg.net |
||||
MicroBlocks![]() Guru ![]() Joined: 12/05/2012 Location: ThailandPosts: 2209 |
Supercap? This one is 450mg. http://au.mouser.com/ProductDetail/Cooper-Bussmann/PHB-5R0V5 05-R Microblocks. Build with logic. |
||||
Geoffg![]() Guru ![]() Joined: 06/06/2011 Location: AustraliaPosts: 3272 |
Wow, 5 Farads at 5V. That is an incredible capacity. That should be enough to power the Micromite (alone) for the required 1000 seconds and then sleep for days. Geoff Graham - http://geoffg.net |
||||
Lee3 Regular Member ![]() Joined: 17/09/2014 Location: AustraliaPosts: 57 |
The small rockets I'm looking at first reach apogee at 2-3s, then parachute down over 10-20s maybe, I'd be happy for the umite to record the max alt/lowest pressure, then sleep - so maybe a supercap is the way forward.... I've seen some tiny lipo's online also... will do some bench testing once I have a working circuit, might be a while! :) |
||||
Page 1 of 2 ![]() ![]() |
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |