Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 11:12 01 Aug 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : Datalogging with MM’s

Author Message
plover

Guru

Joined: 18/04/2013
Location: Australia
Posts: 306
Posted: 02:07pm 11 Sep 2018
Copy link to clipboard 
Print this post

For some time I have been meaning to find out about some datalogging applications using MM's. Not really getting anywhere as it seems I moving in the direction of doing some smaller research job but with high power stuff. This is eating my time.

Anyway I would like to hear if anybody has/is logging say 4 Analog and 3 digital signals as fast as possible. I know it is a bit vague but would like to get started collecting information.

Using mm's what is possible time intervals, seconds, milliseconds, microseconds ??
 
CaptainBoing

Guru

Joined: 07/09/2016
Location: United Kingdom
Posts: 2170
Posted: 06:09pm 11 Sep 2018
Copy link to clipboard 
Print this post

only loosely connected with your topic, plover. I developed this trinket as a means of logging over reasonably long periods and intended to survive power failures.

http://fruitoftheshed.com/MMBasic.Ultra-Compact-Logging-with-Flash-Storage-on-small-MicroMites.ashx

You could adapt this for logging and I have a project that uses a similar scheme for logging much tighter loops over an hour in my beer-barrel sterilizer unit. That is fitted inside a keg and goes through the autoclave with the barrel to measure the environment (mainly temperature) to certify the sterilization process. The above could be adapted to handle most things where 270-ish log entries is OK - about the limit of the 2K flash space for stored variables.

Might give you some ideas, there are some bolt-on chips that can provide much more than 2K but ths was specifically derived for zero component count and as a retro-fit to existing systems by software update only. It smoothly solved two different problems, oe for logging over long periods of few data points an the other for logging at 15 second intervals for 27 minutes. I did raise the question of getting the 2K space under program control via an option or something but I understand it is not a trivial task.

hth

hEdited by CaptainBoing 2018-09-13
 
plover

Guru

Joined: 18/04/2013
Location: Australia
Posts: 306
Posted: 01:08am 12 Sep 2018
Copy link to clipboard 
Print this post

Interesting reading. Winbond chip extra memory, forgotten about those in this context.

I was wondering what could be squeezed out of the chips them selves. Right now I am thinking of as fast as possible. Say single channel analog conversion sampled as fast as possible.

Possible to get down to sub millisecond sampling?
 
panky

Guru

Joined: 02/10/2012
Location: Australia
Posts: 1114
Posted: 01:20am 12 Sep 2018
Copy link to clipboard 
Print this post

@plover

Just ran a couple of tests on a 120MHz 470 MM+

- a loop to read an analog pin and save the results in a 1000 element array takes about 270mS so a single read takes somewhere in the region of about 70 to 90uS (taking into account the time lost in the loop construct).

So realistically, the fastest you could read in analog data and save into an array would be in the region of 300uS per read (for a 120MHz MM+ - if you need a lot faster then either CFunctions or MMX or Armmite versions).

Now, however, you run into the problem of what to do with the data and how frequently you want to sample. In essense, you can sample small amounts of data quickly (300uS per sample into an array), or large amounts of data slowly ( say 1 sample per second into an 60 element array then each minute, average this array and save into another 60 element array giving you an hours worth of data based on minute averages)

Keeping in mind that you have limitations on memory for your array sizes and the frequency of logging to a SD card or flash RAM chip so it is all a bit of a trade-off.

panky

... almost all of the Maximites, the MicromMites, the MM Extremes, the ArmMites, the PicoMite and loving it!
 
plover

Guru

Joined: 18/04/2013
Location: Australia
Posts: 306
Posted: 11:41am 12 Sep 2018
Copy link to clipboard 
Print this post

panky
Thanks for information so so going down to the lower frequencies even longer periods.

What do you reckon about sampling the mains frequency, 20 ms period. Say 100 samples, ie 50 per half period.

I will run sinewave period or half period through the spread sheet in 50 samples per half period. Would give an idea of resolution.
 
Chopperp

Guru

