phidjets ir sensor

Technical Discussions on any InterfaceKits
ali khan
Phidgetsian
Posts: 6
Joined: Mon Nov 30, 2015 6:57 am
Contact:

phidjets ir sensor

Postby ali khan » Mon Nov 30, 2015 7:03 am

hi every one

i have a phidgets interface board 8/8/8 and a sharp i ir distance sensor
i wanted to right a program in which a led will glow brighter if the object is close to the sensor and vice versa

can anyone give a program for this in vb6,c++, or java

frodegill
Phidget Mastermind
Posts: 114
Joined: Thu Mar 04, 2010 2:51 am
Contact:

Re: phidjets ir sensor

Postby frodegill » Thu Dec 03, 2015 4:25 pm

ali khan wrote:i have a phidgets interface board 8/8/8 and a sharp i ir distance sensor
i wanted to right a program in which a led will glow brighter if the object is close to the sensor and vice versa

The 1018 8/8/8 does not have analog output. Reading the ir distance is very simple, but dimming LEDs is not. For this you want the (unfortunately quite expensive) 1032 PhidgetLED-64 Advanced controller in addition to your 1018. With just the 1018 you might hook up eight LEDs, one on each digital out, and light them up as a very low-resolution "progress bar".

ali khan
Phidgetsian
Posts: 6
Joined: Mon Nov 30, 2015 6:57 am
Contact:

re : phidgets ir sensor

Postby ali khan » Fri Dec 04, 2015 7:47 am

(Admin: merged with original thread)

thanksa lot,

so what else can i do with a 1018_2 8/8/8 board, sharp ir distance sensor and 2 servo motors
i have a science fair and wanted to make something cool for it.
also can u give the program with it.

thanks a lot :)

User avatar
mparadis
Site Admin
Posts: 632
Joined: Fri Oct 28, 2011 12:17 pm
Contact:

Re: phidjets ir sensor

Postby mparadis » Fri Dec 04, 2015 8:53 am

frodegill wrote:With just the 1018 you might hook up eight LEDs, one on each digital out, and light them up as a very low-resolution "progress bar".


He could also use an R2R resistor ladder to convert the 8 digital outputs into an 8-bit 0-5V value. A little overkill, but it would do the trick. (Although you'd have to mess with the numbers in the code since LED brightness is not proportional to LED voltage)

frodegill
Phidget Mastermind
Posts: 114
Joined: Thu Mar 04, 2010 2:51 am
Contact:

Re: re : phidgets ir sensor

Postby frodegill » Mon Dec 07, 2015 2:31 am

(no need to start new threads for replies)

ali khan wrote:what else can i do with a 1018_2 8/8/8 board, sharp ir distance sensor and 2 servo motors

With the IR distance sensor and 1 servo motor, you can use the motor to show the distance in a very analog way :-) (think old-style speedometer)

i have a science fair and wanted to make something cool for it.
also can u give the program with it.

If it's a science fair project - shouldn't you make the code? This project will be very easy to assemble and very easy to code, so having someone else to 50% of the job seems kind of wrong.

User avatar
mparadis
Site Admin
Posts: 632
Joined: Fri Oct 28, 2011 12:17 pm
Contact:

Re: phidjets ir sensor

Postby mparadis » Mon Dec 07, 2015 9:42 am

You won't be able to control servo motors using the 1018. Servo motors use pulse-code modulation to select the position, so you need a controller board capable of generating such a signal.

ali khan
Phidgetsian
Posts: 6
Joined: Mon Nov 30, 2015 6:57 am
Contact:

Re: phidjets ir sensor

Postby ali khan » Mon Dec 07, 2015 1:27 pm

thanks a lot

but i am not into programming yet i only know vb6 but just a Little
can u please give the code

frodegill
Phidget Mastermind
Posts: 114
Joined: Thu Mar 04, 2010 2:51 am
Contact:

Re: phidjets ir sensor

Postby frodegill » Thu Dec 10, 2015 3:13 pm

Here are some lines of code that should get you started. I have deliberatly not commented it, I have not appended the Makefile, the code is not tested at all (but it compiles!). Basically, this should provide you the start for your science fair project, but probably not more. Hope it will be of some help.
Attachments
PhidgetDistance.c
C code to convert Sharp IR sensor input to AdvancedServo position output
(3.91 KiB) Downloaded 169 times

ali khan
Phidgetsian
Posts: 6
Joined: Mon Nov 30, 2015 6:57 am
Contact:

Re: phidjets ir sensor

Postby ali khan » Mon Dec 14, 2015 10:19 am

thanks a lot


Return to “InterfaceKits”

Who is online

Users browsing this forum: No registered users and 0 guests