Don't know how to use EB003 light sensor.

For E-blocks user to discuss using E-blocks and programming for them.

Moderators: Benj, Mods

Post Reply
DiegoAlc
Posts: 11
Joined: Sat Sep 12, 2009 6:51 pm

Don't know how to use EB003 light sensor.

Post by DiegoAlc »

hi, whats up? i don't know how i can use EB-003 sensor board, i dont know if there a component in flowcode, or what. How i can read from flowcode the sensor values?. I have looking for examples or something but i havent found nothing. I read the datasheet but its not very extensive. I have seen that there is a test file called sensor.hex on matrixmultimedia.com but i cannt find out...

Thank you very much !

Regards,
Diego.

Sean
Valued Contributor
Valued Contributor
Posts: 548
Joined: Tue Jun 26, 2007 11:23 am
Has thanked: 6 times
Been thanked: 44 times

Re: Don't know how to use EB003 light sensor.

Post by Sean »

The EB003 board provides access to three analogue signal sources and a digital input and output. To read the analogue signals the EB003 must be connected to an analogue capable port (ie. Port A of a PIC16F877a).

The Flowcode ADC component can be used to read the analogue signal values.

In the default configuration the LDR signal is connected to port pin 0 (ADC channel 0).
The potentiometer RV1 is connected to port pin 1 (ADC channel 1)

The full data sheet for the EB003 is available from our website.

DiegoAlc
Posts: 11
Joined: Sat Sep 12, 2009 6:51 pm

Re: Don't know how to use EB003 light sensor.

Post by DiegoAlc »

Ok, thank you very much. Just one question, what do you mean with full data sheet? i have downloaded EB 003 data sheet but im not sure if its full becouse there arent enough information.

Regards,
Diego.

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Don't know how to use EB003 light sensor.

Post by Benj »

Hello

Yes the EB003 datasheet should be enough to get up and running. What do you think is missing from the datasheet and I will look into this for you.

DiegoAlc
Posts: 11
Joined: Sat Sep 12, 2009 6:51 pm

Re: Don't know how to use EB003 light sensor.

Post by DiegoAlc »

well i dont know how to read correctly with ADC componnet, Should i do a SampleADC first, and then ReadAsInt ? this is my code, can you check if this correct?.
i press D0 switch from switches board and i get a value but if i press continue it doesnt work like i expect.

Thank you, really.

Regards,
Diego.
Attachments
ProbandoSensor.fcf
(7.5 KiB) Downloaded 363 times

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Don't know how to use EB003 light sensor.

Post by Benj »

Hello

Ok I have changed your program slightly to allow the LCD to operate a bit better.

The program should now work as you are expecting where pressing switch 0 allows a sample to be taken and displayed.
Attachments
ProbandoSensor.fcf
(8 KiB) Downloaded 392 times

DiegoAlc
Posts: 11
Joined: Sat Sep 12, 2009 6:51 pm

Re: Don't know how to use EB003 light sensor.

Post by DiegoAlc »

hi benj, well no, it doesnt work. I cannt understand. at the begining it writes Sensor values, but when i press SW0 it disappears and the lCD doesnt show anything.

regards,
Diego

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Don't know how to use EB003 light sensor.

Post by Benj »

Hello

How do you have your switch wired?
Is the problem in simulation or on the real device?

If you are using the Switch E-Blocks then are you supplying the +V wire connection.

If you are using your own switch then is the input pin ever left floating?

DiegoAlc
Posts: 11
Joined: Sat Sep 12, 2009 6:51 pm

Re: Don't know how to use EB003 light sensor.

Post by DiegoAlc »

hello, well i have EB007 switch board and yes im supplying the +V IN wire connection.
The problem is in real device, simulation works correctly.
Is this the correct way to take values from a sensor? i want mean with waituntilhigh and waituntillow...

really, thank you very much.

regards,
Diego.

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Don't know how to use EB003 light sensor.

Post by Benj »

Hello Diego

I have just tried the program I sent back to you here on my hardware and it is working as expected. I cannot see any reason for the LCD to go blank other then the power cable becoming loose etc. Pressing the switches should not have the effect of clearing the display unless you are using your version of the program which did clear the display when you pressed the switch. The only other thing I can think of is that the switch is somehow shorting 5V to ground. You can confirm if this is happening by watching the Green LED on the EB006 when you press the switch.

DiegoAlc
Posts: 11
Joined: Sat Sep 12, 2009 6:51 pm

Re: Don't know how to use EB003 light sensor.

Post by DiegoAlc »

hello Ben.

Well, i dont know. becouse if i only place printstring("here") and then clear, this work perfectly (i want mean between waituntilhigh nad waituntillow). The problem is when i use sample, andr readasint.

If i try the program which i'm sending to you now, i can do like 3 measurement and then LCD go to blank and if i press more appear symbols in LCD like ? ? -. And if i press more times i get values from LCD sometimes and sometimes blank and sometimes symbols.

Thanks you.
Regards,
Diego.
Attachments
ProbandoSensor.fcf
(7.5 KiB) Downloaded 351 times

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Don't know how to use EB003 light sensor.

Post by Benj »

Hello Diego

Which version of Flowcode ar you using? I have just tried again with V3.6.11.53 and the program is running on the hardware correctly and reliably.

Please can you attach the C code generated by your program and I will see if there is anything here that could potentially cause a problem.

DiegoAlc
Posts: 11
Joined: Sat Sep 12, 2009 6:51 pm

Re: Don't know how to use EB003 light sensor.

Post by DiegoAlc »

Hello Ben.
Of course i can, well i'm using v 3.4.7.48.

Regards,
Diego.
Attachments
ProbandoSensor.c
(12.33 KiB) Downloaded 305 times

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Don't know how to use EB003 light sensor.

Post by Benj »

Hello Diego

OK The C code all looks correct to me but there must be something happening that is corrupting the output you are sending to PortB.

Firstly I would upgrade to V3.6 as this contains a number of bug fixes.
http://www.matrixmultimedia.com/support ... .php?t=541

Secondly if you are still getting the LCD corruptions problem then you can try moving the LCD start macro inside your program loop. This will act to clear the display but will also keep the display under control if the port pins are still being corrupted.

It might also be worth trying a different microcontroller just incase the one you are using has become damaged for some reason.

DiegoAlc
Posts: 11
Joined: Sat Sep 12, 2009 6:51 pm

Re: Don't know how to use EB003 light sensor.

Post by DiegoAlc »

Hello Ben,
I have done everything which you said and it doesnt work. But i have changed LCD board to LED board and then work perfectly. Maybe LCD board has become damaged when i suplied with 14V?

anyway i have bought another LCD board, when i get it and test i'll tell you if this was the problem.

Thanks Ben for all your help.

Regards,
Diego.

Post Reply