DIRRS+

I have a problem. It says on the start here tutorial "make sure you buy analogue" but i went out and bought digital sensor-wise. My question is, how would one wire the DIRRS+ to my picaxe 28x board?

Thanks alot!

it’s in the datasheet. pin1

it’s in the datasheet.

pin1 goes to ground

pin2 to the output pin of the 28x

pin3 goes to +5V

pin4 input pin of the 28x

Ah, don’t worry about it being digital instead of analogue, we’ll make it work.

There are two ways to make it work:

- hack it (https://www.robotshop.com/letsmakerobots/node/2611 )

- use it the digital way

i’d say…hmm…use it the digital way, you’ll also learn a bit of software commands this way.

How?

Where do I wire the pins to, and how do I use it the digital way? (This is my first robot, I’m really bad at this)

Thank you so much!

the wiring for the digital

the wiring for the digital way are the ones i have written on top. You should maybe refer to this to understand where digital pins and v+ and ground are located on your board: https://www.robotshop.com/letsmakerobots/node/75

Once you get your wirings tell me and we’ll proceed to software.

OK
i wired it

BTW
thanks CaptainTuna

Ok now to the

Ok now to the software:

remember: datasheets are your best friends, they tell you how to wire stuff, and how to code it, often by giving examples. So this is what it says about how it should be operated:

In this mode the DIRRS+ uses TTL (5 Volt Logic) to serially transmit a preamble

byte (“10101010”) followed by a single byte. The mode is set to 4800 bps 8N1

Example code is given for the BASIC Stamp II. For other microcontrollers

please see our website for other examples or refer to your datasheet. An object

at 10 cm will result in Hex - FF (Binary 11111111 or DEC 255) being transmitted.

An object at 80 cm will result in Hex - 00 (Binary 00000000 or DEC 0) being sent.

When no object is present some fluctuations may occur in the measurement of

0V resulting in values being sent.

This may look complicated at first so they give us an example:

START:

Serin 0,N4800,(%10101010),b0

Pause 2

Goto START

Be advised that 0 (just after the serin command) is the output pin you are using, so it might be some other number. If it works correctly you will have your value stored in b0. You can then compare it to your standards (EG: if b0 < 150 then…)

I am not sure about how to write the qualifier “(%10101010)” but i think the syntax is correct. If it doesn’t work try removing the % (which stands for binary) or putting it inside "s.

OMG
Thanks so much i will test it right away!

you can check the results by
you can check the results by adding "debug" before "goto START" to check your results on the pc (the picaxe must be wired via the download cable to the pc).

uhhh
It doesn’t work :frowning:

what exactly doesn’t work?
what exactly doesn’t work?

The debug window just says

The debug window just says waiting.

Are you sure you connected
Are you sure you connected the right pins from the sensor to the right pins on the microcontroller board? You should also cehck the pins on the sensor to see which is pin1 and which pin4. (btw i am going to dinner see you later :slight_smile: )

**wait! please 5 minutes? **

wait! please 5 minutes?

 

Wiring

correct, since you’re using

correct, since you’re using pin1 it should be as follows:

Serin 1,N4800,(%10101010),b0

i re wired it because i was
i re wired it because i was using pin 5 for the output which was already being used by my L293D

as for now we don’t need the
as for now we don’t need the output pin. The manual says it (the sensor) just transmits data at a constant rate without needing input, so the output won’t be of use (it would have been if we would have used another type of data transferring method).

is 4.5 v enough?
is 4.5 v enough?

should be, manual says 5V
should be, manual says 5V and does not specify else.