ScratchGPIO support for MotorPiTx

This board makes it very easy to control Motors and Servos without any extra hardware as well as giving you the ability to switch your Raspberry Pi on and off and power it from AA batteries. See xxxx for further info on all its capabilities. This section is about controlling and using it with Scratch.

MotorPiTxIf you’ve got one of these then just create a variable called AddOn and set it to MotorPiTx as the first line in your Green Flag your Green Flag event.

MotorPiTxUpDownThese show you how to use the variables Motor1 and Motor2 to make a vehicle go forwards or backwards with the arrow keys

Servo control is done through variables Servo1 and Servo2 (or you can use Tilt or Pan instead).

The servo1 accepts values from -60 to +60 degrees (to avoid jamming issues if used as a tilt servo) and servo2 accepts -90 to 90

If Ultrasonics are connected to inputs 1 or 2 as per https://cymplecy.wordpress.com/2013/04/23/scratch-gpio-v2-add-on-modulesboards/ then they are reffered to as Ultra1 or Ultra2

6 thoughts on “ScratchGPIO support for MotorPiTx

  1. Hi Simon
    can ScratchGPIO be used for bi-directional motor control from a simple H-bridge, or just with the MotorPiTx board. We don’t need something as big as that board. We’ve got the motors working fine in one direction and have ordered some SR-04’s for more fun. Also, I see that since we were talking a while ago regarding wheels, that the price of chassis kits has dropped massively ( I got one from China for £7 – base, motors, wheels, battery holder )!

    • There’s not generic support (mainly because I don’t/didn’t used to have any H-bridge hardware) but I am thinking of letting people select AddOn=2Way and making it control 11/12 for MotorA and 13/15 for MotorB.

      But workaround is to specify AddOn = MotorPiTx and use the same pins/hardware it it uses http://www.boeeerb.co.uk/motorpitx/

      Have you got a link for the cheap chassis from China?

      Simon

  2. Thanks Simon. Yes, that was pretty much how I guessed it could work. I’ve got an H-Bridge on it’s way, so I’ll let you know how I get on. Regarding the chassis, there are loads on Ebay. Just search for ‘robot chassis’. The one I got was like this http://www.ebay.co.uk/sch/i.html?_trksid=p4840.m570.l1313.TR0.TRC0.Xrobot+chassis&_nkw=robot+chassis&_sacat=0&_from=R40
    The only problem I have with it is that the motors aren’t well matched, so one tends to run a bit faster than the other, although this only seems to happen when initially going forward. It could be that one has slightly more torque than the other, so it gets going a tiny bit quicker. I’ve only tried it so far using a rudimentary Scratch project that uses the arrow keys to set the motor speeds (using your instructions on wiring up a ULN2003), but once the H-bridge arrives I hope to make it a bit more refined.
    I hope you keep adding to the blog. It’s been interesting reading about your robotics & shrimp projects over the last year.

  3. Hi again Simon. Just to update you, I have tried using the MotorPitx instructions to control 2 motors using just an L9110S H-bridge. I am pleased to report..IT WORKS!! I connected the pins for MotorA to pins 19&21 and MotorB to pins 16&18 (from the sparse info on the MotorPiTx page) and I can control speed and direction of both motors…YAY!!

    I do have a question about your line-following robots. I have got some cheap 5V photodiodes but I am not sure how to connect them or read the output. I’ve tried setting them up using a schematic that I found, but the ‘sensor value’ stays at ‘1’, no matter what I do. I would appreciate any pointers. Thanks, Daz.

    • I only support servo’s via MotorPiTx or PiRoCon or MicRoCon add-on boards that have servo hardware buffer’s – you musn’t connect them direct to your RPi

      I haven’t tried any without those boards sorry 😦
      Simon

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s