scratchClient

scratchClient ist Software, die einen Zugriff von scratch zur Hardware ermöglicht. Auf dem RaspberryPi ist das Ansteuern der GPIO möglich, Lesen von Analogwerten über SPI, aber auch Sprachausgabe oder Netzwerkkommunikation.

Download und Dokumentation hier.

The architecture of the scratchClient is centered around adapters. Broadcasts and variables from scratch are routed to adapters; adapters can send broadcasts/variables.
Which broadcasts/variables are routed is defined by configuration only and is very flexible. There is a mapping layer which converts scratch names to adapter method names.
The scratchClient is a framework, which communicates with scratch, reads configurations and brings adapters in action. A web interface complements for monitoring.
Adapters are small classes with a well defined interface towards the framework. Adapters can control one GPIO line, an ADC, Stepper or alike, but what the do with broadcasts is very flexible. I have build a text to speech interface, for example.
Not to forget: there can be multiple adapters active in one setup (4 buttons, two adc, one pwm or whatever is needed).
And as adapters have no ‘knowledge’ on other adapters, implementing new ones has almost no side effects to the system.

scratch 1.4 mesh network with scratchClient

Scratch 1.4 on raspberry pi allows to connect with other scratch instances on other computers. This is an experimental feature. This feature is not available in scratch1.4 for linux or windows, not in scratch2. With this feature multiple scratch 1.4 can share events and (global) variables. As this feature is experimental, there are some constraints […]

Posted in scratch, scratchClient, sensor | Comments Off on scratch 1.4 mesh network with scratchClient

howto: Edit scratchClient Config Files

There was a question on how to edit scratchClient config files. There was the need to add a Button to a GPIO. Button inputs are handled by a GPIOEventInput-Adapter. This short walkthrough will not explain all the details but will concentrate on where to find the files use an editor copy / paste an adapter […]

Posted in gpio, scratch, scratch2, scratchClient | Comments Off on howto: Edit scratchClient Config Files

scratch2 connected to scratchClient

Did you ever want to control GPIO from scratch2 ? Or other sensors connected to a raspberry pi ? The last days I worked on connecting scratch2 with GPIO on raspberry and more. To be precise, this is done by either using scratchx or since june 2017 with the standalone version of scratch2 for raspbian. […]

Posted in gpio, scratch, scratch2, scratchClient, sensor | Tagged | Comments Off on scratch2 connected to scratchClient

Sonic Pi controlled from scratch

Sonic Pi is great software to produce sounds and to program melodies. Sonic Pi has an API which allows to use some of the program statements from an external program. There are some places in the web where this feature is used with erlang- or ruby-code. This adapter for scratchClient and the programming in scratch  […]

Posted in scratch, scratchClient | Comments Off on Sonic Pi controlled from scratch

scratchClient and scroll_phat_hd

There is a nice little led matrix moard from PIMORONI, “SCROLL PHAT HD”. The form factor is for the pi zero, but it runs well also with a pi 3. scratchClient offers support for this board. The interface allows to set pixel with brightness, write large and somewhat smaller text and of course clear the […]

Posted in scratch, scratchClient, Uncategorized | Comments Off on scratchClient and scroll_phat_hd

scratchClient with MQTT-Adapter

MQTT Description MQTT, Message Queue Telemetry Transport, is a is an ISO standard for a publish-subscribe based messaging protocol. It is based on TCP/IP (the ‘usual’ network protocol) and especially designed for small devices and low network bandwidth. A typical infrastructure contains at least one MQTT-Broker and one to many clients connected to the broker. […]

Posted in scratch, scratchClient | Comments Off on scratchClient with MQTT-Adapter

scratchClient singleton reworked

scratchClient needs to run alone, as a ‘singleton’, on one computer. The reason is that concurrent access to GPIO, SPI or other resources could result in unpredictable results. First approach was to use a pid-file with some logic. At startup, scratchClient writes its own process identification ‘pid’ into a file scratchClient.pid. When another scratchClient is […]

Posted in scratchClient, Uncategorized | Comments Off on scratchClient singleton reworked

pi and more 9, workshop ‘raspberry, scratch, gpio’

For the ‘pi and more 9‘ in Trier on 11 june 2016, I had the chance to run a workshop on how to use scratch with gpioserver and as an alternative to use scratch with scratchClient. Basis setup was to control three LED with a button. The introduction is available as a pdf-document. The tutorials […]

Posted in scratch, scratchClient | Tagged | Comments Off on pi and more 9, workshop ‘raspberry, scratch, gpio’

LEGO powerfunctions control with scratch 1.4

LEGO has a nice set of controls named ‘powerfunctions’. The main device is a IR-receiver which can control motors, LED with a variety of functions. ON,OFF, PWM are available. To connect this to scratch I use an arduino to control the IR-LED. Arduino is connected by USB to raspberry pi. The LED is connected to […]

Posted in atmel328 coprocessor, scratch, scratchClient | Comments Off on LEGO powerfunctions control with scratch 1.4

gpioServer and scratchClient performance comparison for stepper driving signals

GPIO performance on raspberry pi is an often discussed topic. New scratch uses a build in gpioServer, other options are scratchClient. Especially stepper motors need quite high pulse rate, so I have set up a test harness for a small stepper with 2ms step width. The scenario are a DMA pulse driven approach a python […]

Posted in scratch, scratchClient | Comments Off on gpioServer and scratchClient performance comparison for stepper driving signals