High resolution light measurement
#21
Posted 18 September 2011 - 10:10 PM
#22
Posted 18 September 2011 - 11:27 PM
One cheap way to do this is with a TI MSP430 board which only costs $4.30 delivered (https://estore.ti.co...-kit-P2031.aspx ) This is probably the cheapest way to do a one-off project and the TI chip has reasonably good support.
The best way to look at this is that there is no one perfect single board computer. The key is to use one appropriate to the task and remember that they are cheap enough that you can break the task down and use more than one board.
#23
Posted 19 September 2011 - 01:38 AM
I am still not convinced that I need to throw more components at this problem. Netduino has an ARM7 48MHz processor- why should we deny that there is plenty of speed right on this development board? If I were to remove the processor from the Netduino and program it directly, or remove the .Net firmware and run C/C++ on it, I am sure that this sensor would run fine. I've read in these forums that version 4.1.2 of the Netduino firmware is supposed to offer run-time native code interop. I've also read about someone's project called "Fluent", which runs code something like 20 to 30 times faster than the managed code. I've also read that you can run FreeRTOS on the Netduino platform. Can't you run a quadrocopter with FreeRTOS? Isn't that real-time?
Does version Netduino 4.1.2 have runtime native code interop? If not, when will it have this functionality? Where can I get this "Fluent" project? Where can I find resources on how to run my own C/C++ on this board?
I understand the opinion that more tools will help me solve this problem, but I would rather use what I have instead of having to then deal with connecting, learning, and powering these other pieces.
#24
Posted 19 September 2011 - 02:42 AM
The issue is the .Net Micro Framework. If you are willing to forgo .Net and program directly to the chip in C, you can get the job done.
What s not as simple or easy is to combine the use of .Net with native code and direct control of hardware interrupts etc. It may very well be possible, and I hope you succeed as we would all like this capability. You should be prepared for some setbacks along the way.
Can an Atmel AT91SAM7X512 microcontroller support the functions of the Taos TSL235R?
I am still not convinced that I need to throw more components at this problem. Netduino has an ARM7 48MHz processor- why should we deny that there is plenty of speed right on this development board? If I were to remove the processor from the Netduino and program it directly, or remove the .Net firmware and run C/C++ on it, I am sure that this sensor would run fine. I've read in these forums that version 4.1.2 of the Netduino firmware is supposed to offer run-time native code interop. I've also read about someone's project called "Fluent", which runs code something like 20 to 30 times faster than the managed code. I've also read that you can run FreeRTOS on the Netduino platform. Can't you run a quadrocopter with FreeRTOS? Isn't that real-time?
Does version Netduino 4.1.2 have runtime native code interop? If not, when will it have this functionality? Where can I get this "Fluent" project? Where can I find resources on how to run my own C/C++ on this board?
I understand the opinion that more tools will help me solve this problem, but I would rather use what I have instead of having to then deal with connecting, learning, and powering these other pieces.
Thanks,
Nick
#25
Posted 19 September 2011 - 04:20 AM
#26
Posted 19 September 2011 - 06:31 AM
Given the low performance of Netduino's managed interrupt handlers, have you considered using light-to-digital converters? Not sure about the price and availability, though.Do you think the light-to-frequency converter would work for a Netduino project like this?
#27
Posted 19 September 2011 - 07:21 AM
It definitely can. However, on Netduino the only reasonable way is to access hardware Timer-Counter (TC) module via native driver, because the managed interrupts are queued, the queue size is only 128 items, it takes roughly hundreds of microseconds before the handlers are executed and the resolution of 'slow clock' is only 21.33 µs, which determines the precision of time measurement (but it can be increased).Can an Atmel AT91SAM7X512 microcontroller support the functions of the Taos TSL235R?
One way to implement frequency counter would be:
- Use TC2 (the only one which has input signals TIOA/TIOB broken out) in capture mode,
- Configure clock source based on the desired precision and frequency range - this may be a little bit tricky, because there are only five clock frequencies (MCK/2, MCK/8, MCK/32, MCK/128 and MCK/1024, where MCK is Master Clock = 48 MHz) and timer register is 16-bit, however this can be easily worked around by using 'overflow' counter in the timer Interrupt Service Routine (ISR), and/or passing the clock ('frequency range') as parameter to the managed class,
- If needed, implement timer ISR to extend the counter range (simply increment 'intervalCounter' variable),
- Connect the input signal to pin PB27 (TIOA2) or PB28 (TIOB2), configure the input as external trigger,
- Start the timer,
- Periodically (e.g. in 1 second managed timer), read the timer counter value (TC_CV2 and intervalCounter variable, reset after reading) and calculate the frequency.
#28
Posted 19 September 2011 - 08:19 AM
Another, and perhaps much easier, would be to count pin interrupts directly in the native interrupt handler (so it does not dispatch managed event handler). It may not be as precise as the hardware timer-counter, but can be enabled for any pin (that supports edge interrupts).One way to implement frequency counter would be:
#29
Posted 19 September 2011 - 11:07 AM
#30
Posted 19 September 2011 - 11:32 AM
#31
Posted 19 September 2011 - 11:43 AM
#32
Posted 19 September 2011 - 12:06 PM
#33
Posted 19 September 2011 - 02:02 PM
ARM offers time-limited trial version of their RVDS 4.1 Pro suite (e-mail registration required).If anyone may tell me how to try, I'll be the happiest guy in the world!
#34
Posted 19 September 2011 - 02:30 PM
Hi NickDuino,
I'm just picking up on this thread now, but are you using InputPort to meeasure the time in managed code instead of using InterruptPort (which passes a fairly precise timestamp of the original event)?
Hi Chris,
I am using InterruptPort:
// the pin is expected to interrupt on rising edges InterruptPort _dataOutInterruptPort = new InterruptPort(Pins.GPIO_PIN_D2, false, Port.ResistorMode.Disabled, Port.InterruptMode.InterruptEdgeHigh); // add an interrupt handler to the pin _dataOutInterruptPort.OnInterrupt += new NativeEventHandler(_dataOutInterruptPort_OnInterrupt);
And in the event handler _dataOutInterruptPort_OnInterrupt, I am simply counting the pulses with a long variable:
private void _dataOutInterruptPort_OnInterrupt(uint port, uint state, DateTime time) { _pulseCount++; }
I'm then using the _pulsecount to determine the frequency and then using some additional math to get the irradiance. If I cover the TSL sensor with a black cloth, I do get a few readings from the Netduino, but after that, my Interrupt stops firing. If I shine a bright light on the TSL sensor, I never get any readings and the Netduino becomes "busy" and unresponsive to the IDE.
Perhaps there is too much code in my interrupt routine. I am going to write a real simple version that does not do any irradiance calculations and only prints a very limited amount to the Debug console. I will post the code to this thread later today.
#35
Posted 19 September 2011 - 02:33 PM
Are you pulling my leg?ARM offers time-limited trial version of their RVDS 4.1 Pro suite (e-mail registration required).
I am kidding, but I'd prefer avoid comments...
#36
Posted 19 September 2011 - 02:35 PM
Sounds good. Let's see what we can do to get you off and runningPerhaps there is too much code in my interrupt routine. I am going to write a real simple version that does not do any irradiance calculations and only prints a very limited amount to the Debug console. I will post the code to this thread later today.
Chris
#37
Posted 19 September 2011 - 02:37 PM
It might also be useful to test Microsoft's ARM compiler. I know that it requires several changes to the build/source files--but I've heard rumors that a few brave souls have been building with it as well.ARM offers time-limited trial version of their RVDS 4.1 Pro suite (e-mail registration required).
Chris
#38
Posted 19 September 2011 - 02:48 PM
Do you have a link to that?It might also be useful to test Microsoft's ARM compiler. I know that it requires several changes to the build/source files--but I've heard rumors that a few brave souls have been building with it as well.
Regards,
Mark
To be or not to be = 0xFF
Blogging about Netduino, .NET, STM8S and STM32 and generally waffling on about life
Follow @nevynuk on Twitter
#39
Posted 19 September 2011 - 02:48 PM
Is it the one included in Windows Embedded Compact 7? Or do Windows 8 developer tools come with ARM cross-compiler as well? Adding build support cannot be much different than adding other toolchain (say CrossWorks ;- )It might also be useful to test Microsoft's ARM compiler. I know that it requires several changes to the build/source files--but I've heard rumors that a few brave souls have been building with it as well.
#40
Posted 19 September 2011 - 04:15 PM
I believe so, yes. There should be a download somewhere on Microsoft's site. The only thing I don't know is how it's licensed (free, for use with CE only, or other)...Is it the one included in Windows Embedded Compact 7?
Chris
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users