Multi-Directional Remote Driving Hack

Up until now, we’ve used the Sony Remote value block to receive signals from the S3 onboard IR receiver. We also learned that IR remotes work in a “line of sight” method - meaning that the Sony remote must face the IR receiver on the front of the S3 robot.  

We might resolve this directional limitation by having an IR Sensor that could “see” the remote’s signal from any direction. Luckily, the S3 comes with a hacker port that allows you to easily add external sensors to your S3.

Parts List

To complete this tutorial, in addition to your S3 and Sony IR Remote, you will need the following supplies:

Getting By With A Little Help From My Friends (by tutorial author Whit Stodghill)

On a personal note - The first solution that I came up with to overcome the line of sight problem, was to place four (4) IR receivers oriented front, back, left, and right. I wasn’t sure how to wire this circuit, so I sent an email to some Parallax friends. I got back a response almost immediately! My friend Ben (who is actually one of the members of the Parallax Team that designed the S3) sent me the idea of the laying a single sensor (i.e., one (1) sensor) on its back facing straight up. It is the idea shown here and it works well, is less expensive than needing four. That is the way real engineers always try to think!

It also turns out the idea is documented here on Learn in a tutorial for a different robot. Here is a photo of an ActivityBot setup to receive IR remote signals and do some other things too! This is a view of the ActivityBot’s breadboard area with the circuit built. It shows the IR receiver facing straight up, just like we're going to do here.

An example of an IR receiver pointing upwards for the ActivityBot robot.

It always a good idea to “get a little help from your friends!” You’ll learn new things. Asking others or visiting Learn and studying the examples there is a way to get help when you need it.

Making the Hack

  • Make sure the S3 is turned off. Then, using the parts listed above, connect the IR receiver to S3 according to the following instructions. 

The infrared receiver needs three connections: 5V, GND, and an I/O pin to read the signal it sends:

Pin connections for the IR receiver to your S3.

The drawing to the left is called a pinout diagram and it shows symbolically where each pin is supposed to connect. The drawing to the right represents the same information in a more 3-dimensional way.

The circuitry inside the S3 makes it safe to connect the infrared receiver's signal pin to your S3's 3.3V Propeller I/O pin without adding a resistor, even though the sensor itself is powered by 5V. In our S3 circuit, this required resistance is built into the hacker port, so we do not need to connect an external one. When using other Propeller boards or chips, you will need to provide the resistor to protect the chip - see below.

When working with sensors, especially unfamiliar ones, always check their datasheets or product guides to make sure you understand how to safely connect them to your microcontroller. A sensor that requires 5V for operation can damage a 3.3V microcontroller like the Propeller if the proper protection is not provided in the circuit. Many Parallax sensors and microcontrollers have datasheets or product guides available on their product pages. Visit the Parallax website and search the product name or number to find them easily.

Note: Be mindful of the IR Receiver's pinout as compared to the pinout of the hacker port. Look at the pin labels for both the receiver and hacker port to be sure they are connected properly before you turn on your robot. The receiver's pins are configured differently than the hacker port's will be.

Here is the pinout diagram of the S3’s Hacker Port, taken from the S3 User Guide included with your Scribbler. (See What's A Hacker Port?) It is the nearest and neatest choice.

Hacker port pinout diagram and explanation.

  • Connect the receiver to the P5 row in the Hacker’s Port.

If you have multi-colored jumper wires, use a red jumper wire to make the 5V connection, a black jumper wire to make the G (Ground) connection and a white or yellow jumper wire to make the signal to P5 connection. Refer to the hacker port diagram above and the receiver pinout above to be sure you're making the proper connections.

Note: The GND-PWR-SIGNAL arrangement is standard for many Parallax 3-pin sensors, but the pins are oriented differently on the IR Sensor. So again, be mindful of the IR Receiver's pinout as compared to the pinout of the hacker port!  

The S3 robot with an external IR receiver mounted to the top.

Mount the IR Receiver on the top of the S3, with the receiver's domed side pointing directly up. Use a dot of poster tack putty or double stick tape. The cables can be tied in a loop to keep them out of the way. This makes its small dome visible (remember - direct line of sight) in all directions and from above. The hack is perfect for controlling the S3 with our Sony remote from any direction.

When you have completed this process, carefully check the whole circuit before powering on the S3.

Test Your Connections

Let’s test our S3’s new external IR receiver and our SONY-programmed remote.

  • To do this, open BlocklyProp and connect your S3 via the BlocklyProp client and USB cable.
  • Find the BlocklyProp program we wrote (or make another) to decode signals received by the SONY remote and display them in the BlocklyProp Terminal. It looked like this:

Decoding Sony-programmed remote signals program.

  • We will make one change. Click on the Sony Remote value block’s dropdown menu and you will see:

Dropdown menu for the Sony Remote value block.

  • Move the check mark (✔) from Onboard IR sensor to P5. The block will now look like this:

The Sony Remote value block with P5 selected.

  • Save the program using a new name with the "Save Project As" choice in the top-right dropdown menu (the three horizontal bars).
  • Once you have written the program and saved it, compile and then load it to EEPROM on your S3 to test its functionality.
  • Point the remote at the new external IR receiver, and push some buttons.

As earlier in the tutorial, you should see the remote button number displayed in the Terminal.

Terminal window showing a remote button press.

If so, the Hack is successful! If not, turn off your S3 and carefully check everything. Pay particular attention to the how the pins on the external IR sensor are connected with the cable to the pins on the hacker port. Make sure the signal pin, Ground, 5V connections are in proper order. This is another sort of debugging process – debugging the hardware.

Your Turn

  • Modify and save new copies of each of the programs we have tried in this tutorial series, but change the Sony Remote value block to P5 instead of Onboard IR Sensor.
  • Check them all and their particular features, paying close attention to the differences you notice in how driving programs work now that you have a multi-directional IR sensor instead of a front-only IR sensor.
  • Demonstrate your project to others and practice explaining what you did and how it works.

It’s pretty nice not having to chase the S3 around - always trying to be in front of it, isn’t it? This ability to add external sensors to your S3 robot is one of its most powerful new features. As you continue to work with the S3, you will likely find many ways to expand on basic programs using the Hacker Port.