I’ve released ScratchGPIO6 as my official maintained version (just in time for Christmas 🙂
As you know, my documentation lags behind my coding so it’ll take be a little bit of time to document some of the changes but the main points are
Support for extra pin ons the A+ and B+ boards
Full support for lots of extra Addon boards like the Pi2Go and UnicornHat
Added trigger broadcasts for input pin change state. Its still a bit experimental as to whether this should be enabled by default or not so don’t write a book about the features just yet until I’ve had some user feedback
THANKS for this new version. As I`m a rookie in doing SCRATCH on my RasPi, maybe I`m wrong with my comment following:
For me it looks strange seeing the “curved arrow” on contol blocks e.g. “forever”, “repeat “, … cause these arrows are pointing from bottom to top. But as far as I understand the way of programming, should running top-down.
So, for me, would be better and more clear to have these little white arrows in a clockwise direction.
(writing from Germany)
Those are built into Scratch itself 🙂
I hadn’t even noticed them until you mentioned it
They are just there to try and help with concept that they enclose other blocks
I would love to work with you to get Pi&Bash>_ working with ScratchGPIO. We have briefly discussed on twitter about the fact that I have got the ADC working with RPiScratchIO, but was wondering if you could email me to discuss further.
Not related to GPIO6… Downloaded and installed your SCa program to run Aurduino on Win7. Norton quarantined your program with the error “Contains SONAR.Heuristic.120 Trojan”. Norton Antivirus website describes this as a very malicious Trojan. Please inspect your SCa.exe program for something that might have snuck in. Thanks for your efforts and we love GPIO5 on the RPi now that you got me straightened out.
i imagine its a false positive by over zealous Norton as I’ve never had it detected on my own computers or any of my schools computers (I use AVG – schools use Sophos)
But its up to yourself to decided what to do of course 🙂
Its very much an alpha prog 🙂
🙂 I figured as much… I’m going to have Norton make the exception. BTW. Thanks for the help on the ScratchGPIO last weekend. The grandkids came over Sunday and their eyes lit up when making the motor spin and lights blink. Great Job!
Thanks for keeping ScratchGPIO current, I use it in my robotics classes. I have a Pizazz with the MicRoCon v3 motor controller and I am having a couple of issues with GPIOv6
– I can’t seem to get the motors to stop with I Set MotorR = 0 (right or left) when I use this command it seems like it goes about 100% – the command works as expected with v5
– The direction of the motors seems to have reversed between v5 and v6 set MotorR=50 moves forward at half speed in v5 but backward at half speed in v6
I’ll look into this for you
I tried re-installing GPIO6 (the regular version not the Dev verstion) and had the same issues. GPIO5 works as expected.
I created a brand new install using the 12-24 version of Raspian from raspberrypi.org, installed GPIO6 but this combination doesn’t even give me the “sensors enabled” message when I start ScratchGPIO6 Plus. If I remove the SD card and install one with GPIO5 Plus, and load the same program, everything works.
I am using Set AddOn = Pizazz
then Set MotorR – 50
Tried MotorL and several other values.
Hi again cymplecy,
was trying to connect a button on RasPi GPIO PIN3. Have read your former comment:
Inputs To check an input, you should go into the Sensing block and click on the word “slider” at the bottom and you’ll notice that you have pins 22,7,3,5,24,26,19,21,23,8 and 10.
Sorry, but could not find these possibilities in the current version.
THANKS for help & BR
mm – can you download and install the previous version and if that works please?
OK – version 5 installed too.
But sorry, did also not found these possibilities.
By starting ScratchGPIO5 for the slider I`m getting 18 lines (slider to resistance-D, tilt and distance, pin10 to pin 8. But e.g. no pins 3, 5)
By starting ScratchGPIO5plus slider offers me just 9 lines (slider to resistance-D, tilt and distance, but none for any pin).
By starting ScratchGPIO6 for the slider I`m getting 27 lines (slider to resistance-D, tilt and distance, pin10 to pin 8. But e.g. no pins 3, 5). = version for the RasPi B+ ?
And finally by starting ScratchGPIO6plus (and this version is the one I`m trying to work with) slider offers me just these 9 lines (slider to resistance-D, tilt and distance, but none for any pin).
THANKS & BR
The plus versions do not set any pins into any default state
The normal versions set pins 11,12,13,15,16 and 18 as outputs and all other pins as inputs except of pins 3 and 5 which are used to talk to I2C devices
To set a pin to be used as an input pin
this will set it up as an input pin with a pull-up resistor
will set on with pull down resistor
set pin xx as input with no pullup/down
The previous version did the trick for me, thanks.
This project has a lot of potential, I was amazed how it opens new dimensions up. Keep up the great work guys! Kids will love it.
Ok, I need more sensors now… lots of sensors 🙂
I’ve had some issues
1 – I didn’t test it on and old B – I’ve sorted that out now 🙂
2. I mixed up my dev and stable versions so at times people were getting the dev version by mistook
Try again with 6 – it should be OK now 🙂
I am a teacher and I used your Scratch GPIO in the classroom. Do you know any one using littleBits with your version of Scratch?
Sorry no – LittelBits is a bit too expensive for me 🙂
I’d thought that it would be better to use it with Arduino’s rather than Pi.
Ardublocks is a very good block based coding system for them
thanks for this version. I’m a frenc teatcher ans I use PiRoCon addon. My students are very happy to use it to control a robot.
Now I try tu use the Xi Project of MrYsLab.
Do you know it? But i would control the PiRocon with this and interconnect with arduino. Is it Possible to control DC motorA – B and Pan-Tilt with Xi?
Thanks a lot.
I know about Xi but have not got it working on a Pi so I am unable to help sorry
Hi Simon, sorry if this is out of place, but I’m having trouble with the Compass AddOn. Tried GPIO5, 5Plus and 6. No joy. I’ve got a GY-271 module (HMC5883L based I2C device) and it shows-up as a device on the I2C bus when I run “i2cdetect” (i2ctools). So the device must be OK in as much as it replies to the detect tool. I can only see instructions in the older AddOn section (2013) – has it been removed since then? (I only recently installed GPIO5). Anyway, I have tried creating a variable “AddOn” and set it to “Compass”, assuming it should show-up in the Sensor list, but nothing? Please help!.
Apologies but I’ve not tested the code out in ages and I’ll have to hunt to find my module and see what is going on
Looking at code – no Addon needed – if its working, you should get a sensor named heading appearing.
I’d give V5 a go to test initially as it as a long time ago that I was playing with this and I might have regressed it in V6
Futher background on Compass if it helps:
Forgot to mention I’m trying to do this for a school robot project. So far I have two independent drive wheels working OK, with speed control from your Motor PWM. The Sonar function works great too – I have three HR-SO4 sensors and they work ‘simultaneously’ for forward, left & right distance detection (using 0.5sec wait per read). But I wanted to add a compass to provide a real navigation challenge (I’m not into that line following thing – doesn’t seem that educational to me). So I found out a bit more on the compass issue:
I found some Python code that produces a heading result when run (search “Bitify HMC5883L”) Note: it only worked after (i) adding I2C modules; (ii) commenting out the default I2C blacklist entry which disables I2C (in /etc/modprobe.d/raspi-blacklist.conf); (iii) changing the SMBus address to 1 (the code was written for Model B Rev1, but they changed address at Rev2) (iv) running the python script with sudo (otherwise you can’t access the I2C bus) – maybe your Compass AddOn does all this under the hood?
So my sensor works with this code, but the results are wildly inaccurate – the device needs ‘calibrating’, or rather you need to work out the offsets & scaling to apply to the raw data – which is not a one-click thing. This may explain why I can’t find many published Pi robot projects that use it – because it’s quite involved to set-up. I was hoping it would work ‘out of the box’ with Scratch (I don’t do Python yet), but even if work out how to make your Compass AddOn report ‘Heading’ values, there is no process for adding offsets and scaling, within Scratch, so the data would not be of much value. The Arduino community have much more on this device, so I guess I could use a cheap Nano clone and pass the data to the Pi over another interface to Scratch? Seems to me like a worthwhile challenge to get it working, as long as an educator could do the set-up relatively simple in the end.
Didn’t see this until I answered the last one !
Sorry – yes – i2c needs to be enabled.
I’m personally waiting for this KS
to complete and then try adding it into ScratchGPIO as the person is promising to make the software easy to use 🙂
I’m also looking at using an android phone to just sit on top of the robot and supply data from its sensors but no luck at moment
That board looks nice, but you’ll get way more info than you need to control a wheeled robot – in fact it would give you full 3-axis flight control; not that Scratch would be fast enough, and the thought of school kids and quadcopters in the same room sounds too scary!
I’d suggest you probably just want an AddOn to give Scratch data about the horizontal plane only, i.e.
(i) which direction you are pointing relative to a starting value (from the gyro)
(ii) how far you’ve moved forward/backward, left or right, relative to a starting value (from the accelerometer).
That sounds like enough info for youngsters (and me!)
Compass gives you a real world heading but you don’t really care where true north is when you’re indoors and the sensor could be badly affected by mag fields, like robot motors!. I’m not convinced the calibration can be made simple for the end-user either.
So how do you decide what AddOns to enable in Scratch GPIO – if I tested out the setup I described above (gyro/accelerometer using an existing £2 MPU-6050 board) with some Python code, how do I bundle it so you could use it as an AddOn?? I’m assuming as the code is freely available, that’s OK (like I said, I’m new to this).
Re. your earlier comment, I did try Scratch GPIO5 (and Plus) first and it didn’t detect my HMC5883L either.
If you can get standalone Python code working with a 6050, I can then integrate it into ScratchGPIO 🙂
I’m not looking for quad copter control either 🙂
I’m like you – just want to know if I’m going straight and how far I’ve travelled.
I’m not convinced that current low-cost tech will give me the accuracy I think we need e.g movement to within 1cm on a 1 metre run, 5deg accuracy on 360 rotation
But its good fun trying 🙂
Apologies, but BerryIMU is not over-the-top for a wheeled robot – knew I should have read-up properly first! The reason you need all those sensors just to get stable data is explained really well here: . But accurate distance traveled needs fast real-time processing (maybe more expensive sensors or lots of fine calibration). So I think it’s unrealistic to expect accurate distance measurements from the BerryIMU, or other similar module.
So BerryIMU should give you accurate enough heading (+/-2 deg) but I think the best way to get distance/position info is by using wheel sensors (strobe disc), like on the Pi2Go. (e.g. multiply count by [pi*Wheel Dia] for the distance & know how many strobe counts it takes to rotate the robot 360 deg (wheels turning at the same rate in opposite directions).
I am going to get some strobe sensors and try this out – not spotted any generic code yet. Are 4Tronix going to provide Pi2Go wheel counter info raw to Scratch GPIO, or just use it as straight line control?
The problem with using say, 16 segment, wheel counters is that they are not accurate enough to give a good position. e.g difference of 1 count between the two wheels can easily mean a 20deg heading error or a proportional distance error.
Its a good game this one 🙂
I do have code to get the wheel counter info into Scratch but its sadly the inaccuracies jsut mean that navigation is improved but not good enough to rely on to say move along a square 1m each side and return to starting position pointing in initial direction
Hi Simon. We bought and built a pi2go-lite kit a few months back, but only just started checking if it works. Downloaded latest NOOBS and ScratchGPIO6 (devplus) after Xmas and confirmed the sensors & motors work using the python test routines – big sigh of relief! However my daughter would prefer to use Scratch to program it, but I’m not sure what variable names to use for all the Pi2Go inputs and outputs. The few in your example work (if I run rsc first) but where / how are they defined? I know you are still working on the docs but I’d appreciate some basic notes / hints if possible. Would be happy to help you with checking any documentation you write, thanks, Dave
I’m just updating my docs and code for Pi2GoLite at this very moment as I’d been messing around and didn’t leave it in a fully working state!!!!
Hopefully I’ll be sorted in a couple of days 🙂
I’ve updated my code and docs
please try re-installing ScratchGPIo6dev
and then refer to the addon docs page
I’d appreciate any feedback good or bad please 🙂
I installed GPIO 6 and 6 plus, but the PiBrella isn’t responding to any of the Scratch examples. I tested in Python, and it works correctly there so I must be missing something. I updated, downloaded, installed, etc. according to the instructions and then created blocks exactly like the samples here, but no joy. Any ideas jump out at anyone? Thanks so much.
Please disregard. I figured it out. The problem is that I’m a dolt. Thanks.
Do you get a message saying Remote Sensor Connected when launching ScratchGPIO?
if so, you are probably running a new release of Raspbian/Scratch that has a bug with Scratch
Please open home/pi/Documents/Scratch Projects/rsc and see if works then
wonderfull piece of software you developed, l like it very much.
i like to attach a DHT11 temp/hum- sensor to my Rasp and us scratch to obtain the info from the sensor? is that possible?
it can be used in a nice glasshouse project in class.
I’ve not got one of those so I’ve not tried it out sorry
I do support the DS180B temp sensor
I’ve also got a Pi2GoLite and managed to get it to do a few basic things with some Scratch programming. I did this by following your instructions above and downloaded the ScratchGPIO6dev onto my Raspberry Pi – and this works great when I double-click on the ScratchGPIO6devPlus icon.
Now that I’ve reached this milestone, I’m trying to get the Pi2GoLite to follow the same Scratch programming remotely from a Mac laptop running OSX. After a bit of digging, I worked out that I needed to download Scratch 1.4 as Scratch 2.0 doesn’t appear to support the enabling of remote sensor connections, at least not in terms that I, a Scratch novice, can understand. I have also followed your SID instructions and installed this too. The handshake.py script appears to be working fine and around 30 seconds after I enter the 4-digit code, the green LED goes off as you said it would. The white LEDs on the Pi2GoLite also come on.
And here’s the problem – I run my Scratch script and nothing at all happens. It is exactly the same script as I had running on the Raspberry Pi.
I’m sorry if I’m rambling here, but I am hoping you can point me in the right direction…
Can you send me the script that isn’t working and I’ll try it out
email simplecy at googlemail dot com
I used to scratch gpio6 to detect whether the button is pressed with pin7 high ground but are also high
It should normally read 1 and then go to 0 if you ground the pin
I’m trying to use a BerryClip+ with a RPi B+ but I cannot see how to get the dark orange command block “Set AddOn on Berry”. The colour looks like a variable. Do I have to make any variables or lists or are they built in? If they are how do I get at them.
Yes – you create a variable called AddOn and then set its value to Berry
Further to the above. I’m running the latest version of NOOBS and when I start ScratchGPIO6plus I get the message “Remote sensor connections enabled”.
The Remote Sensor Connections is how Scratch talks to the BerryClip so that is good 🙂
Hi Simon – I’ve enjoyed using your code to build some robot projects with my kids. I had servos working with an earlier version of your ScratchGPIO6, but now having trouble. I recently restored Raspberrian from NOOBS and tried to install your latest ScratchGPIO6 using the abbreviated goo.gl line you provided. This gave me a 404 error. I was able to do the download without the -O option and I think I then ran the installer… but not sure if something might have been missed or not configured properly? I got the ScratchGPIO6 and ScratchGPIO6plus icons. I get the “Remote sensor connections enabled” pop-up. I can use it to control LEDs, but can’t seem to get my servos to turn any more. When I run scratchgpio_handler6.py in the terminal, I see the word “servo” appear each time I send the servo a new position command, but the servo doesn’t move. Servo seems powered up properly (small noise/motion at first power up). Appreciate any suggestions! We’ve got a 4 foot tall styrofoam robot dinosaur that needs his ‘muscles’ back in action! Thanks for any ideas! Keep up the great work!
Hi can you send me a script that doesn’t work please?
simplecy at googlemail dot com
Hi, I’ve downloaded ScratchGPIO6 to control a pi2golite. all good, can get it to do all your sample script. However, I have a mini speaker that I want to connect to sit on top of the robot to make sounds. It connects to the audio jack. If I open normal scratch I can play sounds but obviously the robot doesn’t move. If I open the GPIO6 plus, the robot moves but there is no sound. Is there anything I can do to get the audio jack and sound enabled in GPIO6 Plus so I can add sound. Many thanks
Never mind my message, stumped by physical constraints! The audio jack is blocked by the wheel. I got sound and movement together from one side but having cable plugged into jack stops the motor on that side.
There was a bug in ScratchGPIO7 that causes midi sounds not to play that might be in V6 – currently sorted out in V7dev.
V6 (the vista release as its no known) is dead – long live V7
I didn’t see any mention of Pi2go in V7 so I wasn’t sure it was applicable. Will have a look at that if it is – thanks.
On another point, is there anyway of finding out the appropriate name to add to the scratch code to make various components work on the Pi2golite.
For example, your code includes back leds, so guessing front leds was easy but I can’t work out what the front headlights should be called in order to write code to switch them on and off.
The ScratchGPIO program is great, I used it with my PiGlow, now have a Unicorn Hat, but can see to get it working with GPIO6Plus, is it supported? My hat works fine with Python. Obviously I read your getting started guide.
All the best,
You need ScratchGPIO7 and you need to install the Pimoroni software as well
I have the Pimoroni software installed, but will go and update to 7.
Thanks for the quick response.
Installed 7, still no luck… hmm.
So – does it work with Pimoroni python scripts?
if so – can you follow this and see what you get?
Can you post a link to your script which doesn’t work for you please?
Yes I can run the demo scripts. And created some in Unicornpaint.
Went through the link, completely different output from the script….
MeARM NOT imported OK
Running RSC – I see nothing on the console?
Thanks for all the help
hi, i would like to ask if i have the MPU-6050 board standalone python code, is there a chance or way to add it into scratchgpio7 as an Addon?
Yes but I’d really need a board to test/support it with 🙂
so sorry for the late reply, the board im currently using the MPU-6050 on is the Pirocon Board, i was hoping that scratchgpio7 is able to read values from MPU-6050 but right now, as far as i know,it is only usable on python
I can’t seem to see the input pin option (pin3) on scratchgpio7. What am I doing wrong? I’m using a Pi 2 model B. Thanks cymplency!
Pins 3 and 5 are used for I2C based Add on boards so I don’t default them to input anymore – I’m not sure if they can be re-configured (long time since I write that bit) – if you actually need them in your project or can you use other ones?