Jump to content

Distance sensor (like "D-Beam" controler)


goule

Recommended Posts

  • Replies 65
  • Created
  • Last Reply

Top Posters In This Topic

I have bought few gp2d12 , and i have difficulties to read any values w my mb. ???

I try with my multimeter and i can read values from 0 to 3.5 volts depending to the distance : no problem.

Once plugged to my unmuxed ain, i have only total random values, so i dont know what to do.

Atm, i simply connected Gnd,Vcc and Vo, but i wonder if i have to put some resistive stuff between Gnd and Vo ?

I did not install any cap yet, is this the reason ?

Is a 'bypass' 100uf cap ok ?

Do i need to plug more stuff between the sensor and my midibox ???

Thnx !!

Link to comment
Share on other sites

Totally random values indicate that you have ungrounded AIN-pins together with a pre-existing application (like MB64)... right?

You need to ground the unconnected pins or (if you're programming a custom app) you should only process pins that are connected (see the source examples).

Does that help?

Link to comment
Share on other sites

Thank you !

but in fact that do not help. it's my fault cause i did not describe my situation clearly enough :

I use mbhp with my own app (C written)

It's very simple but i want it like this.

I use only unmuxed ain, and my unused inputs are connected to the ground.

I read random values from the only and 1st input connected to the board.

I have correct results while connecting one or many 10k Pots

I thought it could be a impedance problem or something like that ???

--

added few times later :

Ok, i got my probem, i'm so stupid  :-[

In fact i didn't run the right program in the pic but an old one, i was displayin 2hex chars instead of 4decimals, so i wasnt capable of reading the value.... i feel shame  >:(

then, i've added a 33uf cap, and the values do not shake that much ^^

now i must learn how to divide properly ;)

thanks

Link to comment
Share on other sites

have you connected something other than the distance sensor to check if the input is working correctly (adressed as Pin 0)? E.g. a 10k-Pot?

Can you provide some more info? What's the code of your AIN_NotifyChange()? Are the values totally random or do they just flicker?

All I can say from my point of view is that it should (at least with only one sensor) work as expected (besides not reaching exactly 0..5V and a lot of flickering)

Link to comment
Share on other sites

Would be cool if you could share the code :)

I don't need it personally right now, but it is always nice to share your work with the community so that others can learn from your skills.

I think audiocommander is on the money, first you should ensure the AIN is working correctly with a standard device.

Link to comment
Share on other sites

I'm currently cleaning up my sensorizer code in a seperate .c-file, together with lots of comments and an easy to tweak-setup. I have found some errors on the last pieces of code I posted, so if anybody wants to use it, there'll be an update shortly...

Here are some features :o

- en-/disable ains

- en-/disable single processing features

- sense threshold (don't sense below)

- gate (incrementer, timeout, threshold)

- pedal (and panic on release - optional)

- expander (based on a sensor min value and a factor of 1/2/4 or 8 )

- scaler (scale resulting value to min (0) and max (127) << this will be quite cool if ya have two pots controlling min/max values!)

- inverter (0-127 => 127-0)

Also, with the new sensorizer, it is possible (but not needed) to avoid complex divisions! So it'll get a lot faster...

and yes: it's already up and running 8) , but it'll still need some checking and improving ...

Michael

Link to comment
Share on other sites

Hey Audiocommander nice to see that you're improving our researches !  ;D

I have to say that it's been some time since I worked on my midibox  ::)

I can't wait to see the new version you're announcing !

:D

stryd_one : Nice to see that you're interrested in custom gear  8)

In the next days I'll try to deal with my ribbon controllers, touchpad (thanks to SpectraSymbol)

Also I have to say that the distance sensor is really lot fun !!

Goule

Link to comment
Share on other sites

Yeah, I have to admit, that I've been lazy too (regarding my midibox) ;D

But now I want to use it in July, so I'm speeding up... :o

Right now, I'm "wasting" a bit of time in writing a small C-Debug Class (some kind of simulator), so I can debug my MIOS application within X-Code, that's really fine...

I'll open a new C-Thread for the command-line simulator, once there's something to post ;)

Cheers!

Michael

forgot to mention: I've also some spectra soft-pots connected (how could it be else? ;D ), if you have questions I can help... was a bit tricky to find out the right pull-up resistor values...

Link to comment
Share on other sites

  • 4 months later...

Okay : I've finally solved the flickering problem with the GPD's sensors : a bypass capacitor of 680uF was needed between Vss and Vdd (soldered as close to the sensor as possible) to have them work correctly.

So now I don't need my software filter anymore (but perhaps it can help under some very particular conditions, for instance with **very** exotic sensors), but I'll say that a hardware solution should always be possible (and prefered of course).

Hope it helps !

Goule

Link to comment
Share on other sites