Joined: 03/01/2018
Location: Australia
Posts: 1097
Posted: 12:01pm 12 Sep 2018
Copy link to clipboard 
Print this post

plover

50 samples per half cycle is one sample every 0.2 mSec.

I don't know if can do this or not, but if you took a sample every 20.2 mSec (one cycle + 0.2 mSec), you would then build up a replica sinewave over 100 cycles or so (2 secs).

(If the waveform was changing quickly though, this wouldn't work too well. )

Brian
ChopperP
 
Quazee137

Guru

Joined: 07/08/2016
Location: United States
Posts: 593
Posted: 11:42pm 12 Sep 2018
Copy link to clipboard 
Print this post


I have been playing with these FRAMS made by Fujitsu from Digikey

MB85RC64TAPNF-G-BDERE1 IC FRAM 64K I2C 3.4MHZ 8SOP $1.44
MB85RC128APNF-G-JNE1 IC FRAM 128K I2C 1MHZ 8SOP $2.54
MB85RC256VPNF-G-JNERE1 IC FRAM 256K I2C 1MHZ 8SOP $3.52
MB85RC512TPNF-G-JNERE1 IC FRAM 512K I2C 3.4MHZ 8SOP $5.16
MB85RC1MTPNF-G-JNERE1 IC FRAM 1M I2C 3.4MHZ 8SOP $5.65

by replacing the chips on the RTC modules with them.

I am still working on a VAR type function for these.
My understanding of C is slower than I'd like but its a time thing.
Working other boards for PH / Conductivity / 4-20MA converters are higher up the
list of needs to be done now.

One though I have been looking at is the saving all 170 ram to the FRAM at timmed
intervals/events then on power up reload the 170 ram. Trying to learn the CFunctions
and tools set for Linux Mint to work on this. My 1st try was in MMBasic but easy to
stomp on the reload vars in code while the CFunction may not. I'll need some help
there.

The other though is MB85RC1MTPNF-G-JNERE1 is 128K by 8 in two banks of 64K.

First bank to hold copy of 170 RAM then using 2nd bank to hold loadable functions
but don't know if code can run in 170 RAM.

That way we could get more customized functions that do not need to be added to the
base code of MMBasic much like the Library.

 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6283
Posted: 12:24am 13 Sep 2018
Copy link to clipboard 
Print this post

  plover said   panky
Thanks for information so so going down to the lower frequencies even longer periods.

What do you reckon about sampling the mains frequency, 20 ms period. Say 100 samples, ie 50 per half period.

I will run sinewave period or half period through the spread sheet in 50 samples per half period. Would give an idea of resolution.


THis is a copy of a post from 2015 describing a disturbance recorder I put together"

Many years ago (everything seems to have happened many years ago), I worked in the power industry and we have some wonderful old instruments. One I liked was a disturbance recorder. Whenever it was triggered, it would spit out a couple of metres of paper with a chart of the voltages and currents for a few seconds before the event and a few seconds after.

Last week I was sitting at the 'puta when there was a power 'disturbance'. I missed the pretty charts so micromite to the rescue.

The idea is to have one micromite continually reading the voltage and when triggered, spit the 5000 readings out to be analyzed.
A MX150 micromite can take 30 readings per 50Hz cycle and a maximum of 5000 readings.
That gives around 3 seconds.
If you trigger it 2 seconds after the 'event', you will end up with 1 second of pre-event and 2 seconds of post-event.

A MX170 can read a bit faster and store more samples.

I will end up triggering from a second micromite similar to Grogster's setup.

If you aren't interested in looking at the AC waveform, use a rectifier and a small filter capacitor then slow the reading rate down.

For the AC input I found an old plug-pack with AC out.

The chart is a portion of a test drawn in Excel.






DIM readings(5000)
SETPIN 5, INTL, snap
SETPIN 4, AIN
n=1
DO
readings(n)=PIN(4)
n = (n+1) MOD 5000
LOOP
END

SUB snap
FOR k = 1 TO 5000
PRINT readings((k+n) MOD 5000)
NEXT k
END SUB


There is no time for the micromite to do any calculations during capture but I am impressed with the quality of the waveform in Excel.

I didn't get past the proof of concept stage but I might revisit it one day.

Note: Analog is deliberately slow on all 'mites due to the multiple readings taken before averaging to increase the effective resolution.

JimEdited by TassyJim 2018-09-14
VK7JH
MMedit
 
plover

Guru

Joined: 18/04/2013
Location: Australia
Posts: 306
Posted: 12:36pm 13 Sep 2018
Copy link to clipboard 
Print this post

Jim

Well the most amazing. A "disturbance recorder" you have my attention. The 3 seconds looks good for starters. Are you saying there is topic on this forum somewhere?

I was thinking initially of course everything in one mite. Distributing operation interesting idea. Yes idea of dumping it in excel for fast post mortem analysis saves a lot of design work.

You shave selected 30 samples/50Hz/20ms/20000us or approx each 666.6us you take a reading.

Is that the fastest that can be done? Have you got a bit of spare capacity up your sleeve. Running highest clock speed.

Would the so called CFunctions be able to improve speed

  Quote  Analog is deliberately slow on all 'mites due to the multiple readings taken before averaging to increase the effective resolution.


In practice what does this mean. What happens if the averaging is thrown overboard?

Above is assuming MMBasic is run?

Just of curiosity, how much can it be pushed if programming done in C and compiled in. (Then I am pretty well out of the race, but I am curious for comparison)

Oh, by the way what was the comment about Grogster, has he already got something like this running?? Edited by plover 2018-09-14
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10310
Posted: 06:58pm 13 Sep 2018
Copy link to clipboard 
Print this post

  Quote  Just of curiosity, how much can it be pushed if programming done in C and compiled in.


' Maximum conversion rate is approximately 1.8 Megasamples / second on each channel at 10-bits resolution on MM+
' Maximum conversion rate is approximately 0.9 Megasamples / second on each channel at 10-bits resolution on uM2

See this post
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6283
Posted: 10:16pm 13 Sep 2018
Copy link to clipboard 
Print this post

  plover said   Jim

Well the most amazing. A "disturbance recorder" you have my attention. The 3 seconds looks good for starters. Are you saying there is topic on this forum somewhere?

Do a search on the forum for "disturbance recorder" The earliest reference is in a thread started by Grogster about a power monitor.

I was using a MX150 at the standard clock speed.
The plan was to run one chip doing the readings and a second chip to decide when to trigger the capture SUB.

I could try with an Armite which would be a lot faster. If you are looking at accurate frequency measurement, you would need a 'mite that uses a crystal timebase.

If I remember correctly, MMBasic takes 10 readings, discards the highest and the lowest then averages the remaining 8 readings.
The microchip chips are not great at analogue reading and only 10 bit. This vastly improves the readings at the expense of speed.

A CFUNCTION could forget about the precision and log each reading to an array for a burst of high speed capture.

Jim
VK7JH
MMedit
 
plover

Guru

Joined: 18/04/2013
Location: Australia
Posts: 306
Posted: 02:25pm 14 Sep 2018
Copy link to clipboard 
Print this post

Thank you both.

My head is spinning, I searched an I read for what seemed a long time. Trying to digest what I read.

With 0.9Msamples/s, 20ms period time for 50HZ this would then give
20ms*0.9M/s =18 MS = 18000S where capital S stands for Sample(s)

Assuming 3 seconds observation time, total S would be
3000ms/20ms/cycle =150 cycles each at 18000S = 150*18000S =2,700,000S

Rounding up to say 3 million samples.

As I understand Each sample need to be tucked away in a "ring buffer" of 3 Million data points. Each Datapoint 10 bits wide. This is done by one Mite.

Is this feasible, assuming no CD card for starters. Using some solid state memory?

The second Mite looks after the abnormal various transients and make the when a record need to be stored away for later investigation.

What sort of memory to use and how is it connected, serial/parallel?

What is the cost in decreased Max samples of doing the data storing?

Edited by plover 2018-09-16
 
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025