JarJarGeek
Posts: 48
Joined: Tue Mar 18, 2014 11:32 am

ScratchGPIO & GPIO Server 1st Glance

Fri Oct 09, 2015 7:25 pm

Wow it's been a busy couple of weeks with a new release of Raspian Jessie and a new version of Scratch to boot - this time with GPIO support. I have personally tried quite a few aspects of setting up and using Jessie and I am very impressed with speed increase / performance all over. With a new version of Scratch - this time with BCM based GPIO numbering comes a few challenges for those of us who have taught physical pin numbering. I am familiar with BCM numbering from using Gordon Henderson's Wiring Pi but found this challenging in teaching - particularly at early KS3 levels. I have so far used ScratchGPIO when I have taught Scratch on breadboards etc and found this an excellent and gentle intro to the use of GPIO pins for pupils. As mentioned I have had a chance to 'play' with Jessie when I've been let out :P but not had chance to test 'ScratchPlus' yet, but I DO KNOW someone who has - aka Simon Walters. Anyone who has used ScratchGPIO knows the tremendous work Simon has put in , we're now on version 7 & 7Plus , and as said I really am drawn to physical GPIO numbering when teaching. Simons is very keen on 'bridging the gap' between his ScratchGPIO and the Foundations 'Scratch+' and has kindly put together a comparison of his findings on his blog found here;

http://simplesi.net/bringing-gpio-serve ... -together/
Last edited by JarJarGeek on Fri Oct 09, 2015 9:37 pm, edited 1 time in total.
@jarjargeek

syntax-err0r.com

User avatar
IvanRoulson
Posts: 6
Joined: Fri Feb 22, 2013 5:17 pm
Location: East Devon
Contact: Website

Re: ScratchGPIO & GPIO Server 1st Glance

Fri Oct 09, 2015 8:32 pm

I do like "pins". I use pins in Python rather than BCM. I can remember that the outputs I usually need are pin 7, 11, 12 and 13. I have no idea off the top of my head what the actual BCM numbering is. I know that my pin 7,11,12 and 13 are actually found by counting the pins.

The update to the kernel recently seemed to kill the servo daemon in ScratchGPIO and I nearly wept. I notice that servod has been updated so possibly/probably ScratchGPIO has already attended to this - it certainly seems that SimpleSi/CympleCy is awake day and night fixing things.

I like the idea that should I have to turn my back on pins and use BCM numbering , I know I can use the option in ScratchGPIO, so perhaps having the reverse of this in GPIO Server would be possible and would make me less nervous about showing younger students.

On the other hand, I saw that GPIO Server has support for PiFace. I bought a couple of these and then retreated from using them - it didn't seem straightforward to program them from the languages that I felt comfortable showing younger students. Now I'll have to find them in amongst all of the clutter.

I've just bought an Initio robot. I know that all parts of it are supported by ScratchGPIO. It's lovely. Without ScratchGPIO, I don't have servos or ultrasonic sensors. That influences my choice.

I've only mentioned pins 6 times in five paragraphs, but that's what I'm feeling at the moment...

ush73
Posts: 3
Joined: Fri Nov 13, 2015 12:43 pm

Re: ScratchGPIO & GPIO Server 1st Glance

Fri Nov 13, 2015 12:51 pm

Sorry to inject a question here. Can I install ScratchGPIO on a pc running linux? I have a Raspberry Pi but do not have the monitor or keyboard access all the time. I do have my notebook with me most of the time.

Any help appreciated. Apologies if i annoy.

ghp
Posts: 1965
Joined: Wed Jun 12, 2013 12:41 pm
Location: Stuttgart Germany
Contact: Website

Re: ScratchGPIO & GPIO Server 1st Glance

Fri Nov 13, 2015 4:30 pm

Hello,
scratchGPIO and also scratchClient are programs which allow to access raspberry pi resources as GPIO, SPi or other. These programs connect to Scratch 1.4 and then 'bridge' scratch programs to hardware.
It is generally not useful to run scratchGPIO on systems not being a raspberry. For scratchClient, this is a little bit more complicated, as this code also controls text-to-speech packages, usb devices and serial things which are available on other platforms also.

A valid scenario is to have these programs run on raspberry, and scratch on a remote computer. I use this often with scratch 1.4 on a windows machine. In scratchClient docs http://www.heppg.de/ikg/administration/ ... Client.pdf, in chapter 8.6, these setups are described.

