This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2009-07-01 14:51:05

Rich_Goyette
Scratcher
Registered: 2009-06-24
Posts: 9

Robot Control with Scratch Source

Hi:

In case anyone was interested, I've been extending the Scratch source to allow it to control a robot.  I seem to recall some discussion in this area about a desire for the ability to control motors in response to sensor inputs.

I don't use the Picoboard or GoGo board.  Instead, I've implemented a back-end on a Freescale microcontroller.  However, that's the easy part.  The hard part (for me, anyways) was digging into the source to figure out how things work in Scratch since I'm not Smalltalk programmer and I only work in object-oriented languages when I absolutely have to. 

I've discovered a few neat things under the hood about Scratch.  One of them (which might be public knowledge - I just have never come across it) is that the Scratch GoGo interface has motor driver capabilities.  It just doesn't show up as a block anywhere that I've found.

I have a short video that highlights the work so far.  I plan to implement a protocol in the future that is independent of the GoGoboard (it already is to some extent) but remains flexible to a variety of purposes and robots.  That way, it doesn't matter what processor is on the robot side as long as it talks that protocol and the protocol is fairly flexible to the robot-end design.

Have a look at:

http://www.richardgoyette.com/ItchBotsMain.html

Rich

Offline

 

#2 2009-07-21 09:24:07

spacetime
Scratcher
Registered: 2009-07-21
Posts: 57

Re: Robot Control with Scratch Source

Congratulations!

I am new to Scratch but have experience with microcontrollers. It is amazing to me how a big problem can be solved by looking at it as a group of small problems which can be easily solved   wink

Offline

 

#3 2009-09-02 15:21:54

cannon
Scratcher
Registered: 2008-09-13
Posts: 8

Re: Robot Control with Scratch Source

i working on connecting lego nxt to scratch i migh be able to help

Offline

 

#4 2009-09-02 19:40:20

Rich_Goyette
Scratcher
Registered: 2009-06-24
Posts: 9

Re: Robot Control with Scratch Source

cannon wrote:

i working on connecting lego nxt to scratch i migh be able to help

Hi:

Thanks for the offer.  I know next to nothing about the lego device other than I found the sensor suite to be disappointing - but that's just me.  For others, lego is perfect.

It would be nice if the block interface I'm building could be applied to the nxt.  That would mean writing an interface inside the nxt to interpret the protocol and command set.

Rich

Offline

 

#5 2009-09-02 22:23:59

chalkmarrow
Scratcher
Registered: 2007-05-18
Posts: 100+

Re: Robot Control with Scratch Source

Rich: Great job. I'm looking forward to seeing what you come up with ultimately. Unfortunately, I still have not ascended the Squeak learning curve to the point I can do anything useful, but I love playing around with the Arduino devices and interfaces using the external sensor functionality.

Last edited by chalkmarrow (2009-09-02 22:24:46)

Offline

 

#6 2009-09-02 23:19:06

Rich_Goyette
Scratcher
Registered: 2009-06-24
Posts: 9

Re: Robot Control with Scratch Source

chalkmarrow wrote:

Rich: Great job. I'm looking forward to seeing what you come up with ultimately. Unfortunately, I still have not ascended the Squeak learning curve to the point I can do anything useful, but I love playing around with the Arduino devices and interfaces using the external sensor functionality.

Hey:

That's great.  I just bought four Arduino boards and some miscellaneous add-ons and was planning to set the kids at school onto the task of building robots and experimenters boards out of them.  My next task is then to develop some software for the Arduino to interpret and respond to the robot control protocol that comes out of my Itchbot Scratch mod.  One of the arduinos that I ordered came with an XBee hub and I'm somewhat excited about getting started.  However, life keeps getting in the way...

There's a good chance I'll toss a few questions your way when i start hacking the arduino now that you've revealed that you're a guru...  wink

Rich

Offline

 

#7 2009-09-05 08:21:55

cannon
Scratcher
Registered: 2008-09-13
Posts: 8

Re: Robot Control with Scratch Source

look at scratch scratch connections for arduino

