Sensors abstraction

Discussions and support about ChibiOS/EX, the External Peripherals Abstraction Layer.
sdalu
Posts: 35
Joined: Wed Dec 30, 2015 5:31 pm
Has thanked: 1 time
Been thanked: 2 times

Sensors abstraction

Postby sdalu » Wed May 18, 2016 4:35 pm

Usually sensors need some time to acquire data and waiting sequentially for them not necessary a good idea when multiple sensors need to be read.

It would be useful to have, for all the sensors, methods to:
    * know the necessary startup time (when going from disable to enable)
    * start data acquisition (without waiting for it)
    * know the minimum required time for data acquisition
    * read the data available (assuming we have already waited enough)

This would be more event friendly, and allow to have only one thread to: (power up sensors, wait for startup time), start all the data acquisition, only wait max(all_sensors_acquisition_time), read data, (powering off high current drawing sensore, waiting for next cycle).

User avatar
RoccoMarco
Posts: 655
Joined: Wed Apr 24, 2013 4:11 pm
Location: Munich (Germany)
Has thanked: 83 times
Been thanked: 67 times
Contact:

Re: Sensors abstraction

Postby RoccoMarco » Wed May 18, 2016 4:41 pm

Hi,
In EX startup time is always waited. This happens during [sensor]Start(). If you perform the start outside the loop you have to wait just once. Time goes from 1ms up to 10 ms in MEMS I have supported and is always a typical data more than a fixed data. Jumping this power-up time, you will receive messed up data.
Ciao,
RM

sdalu
Posts: 35
Joined: Wed Dec 30, 2015 5:31 pm
Has thanked: 1 time
Been thanked: 2 times

Re: Sensors abstraction

Postby sdalu » Wed May 18, 2016 5:09 pm

Ok, but I don't see how with the current framework you could efficiently implement/use driver for a wide range of sensors. For example in the TLS2591 (light sensor), the various waiting time (according to the desire precision) are part of the datasheet and could reach 600ms. The same goes for the MCP9808 (temperature sensors) with a maximum of 250ms.

That's why I was thinking of exposing more methods to have better control

User avatar
RoccoMarco
Posts: 655
Joined: Wed Apr 24, 2013 4:11 pm
Location: Munich (Germany)
Has thanked: 83 times
Been thanked: 67 times
Contact:

Re: Sensors abstraction

Postby RoccoMarco » Wed May 18, 2016 5:17 pm

I think these methods should be relateted more to a class specific for temperature sensor and light sensor rather than the generic sensor class. Even more if exposure is not related to every light sensor than I think these methods should be specified in the sensor specific vmt.
Ciao,
RM

sdalu
Posts: 35
Joined: Wed Dec 30, 2015 5:31 pm
Has thanked: 1 time
Been thanked: 2 times

Re: Sensors abstraction

Postby sdalu » Wed May 18, 2016 5:30 pm

I don't see these methods as being specific to temperature or light, as every sensors will need time to acquire it's data, that's also the case for the MEMS you used where you choose 10ms

Also, I fail to see why "get_axes_number" is part of the sensors as that's specific to "spatial" sensors (compass, gyro and accelerometer)

User avatar
RoccoMarco
Posts: 655
Joined: Wed Apr 24, 2013 4:11 pm
Location: Munich (Germany)
Has thanked: 83 times
Been thanked: 67 times
Contact:

Re: Sensors abstraction

Postby RoccoMarco » Wed May 18, 2016 5:45 pm

No one says that an axes is something strictly related to space. There is a difference between the power-up time and the settling time. First is time related to powering up a sensor (and it is not required to turn on and off the sensor in most of the applications), second is time required by sensor to exhaust internal transients an this is somehow related to the bandwidth of the sensor or of its ADC.
I will take a look to sensors you have indicated to figure out better what you mean.


Return to “ChibiOS/EX”

Who is online

Users browsing this forum: No registered users and 2 guests