Regards,
Gerhard

timrowledge
Posts: 1374
Joined: Mon Oct 29, 2012 8:12 pm
Location: Vancouver Island
Contact: Website

Re: ScratchGPIO & GPIO Server 1st Glance

Sat Nov 14, 2015 3:53 am

ush73 wrote:Sorry to inject a question here. Can I install ScratchGPIO on a pc running linux?
As GHP mentioned, it isn't generally much use to have ScratchGPIO running on your pc (or Mac, or linux box) because of the way it expects to talk to the Pi gpio pins. GHPs huge suite is a bit different (and seriously clever).

What you *can* usefully do is run Scratch on your pc/mac/linux, start the Mesh Server and setup your Pi to receive the broadcasts and handle them. Even more fun, you can run Scratch on a *bunch* of other machines and have all of them talk to the one running ScratchGPIO. And just to add to the mix, you can run a Scratch on the Pi, fire up the new GPIOServer *and* Mesh Server and have broadcasts coming in and handled by GPIOServer. And by ScratchGPIO on yet another machine, with different hardware connected.

Running Scratch on non-Pi's is pretty simple too.You can actually run exactly the same system from your Pi on a Mac/PC/linux box. All you need to do is copy the newest looking .image file from /usr/share/scratch (probably NuScratch15092015.image right now) to your other machine. Then go to http://www.squeak.org/downloads and download the Squeak 5 All in One bundle. Pay attention to the advice about clicking on the appropriate .bat/.sh/.app file and check that the plain Squeak system runs ok. After that your system should have worked out what to do with a .image file (and if it hasn't, somebody can surely help us work it out) and d-clicking on the NuScratch .image file should fire up Scratch. Remember, running GPIOServer on a pc/mac/non-pi won't generally do anything useful. No gpio pins on those boring old desktops and laptops...
Making Smalltalk on ARM since 1986; making your Scratch better since 2012

ush73
Posts: 3
Joined: Fri Nov 13, 2015 12:43 pm

Re: ScratchGPIO & GPIO Server 1st Glance

Sat Nov 14, 2015 8:59 am

timrowledge wrote:
ush73 wrote:Sorry to inject a question here. Can I install ScratchGPIO on a pc running linux?
As GHP mentioned, it isn't generally much use to have ScratchGPIO running on your pc (or Mac, or linux box) because of the way it expects to talk to the Pi gpio pins. GHPs huge suite is a bit different (and seriously clever).

What you *can* usefully do is run Scratch on your pc/mac/linux, start the Mesh Server and setup your Pi to receive the broadcasts and handle them. Even more fun, you can run Scratch on a *bunch* of other machines and have all of them talk to the one running ScratchGPIO. And just to add to the mix, you can run a Scratch on the Pi, fire up the new GPIOServer *and* Mesh Server and have broadcasts coming in and handled by GPIOServer. And by ScratchGPIO on yet another machine, with different hardware connected.

Running Scratch on non-Pi's is pretty simple too.You can actually run exactly the same system from your Pi on a Mac/PC/linux box. All you need to do is copy the newest looking .image file from /usr/share/scratch (probably NuScratch15092015.image right now) to your other machine. Then go to http://www.squeak.org/downloads and download the Squeak 5 All in One bundle. Pay attention to the advice about clicking on the appropriate .bat/.sh/.app file and check that the plain Squeak system runs ok. After that your system should have worked out what to do with a .image file (and if it hasn't, somebody can surely help us work it out) and d-clicking on the NuScratch .image file should fire up Scratch. Remember, running GPIOServer on a pc/mac/non-pi won't generally do anything useful. No gpio pins on those boring old desktops and laptops...

Thank you for the thorough reply and the directions. I will look into this.

User avatar
mvnorwood
Raspberry Pi Certified Educator
Raspberry Pi Certified Educator
Posts: 73
Joined: Wed Dec 05, 2012 7:47 pm

Re: ScratchGPIO & GPIO Server 1st Glance

Wed Nov 18, 2015 12:07 pm

scratchGPIO and also scratchClient are programs which allow to access raspberry pi resources as GPIO, SPi or other. These programs connect to Scratch 1.4 and then 'bridge' scratch programs to hardware.
So when you say they connect to Scratch 1.4 will they connect happily to 'NewScratch'? Or do I need an older version of Scratch installed if I want to use ScratchGPIO?