That's a lot more than the recommended 10! Maybe your power supply is a bit on the noisey side?

Great that you got it working though! If yuo don't mind my asking, how much did the GPD's cost you? I've seen them here for AUD$25 but I'm not sure if that's a decent price...

Link to comment
Share on other sites

I've finally solved the flickering problem with the GPD's sensors : a bypass capacitor of 680uF

Great !!

I did a try with a smaller cap, but it wasnt that big, and the result not that great..

I cant wait to try this value very soon.

What kind af capacitor did you use ?

Did anyone try to use a AOP next to the GPD sensor, to get the full signal range ? (0-5v)

Stryd : what are the "recommended 10" you are talking about ?

Link to comment
Share on other sites

stryd : it costed 25 euros per sensor. Now I have 2xGP2D120 + 2xGP2D12. At this time, only one GP2D120 is connected, I can't wait to test with everybody plugged in  :P

In fact I tried many values for the capacitor (from 1 uF to 3000 uF  :o) and it started to get acceptable at 470 uF. However I decided to use the next bigger value (680 uF), just to be sure  ;D.

Bill : it's a 16v capacitor

To get the sensor to the full range, you can do that by software reading 10 bits value with a little bit of calculating. I even got my sensors linear this way (no additionnal hardware + soldering needed).

Cheers all,

Olivier

Link to comment
Share on other sites

Stryd : what are the "recommended 10" you are talking about ?

have you put a 10uF cap between Vcc and Ground like the datasheet suggest; maybe the power rail noise you might have without the cap causes the jitter.

That's in http://document.sharpsma.com/files/GP2D120_SS_final.pdf Page 3 of the PDF, section 7-8 of the document. Actually it says 10uF or more ... So ... yeh.... D'oh. The engrish is pretty cool though, Section 7-9 Says "Don't do washing" Which means I might smell next week ;) Hey, my japanese is far from perfect!

Link to comment
Share on other sites

stryd : it costed 25 euros per sensor.

25.00 EUR = 42.2295 AUD

So apparently, AUD $25 is cheap!

Now I have 2xGP2D120 + 2xGP2D12. At this time, only one GP2D120 is connected, I can't wait to test with everybody plugged in :P

In fact I tried many values for the capacitor (from 1 uF to 3000 uF :o) and it started to get acceptable at 470 uF. However I decided to use the next bigger value (680 uF), just to be sure ;D.

Yeh probably better to be safe with the cap value :)

Are you planning on somehow combining the two different sensor ranges?

Link to comment
Share on other sites

That's right. I'd like to have one 12 and one 120 for each hand (mounted very close to one another) and a switch ("short range"/"long range").

I already have a switch that activates or not the linearization of the GP2D120. It works very well and it's useful, depending on wich type of parameter you want to control. In general, linear behavior is best, but for a filter cutoff for instance, I noticed that the native mode of GP (log) is better. I also let the possibility to invert the values (0-127 / 127-0).

I also have 2 analog joysticks with 8 bargraphs (2 for each axis on each joystick) and if the user puts his hand on the left GP sensor, the bargraphs of the left joystick (supposed to be unused) displays the value of the GP. When the user gets his hand off the sensor, the bargraph displays the value of the joystick again  8)

Now I'd love to use the XY pad & other softpots from SpectraSymbol, but I still need a FFC connector ...

I didn't amplify the signal from the GP to adjust the range (0 - 5v) and the offset, so I did it by software (mainly because I have so few skills in electronics / wich component to by, etc.) but this should even improve the resolution. If anyone did this, I'd like to have a scheme !!

Seeya,

Goule

Link to comment
Share on other sites

Hey Goule,

nice to hear from you again :)

wonderful timing to bring this thread back to life, because I just finished my sensorizer; rewrote the whole code... it supports connection of up to 8 (different) sensors with a bunch of real cool features.

Now I'm back from a gig where I tested it excessively and it did a great job! The generated values work great and it's a lot of fun making music with it! :D

I'll have to do a bit of a clean up, edit some photos and will release my sourcecode somewhen this or next week, will keep you all updated in this thread!

Cheers,

Michael

Link to comment
Share on other sites

Audiocommander : I'm so glad hearing from you again !! I can't wait to know what kind of controlers you embedded into your joy-machine  :D ;D 8) Let me know more about all that ;) In the meanwhile I'll try to connect some of the SpectraSymbol stuff (but it seems quite hard). Another track I want to follow is to have a female jack available to connect an expression pedal  ;)

Seems like this project never ends, but it's so much fun  8)

Sinnsyk : I don't have any movie yet but I'm planning to make some with my webcam as soon as I've the time (and energy). I have to say that every free minute is more dedicated to soldering / coding than making movies but you're right, this could be a great thing. I'll post the links on that thread as soon as I've done it.

Cheers everybody !

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...