Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Doing maths at what end? Micro or tablet?

Status
Not open for further replies.

atferrari

Well-Known Member
Most Helpful Member
Tablet running RFOBASIC! in Android and micro 18F452 in Assembly.

Micro to do 200 batches of (4+4 ADC conversions) for 2 different voltages. One batch every 3 seconds.

The tablet has to progressively show both voltages in a graph on the screen and save the data in a file when done.

I know how to handle the necessary calculations at both ends but no sure which one could be "better", whatever that means.

Opinions (preferences?) with a minimum of reasons would be interesting to hear.

Gracias for any reply.
 
Not knowing RFO Basic I can't say much about this, but I am interested how do you get the data from PIC to the tablet.
USB or something else?
Can you make standalone apps with RfoBasic ?
 
Last edited:
Not knowing RFO Basic I can't say much about this, but I am interested how do you get the data from PIC to the tablet. USB or something else?

Bluetooth in the simplest possible way.

Can you make standalone apps with RfoBasic ?

Yes, I could but not intending to use it here for the moment.

More and more feeling inclined to do as much as I can with the micro and send data processed, as much as "ready to display" as possible. Tomorrow I should run the first test.
 
  • Like
Reactions: jjw
Augustin..

The Tablet has most probably the far more powerful processor ( even cheap ones sport a quad core 1Ghz+ ) so the maths would be better in the tablet!! However!! This largely depends on RFO basic and how it behaves... Some are very inefficient so excessive math may slow the app down ( I doubt it ) but I personally would use the tablet to do the math!!
 
I would simply send the raw ADC values to the tablet. You are only losing data (possibly accuracy.. in theory) if you process it in the micro and send "ready to display" values to the tablet. You are not solving any problems by processing the data in the micro.. possibly just creating them and limiting what you can do with the data at the tablet end.
 
Thanks for replying, MT and Ian.

I will make the micro to average each 4-readings block to xmit just 2 and 2 bytes. The rest of the pirouethes to display mV values, the tablet will do. Once done, a binary file will be saved on board the tablet.
 
Thanks for replying, MT and Ian.

I will make the micro to average each 4-readings block to xmit just 2 and 2 bytes. The rest of the pirouethes to display mV values, the tablet will do. Once done, a binary file will be saved on board the tablet.

Sounds good. By averaging, do you mean that you add 4 ADC readings and then send that value? .. that is what I would do. That is called "oversampling" and is part of data acquisition and is naturally done at the micro.
 
Sounds good. By averaging, do you mean that you add 4 ADC readings and then send that value?

I thought of also shift-right twice that sum, to average it and then send the resulting value (2 bytes).
 
I thought of also shift-right twice that sum, to average it and then send the resulting value (2 bytes).

I would not do the right-shift. If you add four 10-bit ADC results you can just send that sum to the tablet and treat it as a 12-bit ADC value. You are sending 16-bits anyway. Why discard two bits of information?
If you want to do the right-shift, then shift only once. Summing four ADC results increases the ADC resolution by 1 bit and improves Signal to Noise Ratio by 6dB. If you shift twice, you lose what you gained when adding four results.
**broken link removed**
 
Last edited:
I oversample...... Read the adc 24 times on the trot... The result is pretty good... Then DON'T divide by 6 to get your 12bit... Use the higher value when calculating sensor inputs...

12 bit * map = truncated result..

14.5 bit * map = more accurate sensor result...

If the result is still a bit rocky... stick a 1mS delay in between the readings to surpress it a bit!!
 
I would not do the right-shift. If you add four 10-bit ADC results you can just send that sum to the tablet and treat it as a 12-bit ADC value. You are sending 16-bits anyway. Why discard two bits of information?
If you want to do the right-shift, then shift only once. Summing four ADC results increases the ADC resolution by 1 bit and improves Signal to Noise Ratio by 6dB. If you shift twice, you lose what you gained when adding four results.
**broken link removed**

Hola again mT,

Thanks for putting me in the right track. Found that AN somewhat hard to grasp so I searched and got the app note AVR121 which explains all more in detail.

Now I think I understand the difference between oversampling and a crude averaging as I was intending to do.
 
I oversample...... Read the adc 24 times on the trot... The result is pretty good... Then DON'T divide by 6 to get your 12bit... Use the higher value when calculating sensor inputs...

12 bit * map = truncated result..

14.5 bit * map = more accurate sensor result...

If the result is still a bit rocky... stick a 1mS delay in between the readings to surpress it a bit!!

Hola Ian,

At lost here. MAP ="moving average" or "mean" something?

No sure I can follow your last sentence. Sorry for that.
 
A map is used to convert a scale to another one... Say a sensor reads 3v which represents 120 degrees..

The map is the conversion used.. Funnily enough, The map function on the arduino is called map()

value = map(value, fromLow, fromHigh, toLow, toHigh);
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top