I've not used ScratchGPIO with my students yet. Should I, or should I just start them with 'NewScratch'?

timrowledge
Posts: 1374
Joined: Mon Oct 29, 2012 8:12 pm
Location: Vancouver Island
Contact: Website

Re: ScratchGPIO & GPIO Server 1st Glance

Thu Nov 19, 2015 3:02 am

mvnorwood wrote:[

So when you say they connect to Scratch 1.4 will they connect happily to 'NewScratch'? Or do I need an older version of Scratch installed if I want to use ScratchGPIO?

I've not used ScratchGPIO with my students yet. Should I, or should I just start them with 'NewScratch'?
You're mixing programs here; Scratch is the program running scratch, whether it's the very old Scratch 1.4 as originally provided by MIT, the moderately upgraded version we built to speed things up on the Pi, or the latest Cog based version that really speeds up the Pi. Or even theScratch 2.0 based on (eek!)Flash. Generally we refer to the latest Pi Scratches as NuScratch.

ScratchGPIO is a neat Python program that acts as a server picking up the messages that Scratch broadcasts and interpreting them to control the gpio pins and various devices. There is also (built in to the very latest NuScratch) GPIOServer which can drive gpio directly inside Scratch. Which gpio system you should use depends on what you are wanting to do.

So you should always be using NuScratch since it is the fastest option. If you are doing basic gpio stuff on the same Pi that you are running Scratch on, you can probably stick to the internal GPIOServer. If you want to run the gpio on a different Pi you can do that - run ScratchGPIO on that other Pi. If you want to do something that only ScratchGPIO does, use it. You might like to try out GHP's large suite of similar gpio handling code.
Making Smalltalk on ARM since 1986; making your Scratch better since 2012

User avatar
mvnorwood
Raspberry Pi Certified Educator
Raspberry Pi Certified Educator
Posts: 73
Joined: Wed Dec 05, 2012 7:47 pm

Re: ScratchGPIO & GPIO Server 1st Glance

Thu Nov 19, 2015 7:37 pm

Thanks for the explanation :)

Think I will teach using standard nuScratch and use its in built server.

Do you know if future versions will support the custom motor controller board in the new camjam robotics kit?

Thanks again :D

timrowledge
Posts: 1374
Joined: Mon Oct 29, 2012 8:12 pm
Location: Vancouver Island
Contact: Website

Re: ScratchGPIO & GPIO Server 1st Glance

Thu Nov 19, 2015 8:41 pm

mvnorwood wrote:Do you know if future versions will support the custom motor controller board in the new camjam robotics kit?
I know that it *could* if I'm tasked with doing it; so make sure to email the foundation to ask for it!
Making Smalltalk on ARM since 1986; making your Scratch better since 2012

User avatar
mvnorwood
Raspberry Pi Certified Educator
Raspberry Pi Certified Educator
Posts: 73
Joined: Wed Dec 05, 2012 7:47 pm

Re: ScratchGPIO & GPIO Server 1st Glance

Thu Nov 19, 2015 10:49 pm

I might discuss this on the Pi Certified Educators Google+ group.

I wonder how much demand there might be for Scratch support of the Camjam robotics kit. I guess the line follower and proximity sensor would also need supporting.

I work with KS3 students who have been excluded from school and have behavioural difficulties. I have had good success teaching them Scratch but have concerns that Python may be a step too far for many of them.

I know I saw Pibrella being used with Scratch to create a very simple robot (more like a remote control car) at Picademy. I was all set to go down this route but then PiHut brought out the new kit and I have just got one to tinker with myself.

My first GPIO project with my students is going to be getting them to use Scratch to trigger a balloon filled with confetti to burst when too many questions are answered wrongly in a quiz 8-)

timrowledge
Posts: 1374
Joined: Mon Oct 29, 2012 8:12 pm
Location: Vancouver Island
Contact: Website

Re: ScratchGPIO & GPIO Server 1st Glance

Fri Nov 20, 2015 2:05 am

mvnorwood wrote:I might discuss this on the Pi Certified Educators Google+ group.

I wonder how much demand there might be for Scratch support of the Camjam robotics kit. I guess the line follower and proximity sensor would also need supporting.
That sounds likely. Send emails to the edu team asking for it; they'll ask me to do it.
mvnorwood wrote:I work with KS3 students who have been excluded from school and have behavioural difficulties. I have had good success teaching them Scratch but have concerns that Python may be a step too far for many of them.

