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

NuScratch update coming + 64bit version

Thu Feb 04, 2021 3:11 am

We’re about to release a small update to the NuScratch system to accommodate the change to using pulse audio and move it to the late Squeak Smalltalk release. If you’re interested in trying out the release candidate, let me know.
There will also be a version for the 64bit OS beta. Right now that doesn’t have very good gpio access because the pigpio library has some issues. It should still work with any gpio handler that listens to the broadcast messages. And if you happen to know how to make pigpio work fully for 64 bit, do say.
Making Smalltalk on ARM since 1986; making your Scratch better since 2012

User avatar
bensimmo
Posts: 5152
Joined: Sun Dec 28, 2014 3:02 pm
Location: East Yorkshire

Re: NuScratch update coming + 64bit version

Thu Feb 04, 2021 9:56 am

Have you asked joan about pigpio ?
https://github.com/joan2937/pigpio

User avatar
B.Goode
Posts: 11214
Joined: Mon Sep 01, 2014 4:03 pm
Location: UK

Re: NuScratch update coming + 64bit version

Thu Feb 04, 2021 11:07 am

bensimmo wrote:
Thu Feb 04, 2021 9:56 am
Have you asked joan about pigpio ?
https://github.com/joan2937/pigpio




Yes.


viewtopic.php?f=66&t=301930&p=1810723#p1810723

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

Re: NuScratch update coming + 64bit version

Thu Feb 04, 2021 7:15 pm

Yeah, pigpio installs on 64 bit and runs enough to do the basic pin on/off - but any of the pwn or i2c stuff appears not to work.
Making Smalltalk on ARM since 1986; making your Scratch better since 2012

ejolson
Posts: 6642
Joined: Tue Mar 18, 2014 11:47 am

Re: NuScratch update coming + 64bit version

Thu Feb 04, 2021 7:58 pm

timrowledge wrote:
Thu Feb 04, 2021 3:11 am
We’re about to release a small update to the NuScratch system to accommodate the change to using pulse audio and move it to the late Squeak Smalltalk release. If you’re interested in trying out the release candidate, let me know.
There will also be a version for the 64bit OS beta. Right now that doesn’t have very good gpio access because the pigpio library has some issues. It should still work with any gpio handler that listens to the broadcast messages. And if you happen to know how to make pigpio work fully for 64 bit, do say.
Over winter I solved seven Advent of Code programming puzzles using Scratch.

viewtopic.php?p=1784052#p1784052

Two puzzles were finished in NuScratch and five in stand alone Scratch 3.