Offline

 

#8 2009-09-08 15:49:18

Rich_Goyette
Scratcher
Registered: 2009-06-24
Posts: 9

Re: Robot Control with Scratch Source

cannon wrote:

look at scratch scratch connections for arduino

That's a really cool project.  I was actually aiming to make the source more generic - writing an interface to the serial protocol should be all that's needed to build a robot regardless of the processor type.

Rich

Offline

 

#9 2009-10-03 21:14:10

freegamesgallery
Scratcher
Registered: 2009-10-03
Posts: 1

Re: Robot Control with Scratch Source

This is pretty interesting stuff! This is the first I've heard of scratch as I've stumbled across these forums tonight.

If you don't mind me taking this slightly off topic, but has anyone ever integrated one of these smart phones into their robotics projects as a "higher level" controller? I have been looking for a way to connect my blackberry to a microcontroller (I've only done basic things with oopics and the hc11), but am intrigued as to if I can extend the possibilities by giving them a wireless connection with a smart phone?

Offline

 

#10 2009-12-22 16:14:31

null101
Scratcher
Registered: 2009-10-08
Posts: 12

Re: Robot Control with Scratch Source

Rich_Goyette wrote:

Hi:

In case anyone was interested, I've been extending the Scratch source to allow it to control a robot.  I seem to recall some discussion in this area about a desire for the ability to control motors in response to sensor inputs.

I don't use the Picoboard or GoGo board.  Instead, I've implemented a back-end on a Freescale microcontroller.  However, that's the easy part.  The hard part (for me, anyways) was digging into the source to figure out how things work in Scratch since I'm not Smalltalk programmer and I only work in object-oriented languages when I absolutely have to. 

I've discovered a few neat things under the hood about Scratch.  One of them (which might be public knowledge - I just have never come across it) is that the Scratch GoGo interface has motor driver capabilities.  It just doesn't show up as a block anywhere that I've found.

I have a short video that highlights the work so far.  I plan to implement a protocol in the future that is independent of the GoGoboard (it already is to some extent) but remains flexible to a variety of purposes and robots.  That way, it doesn't matter what processor is on the robot side as long as it talks that protocol and the protocol is fairly flexible to the robot-end design.

Have a look at:

http://www.richardgoyette.com/ItchBotsMain.html

Rich

wow. you should get some videos up on youtube for us to see when you finish the project  wink

Offline

 

#11 2010-09-07 21:31:14

mannaickaljerrya
New Scratcher
Registered: 2010-09-07
Posts: 1

Re: Robot Control with Scratch Source

after you download scrach i don't know how it works

Offline

 

#12 2010-09-12 09:32:52

Rich_Goyette
Scratcher
Registered: 2009-06-24
Posts: 9

Re: Robot Control with Scratch Source

Hi all:

Despite my day job and a million other obligations, I've managed to parse together the pieces of my Scratch Robotics project into some notion of order.

I took the advice and put Youtube videos up where appropriate.  They're not very good at the moment because I'm camera challenged.

Check it out here:

http://www.richardgoyette.com/ItchbotsIntro.html

You will note with dismay that the code is a Scratch version behind for the physical robots and that I haven't yet posted the design notes for the simulation model.  My TODO list includes merging them into the current Scratch version and fully documenting what I did so that everyone can laugh at my mistakes (and hopefully learn too).

I've used both the simulated and hardware Itchbots at a local after-school engineering club for kids so it has gone through at least one iteration of user critique and testing.

If anyone has simple robots out there than need driving from within a Scratch-like environment, please do implement a robot-side driver and share with the rest of us...

And if you are twisted enough to be familiar with Squeak internals  smile  and would like to refine my simulated model and/or offer up models of your own, I would gladly like to collab.

Thanks

Rich_goyette

Offline

 

#13 2010-10-13 00:43:01

OldScratcher
New Scratcher
Registered: 2010-10-10
Posts: 2

Re: Robot Control with Scratch Source

I believe that S4A (Scratch for Arduino) has enough control now for simple robot projects.