I know I saw Pibrella being used with Scratch to create a very simple robot (more like a remote control car) at Picademy. I was all set to go down this route but then PiHut brought out the new kit and I have just got one to tinker with myself.

My first GPIO project with my students is going to be getting them to use Scratch to trigger a balloon filled with confetti to burst when too many questions are answered wrongly in a quiz 8-)
Sheesh, kids that young excluded from school. How sad. Good luck with sorting them out; I can see why directly interactive stuff like scratch might help gain attention in such cases.

And as for a balloon buster - video! Soon! I'd suggest a small solenoid operated from a gpio (possibly with relay since power might be an issue) with a pin. Best make sure it is sprung so the pin retracts in a timely manner...

Also consider solenoid release mallet which lands on whoopee cushion. Fart sounds will always win over kids.
Making Smalltalk on ARM since 1986; making your Scratch better since 2012

User avatar
mvnorwood
Raspberry Pi Certified Educator
Raspberry Pi Certified Educator
Posts: 73
Joined: Wed Dec 05, 2012 7:47 pm

Re: ScratchGPIO & GPIO Server 1st Glance

Fri Nov 20, 2015 10:51 am

I was going to use the Balloon Pitay Popper here:

https://www.raspberrypi.org/learning/ba ... worksheet/

Remove the button and use Scratch instead of Python :)

They could then move on to multiple balloons so every time a question is answered wrongly a balloon pops.

hastklass
Raspberry Pi Certified Educator
Raspberry Pi Certified Educator
Posts: 34
Joined: Mon Dec 12, 2011 11:20 am
Location: Cambridge

Re: ScratchGPIO & GPIO Server 1st Glance

Fri Nov 20, 2015 11:19 pm

Scratch makes a great control language for physical computing and computer control.
For an intro to Python simple GPIO scripts also work well to engage the children and the control aspect makes it easier for them to 'see' if their programs run as expected and to debug their programs.
I have also had good success linking to DT and getting the children into physical computing by make models with sensors and circuits..
Main problem with physical computing is the safe linking of components and models to GPIO pins. Breadboard and jumper wires are far too fiddly for primary children and even those in KS 3.
I use the gPiO interface from http://www.gPiO.co.uk. An excellent bi of kit - bomb proof and the kids love using it.
We need to start educating a generation of young peole who will build the Internet of Things and I cannot think of a better way to begin.

Graham Hastings
Hd Computing
St John's College School

User avatar
mvnorwood
Raspberry Pi Certified Educator
Raspberry Pi Certified Educator
Posts: 73
Joined: Wed Dec 05, 2012 7:47 pm

Re: ScratchGPIO & GPIO Server 1st Glance

Sat Nov 21, 2015 7:35 pm

As requested here is the video :D

timrowledge
Posts: 1374
Joined: Mon Oct 29, 2012 8:12 pm
Location: Vancouver Island
Contact: Website

Re: ScratchGPIO & GPIO Server 1st Glance

Sat Nov 21, 2015 8:53 pm

Excellent!

My worry would be that the balloons could get expensive after a while :D
Making Smalltalk on ARM since 1986; making your Scratch better since 2012

timrowledge
Posts: 1374
Joined: Mon Oct 29, 2012 8:12 pm
Location: Vancouver Island
Contact: Website

Re: ScratchGPIO & GPIO Server 1st Glance

Fri Dec 18, 2015 12:04 am

Following up on the early mention of the CamJam Edukit 3 robot stuff; I've got the motor board working nicely - it is essentially the same as the RyanTek but with pins assigned differently. The line-follower light sensor works perfectly ok just using ordinary gpio pin setting/reading. The ultrasonic distance sensor is a bit of a problem because the timer resolution available is not high enough, so I have to work out something a bit sneaky.
Making Smalltalk on ARM since 1986; making your Scratch better since 2012

ghp
Posts: 1965
Joined: Wed Jun 12, 2013 12:41 pm
Location: Stuttgart Germany
Contact: Website

Re: ScratchGPIO & GPIO Server 1st Glance

Fri Dec 18, 2015 5:04 am

Hello,
for ultrasonic distance sensors, I have made some attempts to integrate them into 'scratchClient'. But finally I decided to use an atmel328 slave processor to offload the timing task from the pi. Some details on this in http://heppg.de/ikg/wordpress/?p=408
Regards,
Gerhard

Return to “Scratch”