Page 1 of 1

Ryantek Motor Controller & Ultrasonic Sensor

Posted: Fri Sep 25, 2015 1:00 pm
by CCoates
Hello, I have the Ryantek robot as a starter project and have coded it with Scratch so far its working on keyboard interface (up,down etc etc)

I have an ultrasonic sensor, but am unsure which pins to connect to which? Any help would be gretly appreciated?

Also is there a way to code conenction to wiimote with Scratch? And would i be able to hijack this bluetooth connection from my existing Keyboard?
http://groceries.asda.com/product/compu ... 0000984171

Re: Ryantek Motor Controller & Ultrasonic Sensor

Posted: Thu Oct 08, 2015 10:36 am
by CCoates
Any help?

Re: Ryantek Motor Controller & Ultrasonic Sensor

Posted: Thu Oct 08, 2015 11:52 am
by BMS Doug
Hi,

Could you post details of which Ultrasonic sensor you are using?

Re: Ryantek Motor Controller & Ultrasonic Sensor

Posted: Thu Oct 08, 2015 11:55 am
by CCoates
Apologies bought from Ryantek its the HRC-04

as per

https://ryanteck.uk/sensors/70-ultrasonic-sensor.html

Re: Ryantek Motor Controller & Ultrasonic Sensor

Posted: Thu Oct 08, 2015 12:28 pm
by BMS Doug
CCoates wrote:Apologies bought from Ryantek its the HRC-04

as per

https://ryanteck.uk/sensors/70-ultrasonic-sensor.html
I'm not certain that an HC SR-04 will work with Scratch, I'm not sure how well it would deal with the timing requirements.

The HC SR-04 has 4 pins:

Vcc: Voltage into sensor - this should be connected to one of the 5V Pins (Pins 2 or 4) (This sensor is unreliable at 3V3)
Trig: Trigger - connect to any of the numbered GPIO pins (your choice) set the pin as an output.
Echo: Return signal from the sensor - this will be at 5V, use a voltage divider to drop this to 3V3 and connect to another GPIO pin (set as an input)
Gnd: 0V, part of the sensors power supply.


More Detail:
Trigger - Sending a pulse to the trigger activates the HC SR-04 for a distance measuring cycle.

Echo: Return signal from the sensor - this will be at 5V, use a voltage divider to drop this to 3V3. The Elapsed time between the Echo signal going high to it returning low is the indicator of the distance. (which may be a problem for scratch to measure).
This tutorial covers connecting an Ultrasonic distance sensor fairly thoroughly.

Avoid using the GPIO numbers that the Ryantech robot kit uses (I don't know which ones they are), I'll try to find out for you.

Re: Ryantek Motor Controller & Ultrasonic Sensor

Posted: Thu Oct 08, 2015 12:33 pm
by BMS Doug
BMS Doug wrote: Avoid using the GPIO numbers that the Ryantech robot kit uses (I don't know which ones they are), I'll try to find out for you.
Aha!
GPIO Pin numbers 11,12,15 &16
Ryantech wrote:GPIO.setmode(GPIO.BCM)
#Output the pins 17,18,22,23
Image
(image is of the old style 26 pin connector but the numbering is the same for the new boards, they just have extra pins from 27-40).