see: http://seaside.citilab.eu/scratch/arduino

Some of the demo videos on the website showing Scratch controlling robots. (Unfortunately not in English...)

I really like the idea of combining simple software (Scratch) with simple, commonly
available (and inexpensive) hardware for computer science.

Hey, old farts like me enjoy Scratch too, it somehow reminds me of the good old days with BASIC (OK Scratch, where did you hide the "goto" command? :-)

(One thing I would like to see is built-in 3D, msybe OpenGL or directx.)

Anyway, I intend to try and build a robot (my first!) this way...
Darn, but I really like this language!

(A happy old Scratch/Arduino user.)

Offline

 

#14 2010-10-13 20:36:30

OldScratcher
New Scratcher
Registered: 2010-10-10
Posts: 2

Re: Robot Control with Scratch Source

Just built my very basic S4A-Arduino-Bot! (Note: This is my FIRST bot ever!)

I will be trying to use the S4A (Scratch for Arduino) software I previously mentioned.
Basically it uses a very small motor with gear drive (total of 2 gears) on a strip of this corrugated plastic I found (not very strong), so I stiffened it with some heavy gauge wire and masking tape.

I only have ONE small blue servo so that is mounted (taped!) on the bottom to steer the bot. I use one plastic RC style fitting bound together with some wire on the front axle so it looks like the front of the thing is jacked way up.

In front on top is the Arduino, rubber banded in place (the rubber band also helping to hold the steering servo in place) with the USB port facing forward.

Behind that is a small clear style proto-board and on that with the usual LED's, resistors, caps and a PING))) sensor on the proto-board looking forward (I doubt the S4A software will be able to use that, but it sure looks neat!)

Build time: a few hours (mostly figuring out how to hold it all together!) I use lots of masking tape and while it looks pretty rough, I suspect I will be able to make it run, If not with the S4A code, then with some basic Arduino "sketch" code (I would much rather use the S4A and Scratch to control the bot!)

I will PWM a power transistor to drive the small motor for propulsion

Parts: A Sparkfun "Arduino Inventors Kit" and a hand full of junk including some from the local Radio Shack...

Problems: PING))) control for sure and the added weight of batteries (like I said, it is a pretty weak structure).

Enjoyment level so far: WOW! (If I can build one ANYBODY can build one!)

Offline

 

#15 2010-10-27 14:24:49

scratch-citilab
New Scratcher
Registered: 2010-09-02
Posts: 9

Re: Robot Control with Scratch Source

First of all thank you OldScratcher for using S4A and sorry for not making the demo videos in english... but at the beginning we didn't hope such success on foreigner users. Only at the end we made the web on english for better disclosure.

If you need any help or want to show us your project please mail to: scratch@citilab.eu

Best regards  smile

Offline

 

#16 2011-11-02 12:29:58

WillOldScratch
New Scratcher
Registered: 2011-11-02
Posts: 1

Re: Robot Control with Scratch Source

Hello everyone!
I have a robot I built controlled by S4A, but I noticed S4A doesn't have a 'share' feature.
(Basic Scratch won't accept a file from S4A, or import one.)

I have a screenshot in basic jpeg format and don't know if I can even upload it here.

Right now my robot is "forward only" since I lack an h-bridge and just use PWM driven power transistors (TIP210's work perfect) with a 1k resistor going to the Arduino pin
(I am using a Arduino Uno.) I am using pins 11 and 13 to drive the motors.

I use 0.1 second "bursts" controlling each wheel with an arrow key (left, right).
I also have a servo on pin 8 and a Sharp IR Sensor (a GP2D120) continuously scanning
and sending voltage back to Analog 1 in S4A (ADC0 on the actual Uno.) The range variable increases in value as objects get near.

I use a USB "umbilical" cord to drive the 'bot around the floor and want to do a lot more, like adding a real h-bridge so I have reverse! I also would love to get this running by wireless which I am told is not hard. (Cut the umbilical!)

Love the forum, its nice to be here and see some other S4A builders too!
(I hope to send pics a movie and more up in the near future.)

Offline

 

Board footer