Ultrasonic EBM019 Sensors

A place to discuss any problems, issues or questions surrounding the E-blocks BTEC Unit 6 course.

Moderator: Benj

Post Reply
User avatar
The G
Posts: 17
Joined: Tue Jan 09, 2018 12:41 pm
Location: Suffolk
Has thanked: 24 times
Been thanked: 8 times
Contact:

Ultrasonic EBM019 Sensors

Post by The G »

Hi,

I am having difficulty using the ultrasonic sensor with the E-Blocks Combo board EB083.
The test programs and examples all use a standalone LCD panel which makes the choice of ports simple enough for me to understand, but when using the combo board, that takes up Port A and B.
I am possibly missing an obvious change to the program to use the sensor board with Port C or D... could someone please help modify the program to work with the Combo Board EBM083 and the sensor on Port C or D?

I have attached both the original test program off the wiki, as well as my attempt to modify it to work with the combo board. It works in the simulation, but not on the hardware. On the hardware it just flashes a number between about 40 and 70 (on the bottom row of the LCD) and then stays on 0 thereafter.
EBM019_-_Test_Program.fcfx
(16.03 KiB) Downloaded 453 times
EBM019_-_Test_Program with Combo Board.fcfx
(16.49 KiB) Downloaded 435 times
...
G

User avatar
LeighM
Matrix Staff
Posts: 2178
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 481 times
Been thanked: 699 times

Re: Ultrasonic EBM019 Sensors

Post by LeighM »

Hi,
The only other Analog inputs are on port E, so you will need to connect the ultrasonic sensor to port E

User avatar
The G
Posts: 17
Joined: Tue Jan 09, 2018 12:41 pm
Location: Suffolk
Has thanked: 24 times
Been thanked: 8 times
Contact:

Re: Ultrasonic EBM019 Sensors

Post by The G »

LeighM wrote:Hi,
The only other Analog inputs are on port E, so you will need to connect the ultrasonic sensor to port E
So please bear with me... as I have been trying to do this with both the ultrasonic and infrared sensors.
I have changed hardware to Port E, as well as the component macro references which can be assigned to port E, but there are options which cannot be changed to port E, such as:
Input ADC channel (for the IR Sensor)
Echo ADC channel (for the ultrasonic sensor)
Is there anything else as well that I need to adapt for it to get readings?
...
G

User avatar
LeighM
Matrix Staff
Posts: 2178
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 481 times
Been thanked: 699 times

Re: Ultrasonic EBM019 Sensors

Post by LeighM »

Hi,

If you are using the EB090 Sensor board then you will need to use the patch jumper system.
The analogue output from these two EBM sensors comes out on S4 which, with the default setting,
is mapped to port pin 5 for socket 1 and pin 7 for socket 2.
(See the table on page 5 of the Sensors Datasheet)
Unfortunately, Port E only has pins 0, 1 and 2 available (on the 16F1937 that you are using)

So, if you were to install the sensor into socket 1 you would need to
  • wire link S1_3 to 0 (of the header nearest the 9 way D end on the board)
    wire link S1_4 to 1 (of the header nearest the 9 way D end on the board)
    move the patch selection jumpers from the Default position to the Patch position
Then in your Flowcode project set
  • Output Pulse Pin to Port E 0
    Echo ADC channel to An6 (Port E 1)
Hope that helps,
Leigh

User avatar
The G
Posts: 17
Joined: Tue Jan 09, 2018 12:41 pm
Location: Suffolk
Has thanked: 24 times
Been thanked: 8 times
Contact:

Re: Ultrasonic EBM019 Sensors

Post by The G »

Excellent, thank you - that was really clear and I have now got the ultrasonic sensor to work!

I am going to try to work out the other sensors (infrared, humidity, temperature) using the same logic looking at the datasheets... is there anything that is different that I should watch out for?
...
G

User avatar
LeighM
Matrix Staff
Posts: 2178
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 481 times
Been thanked: 699 times

Re: Ultrasonic EBM019 Sensors

Post by LeighM »

I have now got the ultrasonic sensor to work
Ah, well done! you have now joined an elite club :D

The Infrared is setup the same way: Emitter LED control on E0, receiver on An6 (Port E1)
For the Temperature and Humidity modules: SDA on E0 and SCL on E1 (Software mode/channel)
(They too use S3 and S4 so wiring is the same)
Regards,
Leigh

Post Reply