Show Posts
Pages: 1 [2]
16  Using Arduino / Sensors / Re: Library for the Sharp GP2Y0A21YK IR Distance Sensor on: January 22, 2012, 02:45:02 pm
Is was not aware of your multimap code, but it might be interesting to add your approach as an extra option since it will result in a smaller code size, at the expense of some execution speed.

What you are doing in the multimap function is almost what I did in a spreadsheet to calculate my LUT values.
I measured some values and calculated the intermediate points using two polynomial approximation of the tranfer function. (one for 80 to 20 cm, an other one for 20 to 5 cm).
You can find the (messy) spreadsheet here: (the comments are in Dutch): http://code.google.com/p/gp2y0a21yk-library/source/browse/Calculations/CalculationsDistanceSensorTransferfunctionLUT.xls

How exactly would this make the lib more generic? Since the only hardware specific code is the actual LUT.
I plan to make one generic "DistanceSensor" lib, that supports other distance sensors. (e.g. http://code.google.com/p/srf04-library ('sonar' sensor))
17  International / Español / Re: filtro paso-bajo con arduino on: January 21, 2012, 09:57:11 am
(español, con traductor Google)

Es una buena idea añadir más información a los ejemplos.
He añadido una página wiki, con un poco información básica.
http://code.google.com/p/arduino-signal-filtering-library/wiki/SignalFilteringBasics

"Int" es de 16 bits en el código de Arduino, ya que el ADC es de 10 bits, esto debería ser suficiente (para algunos de los cálculos es necesaria una mayor precisión)

@ionhs: Realmente no se entiende la pregunta, pero un estándar de Arduino no es lo suficientemente rápido para procesar la señal de audio en tiempo real.
@JMN: Mi uso principal del filtro de un sensor de distancia :-) (Sharp GP2Y0A21YK IR Distance sensor) (http://code.google.com/p/gp2y0a21yk-library )
18  International / Español / Re: filtro paso-bajo con arduino on: January 21, 2012, 07:56:59 am
I don't really speak Spanish, but this might be useful: http://arduino.cc/forum/index.php/topic,52681.msg376017.html#msg376017
19  Using Arduino / Sensors / Re: Library for the Sharp GP2Y0A21YK IR Distance Sensor on: January 21, 2012, 07:15:47 am
Depending on your program/goals you could:
  • Sample the sensor from time to time and use "millis()" to calculate the time that has passed and then calculate the average displacement
  • Sample the sensor using fixed timing, e.g. 10 samples per second, using a periodic wake-up of the board, and then calculate the average displacement. Periodic wake-up can be achieved using this nice library: https://github.com/rocketscream/Low-Power

I would prefer the second option.
20  Topics / Science and Measurement / Re: filter library on: January 20, 2012, 10:17:32 am
Maybe this was not really clear: the filtering code was written by scjurgen, I just reused it.

I wrote a small c program to do some tests and to understand the calculations better.
Data  multiplied by 0.08 is always less than 82, but the "long tmp" value in binary representation is much bigger (18 up to 30 bits in my tests).

I have split up the calculations in four parts and I print the intermediate results in decimal and binary.
The program prints the tmp value for three possible incoming samples: 1, 512 and 1023 (using 0,0,0 or 1023,1023,1023 as the 'history')

tmp1 = (data * 662828L);
  --> print tmp1:
       tmp1: 662828
       tmp1: 00000000000010100001110100101100

tmp2 = ((data * 662828L) >>  4);
  --> print tmp2...
tmp3 = ((((data * 662828L) >>  4) + ((_v[0] * -540791L) >> 1) + (_v[1] * 628977L))+262144);
  --> print tmp3...
tmp4 = ((((data * 662828L) >>  4) + ((_v[0] * -540791L) >> 1) + (_v[1] * 628977L))+262144) >> 19;
  --> print tmp4...

Total output:
http://arduino-signal-filtering-library.googlecode.com/hg-history/2770a5e0dae02e0ef56ace52d35fc6c350648b25/TestCode/FilterShiftingTest/debug.txt

The code: (+compiled linux and win32 binary)
http://code.google.com/p/arduino-signal-filtering-library/source/browse/TestCode#TestCode/FilterShiftingTest
21  Topics / Science and Measurement / Re: filter library on: January 19, 2012, 07:06:20 am
Thanks!

I actually did not really pay to much attention to the math and just used that version based on performance.
(the other version of the code written by 'scjurgen' all use floating point math)

The 16 bits in an Arduino short seemed reasonable, considering the 10 bit ADC.
(16 vs 8 bits for the short type: http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1261049420/1#1)



22  Topics / Science and Measurement / Re: filter library on: January 15, 2012, 03:13:43 pm
I made little library based on some of your filter code.
The goal of this library is to make is very easy for anyone to use (basic) signal filters when reading analog sensors.

I plan on adding more filters later on: running average, Kalman,...

http://code.google.com/p/arduino-signal-filtering-library/
 
23  Development / Other Software Development / Kate/KDevelop syntax highlighting style for Arduino code on: January 10, 2012, 08:52:01 am
I added some Arduino specific settings and keywords to a C++0x Kate highlighting style.
The colors are loosely based on the original Arduino IDE syntax highlighting style.
The XML code it still quite dirty, but it works...
http://code.google.com/p/arduino-kate-syntax-highlighting/

Example:



24  Using Arduino / Sensors / Re: Need help with sharp ir GP2Y0A02YK0F distance sensor on: December 21, 2011, 09:24:44 am
These reading are strange and might be caused by a low supply voltage.
The sensor should work at 3.3V, but if you have a 5V Arduino board, I would advise to use the 5V Vcc.

PS: I did some sensor calibration tests and created a small library:
http://arduino.cc/forum/index.php/topic,83947.0.html
25  Using Arduino / Sensors / Library for Distance Sensors on: December 19, 2011, 04:44:22 pm
I am starting this topic to inform you about a small lookup table based library for the Sharp GP2Y0A21YK analog IR distance sensor.
The main goal is to provide a library that simplifies the usage of this particular sensor in Arduino projects.

Usage
  • Download the source
  • Place the DistanceGP2Y0A21YK folder in your Arduino1.0+ "libraries" folder
  • Open example sketch: "file", "Examples", "DistanceGP2Y0A21YK", "Centimeter" (or "Voltage" or "Raw")
  • Connect the analog sensor to port A0 (and connect Vcc and GND)
  • Compile & upload code
  • Sensor data should be arriving over the serial port

http://code.google.com/p/gp2y0a21yk-library/
Pages: 1 [2]