Here is a summary of what I found:
  • NuScratch by default needed sudo access to even launch. This is a show stopper in many networked computing labs.
    • The graphical interface in NuScratch was better and visually more pleasing than Scratch 3.
      • NuScratch is missing the language feature to define a new block. In my opinion, the idea of decomposing a problem into subproblems is so essential to programming as well as everyday life that lack of this feature limits the usefulness of NuScratch to one-off computer-science photo ops attended by politicians.
        • NuScratch appeared to run 10 times slower than Scratch 3 and doesn't have a turbo mode.
          • There appears no way to export a NuScratch program to Scratch 3 and vice versa. This creates a walled garden effect between different versions of Scratch that detracts from it's usefulness.
            • It's not possible to click a print button to create a colour PDF listing of the program. This limits a student's ability to share their ideas through email and other types of media unless they have a high resolution monitor for screen shots.
              • It would be convenient for a teacher preparing and testing examples as well as any experienced scratcher if program input could be done by the keyboard. Keyboard input and compatibility with screen reading software may also be necessary to meet accessibility guidelines.
              Except for removing the sudo requirement most of the above are admittedly big projects. I do not post these ideas as feature requests not do I have any unrealistic expectations that the next Google Summer of Code will magically address everything I've mentioned.

              The reason I post is that I'm happy to see work on NuScratch is ongoing and I just wanted to share my recent experiences. More thoughts about Scratch are contained in the thread linked above.

              Again thanks for your continued work!

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

              Re: NuScratch update coming + 64bit version

              Fri Feb 05, 2021 9:16 pm

              I’m puzzled that you found you needed superuser permission. That certainly isn’t something I’d expect... unless it’s perhaps the line in /usr/bin/scratch that starts pigpio? Normally RPiOS would have general sudoer settings for ‘pi’ and maybe if you’re restricting that for classrooms it needs some sudoer setting tricks for the specific application?

              Performance wise I’d be interested to know what you are comparing. I’d be *extremely* surprised to find Scratch 3 being faster in general. Oh, there definitely is a turbo mode - it should be in the ‘edit’ menu.

              The points about the extra blocks and project sharing etc are certainly valid. The problem is that we originally had plans to do stuff like that but the funds disappeared. MIT changed project file format completely and stopped supporting the old format- in fact one of the changes I’ve just made is to remove the upload dialogue since it doesn’t provide any function these days. It’s a pain. I even tried to find and setup a copy of the old MIT project site but despite supposedly being freely usable I couldn’t solve it.

              I could swear you can dump a picture of the scripts. I’ll take a look...
              Making Smalltalk on ARM since 1986; making your Scratch better since 2012

              mob-i-l
              Posts: 355
              Joined: Sat Dec 29, 2012 2:45 am
              Location: Lund, Skåne/Scania, Sweden
              Contact: Website Facebook Twitter YouTube

              Re: NuScratch update coming + 64bit version

              Fri Feb 05, 2021 11:33 pm

              I'm using Debian with Raspberry Pi Desktop on laptops with x86-32 and x86-64 CPUs. Will there be nuscratch for x64 (i.e. x86-64=amd64)?

              I noticed that in the title it says Scratch 1.4 (NuScratch) of 2016-12-12 both in Raspberry Pi OS on armhf and i386, but the packages says different:
              armhf: nuscratch is already the newest version (20170112).
              i386: nuscratch is already the newest version (20190425).

              I also noticed that uploading (Share/Share This Project Online...) to https://scratch.mit.edu/ works well from NuScratch on both armhf and i386, so please don't remove that feature. If you don't get it to work, it might be because you try to upload projects that contain non-standard extensions to Scratch 1.4.

              About turbo in NuScratch it is in Edit/Set Single Stepping/Turbo speed, but that might not be the same as Turbo in later versions of Scratch, by Shift+clicking the green flag.

              About making listings: in NuScratch there is "save picture of scripts" if you Shift+click on the Scripts, but there are also tools to produce listings, but they might not have been updated since Scratch 2.
              Have Pi0&1A&1B&1B+&2B&3B&4B w/ rasPiOS. Started w/ BASIC on ABC80&ZX81 then Forth, Z80… https://scratch.mit.edu/users/mobluse/ https://github.com/mobluse/ https://twitter.com/mobluse/ https://YouTube.com/MOBiL4u/

              ejolson
              Posts: 6642
              Joined: Tue Mar 18, 2014 11:47 am

              Re: NuScratch update coming + 64bit version

              Sat Feb 06, 2021 6:23 pm

              timrowledge wrote:
              Fri Feb 05, 2021 9:16 pm
              I’m puzzled that you found you needed superuser permission. That certainly isn’t something I’d expect... unless it’s perhaps the line in /usr/bin/scratch that starts pigpio?
              That right, there are some unexpected sudo commands in the NuScratch startup script that try to obtain root access to start the gpio daemon. This is a place where a tiny amount of polishing could make a big difference in some educational settings.

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

              Re: NuScratch update coming + 64bit version

              Sun Feb 07, 2021 4:27 am

              mob-i-l wrote:
              Fri Feb 05, 2021 11:33 pm
              I'm using Debian with Raspberry Pi Desktop on laptops with x86-32 and x86-64 CPUs. Will there be nuscratch for x64 (i.e. x86-64=amd64)?
              Well I've no idea if there is a 64bit/x64 release, nor if there will be one. BUT, if there is, then it will be a simple matter to use the 64bit NuScratch image with the already available x64 SqueakVM. We've had 64bit Squeak for a long time.
              mob-i-l wrote:
              Fri Feb 05, 2021 11:33 pm
              I noticed that in the title it says Scratch 1.4 (NuScratch) of 2016-12-12 both in Raspberry Pi OS on armhf and i386, but the packages says different:
              armhf: nuscratch is already the newest version (20170112).
              i386: nuscratch is already the newest version (20190425).
              Hmm, I have no idea about the package stuff. The 2017... would plausibly be a release just after I did the work to make the 20161212 NuScratch system. THe x86 one? No clue.
              mob-i-l wrote:
              Fri Feb 05, 2021 11:33 pm
              I also noticed that uploading (Share/Share This Project Online...) to https://scratch.mit.edu/ works well from NuScratch on both armhf and i386, so please don't remove that feature. If you don't get it to work, it might be because you try to upload projects that contain non-standard extensions to Scratch 1.4.
              Really? That's ... interesting. A long time ago I was told about MIT turning off support for people downloading old-style project files, and then that they had stopped handling uploads (at one point they accepted uploads, did some variety of conversion to Scratch2 files etc.) I'll have to double check.
              mob-i-l wrote:
              Fri Feb 05, 2021 11:33 pm
              About turbo in NuScratch it is in Edit/Set Single Stepping/Turbo speed, but that might not be the same as Turbo in later versions of Scratch, by Shift+clicking the green flag.
              In NuScratch the turbo mode basically just does less frequent updating of the library morph display and the script element highlighting, to save time. IIRC Scratch2 pretty much didn't do a lot of that anyway.

              I was going to say I have no idea what Scratch3 does, then thought I'd try it on my Pi4 desktop manchine and then it took 30 seconds or so to even start up. And *that* is one terribly slow UI. Good grief, how do kids tolerate that? To think that the Pi1 version was considered awkwardly slow... And even more good-grief - it (presumably Chrome + Scratch4 code) has overloaded my PSU (a quite nice 50w unit) enough to throttle the CPU. I don't think I've ever seen that before. That is likely why it seems so terribly slow. OK, try on the other Pi 4 ... nope, horribly slow.It really pounds the CPU where as NuScratch plays much more nicely. It's rather ironic that somebody thought it would be a good idea to rewrite it in Flash to 'make it faster'.
              mob-i-l wrote:
              Fri Feb 05, 2021 11:33 pm
              About making listings: in NuScratch there is "save picture of scripts" if you Shift+click on the Scripts, but there are also tools to produce listings, but they might not have been updated since Scratch 2.
              NuScratch has the same tools in this respect as the original Scratch (obviously, since it is a close descendant) and can make GIFs of a sprite's scripts. Writing out a more textual description of the entire project in a form that could be read back; that would be interesting. But a fair bit of work, meaning time, meaning money.
              Making Smalltalk on ARM since 1986; making your Scratch better since 2012

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

              Re: NuScratch update coming + 64bit version

              Sun Feb 07, 2021 4:31 am

              ejolson wrote:
              Sat Feb 06, 2021 6:23 pm
              That right, there are some unexpected sudo commands in the NuScratch startup script that try to obtain root access to start the gpio daemon. This is a place where a tiny amount of polishing could make a big difference in some educational settings.
              In my defence, not being any sort of bash-guru, that was written by someone at RPT. It works pefectly well in a normal as-distributed setup since the sudoers stuff is setup for passwoprds less sudo. If anyone changes that for securuty reasons it would need some change. I think I've read sometihng about being able to provide sudo privileges for specified programs?
              Making Smalltalk on ARM since 1986; making your Scratch better since 2012

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

              Re: NuScratch update coming + 64bit version

              Sun Feb 07, 2021 4:41 am

              Oh, to belabour a point a tad - waaaaay back, 2014 or so, we were considering making a block-to-Smalltalk transpiler so that the code represented by a block like
              Screen Shot 2021-02-06 at 8.41.02 PM.png
              Screen Shot 2021-02-06 at 8.41.02 PM.png (5.74 KiB) Viewed 650 times
              could be converted to a secret block of

              Code: Select all

              ((a \\ 4) rounded > 2 
                  and:[10 random = 5])
                      ifTrue: [ "do something"
              which would run about 100X quicker than the way the actual blocks processed. (Quickly testing, that expression takes 80 nanoSeconds on a Pi4 Squeak system, in Scratch ......... 1.25 seconds.That's actually 1.5 million times faster, so I feel safe saying 100X :-) )

              I still think it would be a good idea but again, means time, means money.
              Making Smalltalk on ARM since 1986; making your Scratch better since 2012

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

              Re: NuScratch update coming + 64bit version

              Sun Feb 07, 2021 11:40 pm

              timrowledge wrote:
              Sun Feb 07, 2021 4:27 am
              mob-i-l wrote:
              Fri Feb 05, 2021 11:33 pm
              I also noticed that uploading (Share/Share This Project Online...) to https://scratch.mit.edu/ works well from NuScratch on both armhf and i386, so please don't remove that feature. If you don't get it to work, it might be because you try to upload projects that contain non-standard extensions to Scratch 1.4.
              Really? That's ... interesting. A long time ago I was told about MIT turning off support for people downloading old-style project files, and then that they had stopped handling uploads (at one point they accepted uploads, did some variety of conversion to Scratch2 files etc.) I'll have to double check.
              OK, I tried this out myself and I could
              • upload a NuScratch project to my account on scratch.mit.edu
              • not download it as a NuScratch format project by any route I could find
              • could run it as a Scratch3 project, albeit very, very slowly
              I suspect from that test that MIT have reinstated the upload & convert but have removed the once possible retrieve-the-original option. Have you found an alternative?
              Making Smalltalk on ARM since 1986; making your Scratch better since 2012

              mob-i-l
              Posts: 355
              Joined: Sat Dec 29, 2012 2:45 am
              Location: Lund, Skåne/Scania, Sweden
              Contact: Website Facebook Twitter YouTube

              Re: NuScratch update coming + 64bit version

              Mon Feb 08, 2021 1:41 am

              There are at least two converters from Scratch 3 to 2:
              https://scratch.mit.edu/discuss/topic/341176/
              https://scratch.mit.edu/discuss/topic/341046/

              There is at least one converter from Scratch 2 to 1.4:
              https://kurt.blob.codes/20to14

              I've not tested these converters lately.

              I have a studio with Scratch 1.4 projects here that used to work in NuScratch in Raspberry Pi OS, but now they might have been autoconverted to Scratch 3, but then one could perhaps convert them back using the converters above.

              I also have most projects here, in original format:
              https://github.com/mobluse/raspberry-pi-scratch-1.4

              There is a system that can run Scratch 3 projects faster:
              https://turbowarp.org/
              Have Pi0&1A&1B&1B+&2B&3B&4B w/ rasPiOS. Started w/ BASIC on ABC80&ZX81 then Forth, Z80… https://scratch.mit.edu/users/mobluse/ https://github.com/mobluse/ https://twitter.com/mobluse/ https://YouTube.com/MOBiL4u/

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

              Re: NuScratch update coming + 64bit version

              Sun Feb 21, 2021 10:04 pm

              If anyone would like to test out the updates to NuScratch there are a couple of packages you can try downloading Unpackage with

              Code: Select all

              tar xzvf {filename}
              You should find the new files in the right places - but I can't guarantee it! Who knows what strange things you might have doneto your Pi?

              Assuming all unpacks properly you should find that the new NuScratch starts from a commandline with

              Code: Select all

              scratch
              and has a title bar looking like -
              Screen Shot 2021-02-21 at 1.55.35 PM.png
              Screen Shot 2021-02-21 at 1.55.35 PM.png (8.31 KiB) Viewed 409 times
              On a 32bit Pi you should find the usual menu item to start it as well; on a 64 bit system you may need to reboot for the menu to get the right entry.
              The 64 bit system is a bit faster in some aspects and a bit slower in (some) graphics since we haven't yet ported across the clever ARM specific routines the Ben Avison did for the 32 bit world. Hopefully that will be fixed soon. The 64 bit system will drive the GPIO server happily once you have the very latest pigpio installed.

              Official releases should be coming Real Soon Now.
              Making Smalltalk on ARM since 1986; making your Scratch better since 2012

              Return to “Scratch”