tonychang-uk
Posts: 87
Joined: Mon Jun 18, 2012 1:42 pm

Pi Scratch new for free download now

Sat Nov 30, 2013 5:26 pm

We have a new software "Pi Scratch" for scratch that can control i2c device, temperature sensor, stepper Motor, Motor,

The software have GPIO input, output , Ultrasonic sensor, i2c tmp102 temp sensor, i2c ds1307 RTC, i2c EEPROM 24c32, i2c ADS1015 12bit Analog-to-Digital Converter, i2c BMP085 Barometric Pressure/Temperature/Altitude Sensor , i2c 24x16 LED Matrix, i2c 32 channel PWM/Servo, i2c 23017 16/32/64/128 GPIO output, i2c 23017 16/32 input , 16x2 character LCD, 20x4 character LCD, 84x48 pixels monochrome LCD, Relay, Step Motor , h-bridge Motor control, spi 23s17 16/32/64/128 GPIO output, 1wire 18B20 Temp sensor , spi AD/DA mcp3002, mcp4802 .
More functions will be added.
use GPIO number, can control v2 P5 GPIO 28,29,30,31

It's ready for download now
User manual and program detail in the link, Please give us feedback. Thanks!

08/01/2014
New update Ver Pi_Scratch v2.42 and User manual are ready for download now.
1.new 20x4 16x2 84x48 LCD module command
2. DC motor PWM improve update

14/01/2014
New update Ver Pi_Scratch v2.45 and User manual are ready for download now.
1.new DHT22 Digital Temperature & Humidity Sensor & IR-Trace Hunt sensor support

17/01/2014
New update Ver Pi_Scratch v2.47 and User manual are ready for download now.
1.new IR-Flame sensor support , Servo-Robot Arm demo
2. Auto-login --> Autoload scratch -> Auto load Pi_Scratch

26/02/2014
New update Ver Pi_Scratch v2.57 and User manual are ready for download now.
1 IR remote control set

25/06/2014
New update Ver Pi_Scratch v2.68 and User manual are ready for download .

Motor Wheel Encoder (Pi GPIO) ** 05,Mar 2014
i2c 23017 GPIO Motor Wheel Encoder (i2c GPIO) ** 14,Mar 2014
24x16 & 16x16 LED Matrix new command ** 14,Mar 2014
RFID Reader & Relay Step Motor control ** 30,May 2014

also ready for use Raspberry Pi Image include our Pi_Scratch ready for download.
http://www.pridopia.co.uk/rs-pi-set-scratch.html
Last edited by tonychang-uk on Wed Jun 25, 2014 5:29 am, edited 6 times in total.

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

Re: Pi Scratch new for free download now

Mon Dec 02, 2013 5:46 am

That's good stuff but I'm fairly sure that calling it 'Pi Scratch' is going to confuse a lot of people. It just isn't correct - you're providing an add-on, not the base software.
Please, think of a less confusing name for your package.
Making Smalltalk on ARM since 1986; making your Scratch better since 2012

tonychang-uk
Posts: 87
Joined: Mon Jun 18, 2012 1:42 pm

Re: Pi Scratch new for free download now

Mon Apr 06, 2015 6:52 am

new update ver Pi_Scratch for support Raspberry Pi B 2 for download

http://www.pridopia.co.uk/rs-pi-set-scratch.html

tonychang-uk
Posts: 87
Joined: Mon Jun 18, 2012 1:42 pm

Re: Pi Scratch new for free download now

Mon Apr 13, 2015 7:51 pm

new function update and some bugs fix -- V 2.76 13 Apr 2015

http://www.pridopia.co.uk/rs-pi-set-scratch.html

kaszpirowski
Posts: 23
Joined: Fri May 12, 2017 10:47 pm

Re: Pi Scratch new for free download now

Wed May 24, 2017 9:32 pm

Hello,
The question is whether it can run on raspberry pi3 ..... the image with the functionality of piscratch is for version b and i am not able to get it to run .... the attempt to run the IR is unsuccessful ... The program is properly installed. Physically IR works (mode2, iwr, irexec). Mesh is work. On the other hand, when trying to run IRR_v2 script does not display the list of buttons of the remote control (according to the screen in the manual). Also, when the LIRREMOTE INIT function is activated, info is displayed on the PI-scratch console that the function is
running, while in the pull-down menu there are no additional buttons on the remote control (according to the screen in the manual). What am I doing wrong ....?

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

Re: Pi Scratch new for free download now

Thu May 25, 2017 4:26 am

Hello,
the latest version from this web page is 13,Apr 2015, so this software seems not to be actively maintained.
Between pi2 and pi3 have been some changes in hardware addresses, so some functions might not work by this reason, or supporting libraries are no longer available.
Which special hardware or functions do you want to use which are not in current scratch+gpioserver or available by using scratchClient with scratch ?
Regards,
Gerhard

Forris
Posts: 169
Joined: Fri Jan 06, 2012 7:46 pm

Re: Pi Scratch new for free download now

Thu May 25, 2017 6:50 am

From something that Tim Rowledge said on here a while ago, and speaking briefly to Carrie-Anne Philbin at PiParty in March, it seems that RPF are not doing any more development on Scratch 1.4 and are, instead, switching their focus to providing an interface between the gpio and the online version of Scratch 2.0.

kaszpirowski
Posts: 23
Joined: Fri May 12, 2017 10:47 pm

Re: Pi Scratch new for free download now

Thu May 25, 2017 12:39 pm

I want to instill in my kids programming basics by programming small DIY kits or building a robot and then controlling it. Due to the fact that I do not want to discourage them from creating code, for example in python I decided to start from the scratch or picture language (eg scratch). Fine electronic elements I have. I managed to build a code that managed stepper motors and LEDs. On the other hand, I jammed on the remote control. The piridopia project itself is very interesting and well documented. It offers control of all the electronic modules I have. From this choice. Do you know of any similar project that easily manages so many sensors and other electrical devices?

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

Re: Pi Scratch new for free download now

Thu May 25, 2017 7:31 pm

Hello,
I maintain scratchClient, which is a python framework supporting a few devices as GPIO, some chips, boards and other interfaces for twitter, openweathermap, mqtt. There is no support for lirc IR at the moment.
For documentation, see http://www.heppg.de/ikg/administration/ ... lient.html
It runs with current scratch on raspbian and can easily be extended. It has a build in web server supporting low level debug of interfaces.
Regards,
Gerhard

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

Re: Pi Scratch new for free download now

Sat May 27, 2017 3:44 pm

Hello, have added lirc remote control to scratchClient today.
Hope this helps,
Gerhard

bensimmo
Posts: 1740
Joined: Sun Dec 28, 2014 3:02 pm
Location: East Yorkshire

Re: Pi Scratch new for free download now

Sat May 27, 2017 4:48 pm

Forris wrote:From something that Tim Rowledge said on here a while ago, and speaking briefly to Carrie-Anne Philbin at PiParty in March, it seems that RPF are not doing any more development on Scratch 1.4 and are, instead, switching their focus to providing an interface between the gpio and the online version of Scratch 2.0.
From in section in the recent MagPi that seems likely to happen in a new Raspian release as that what was said.

kaszpirowski
Posts: 23
Joined: Fri May 12, 2017 10:47 pm

Re: Pi Scratch new for free download now

Fri Jun 02, 2017 4:25 pm

Hello gerhad
Installs scratchClient and looks promising, detects LIRC, displays information from the lirc configuration file on the web page. However, I have a problem with a config file in xml. Can you give me an example file with the configuration of several remote control buttons? The question is how the configured buttons will appear in the Sctrach (after developing the sensor menu)

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

Re: Pi Scratch new for free download now

Fri Jun 02, 2017 10:13 pm

Hello,
the scratchClient lirc adapter reads the configured buttons from lirc config which is in /etc/lirc/lircd.conf. So there is no need to have the buttons individually configured in the scratchClient config file. The file config/config_lirc.xml is all you need to start scratchClient (as provided in the download).
When you open the web page localhost:8080, then you should see an adapter displayed similiar to this in docs chapter 6.12.2.5. Each key in lirc provides a broadcast e.g. for key_3 there are the events output_key_3_down and output_key_3_up.
Image
When scratch 1.4 is connected to scratchClient (enable remote sensor connections), then the web page is animated. So the outputs will show a short red flash when lirc triggers a button (monitoring), and if you click the output text with the mouse, the corresponding event will be send to scratch (simulation).
scratch1.4 has the 'when I receive []'-hat in the control panel. Either type or paste the broadcast event name from the web page, or (if lirc is working) just press the buttons on your remote control, then scratchClient sends the events to scratch and scratch 1.4 populates the event name in the hat's value selection.
Hope this helps,
Gerhard

kaszpirowski
Posts: 23
Joined: Fri May 12, 2017 10:47 pm

Re: Pi Scratch new for free download now

Sat Jun 03, 2017 8:07 am

lirc is work.... tHX :D

kaszpirowski
Posts: 23
Joined: Fri May 12, 2017 10:47 pm

Re: Pi Scratch new for free download now

Sat Jun 03, 2017 8:13 pm

... one more question ... when I want to spend a few configuration files (several servo functions, lirc, photo sensor) in one time how do I run scratchclient ...? Do you need to merge several configuration files into one ....?

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

Re: Pi Scratch new for free download now

Sat Jun 03, 2017 9:27 pm

Hello,
a config file consists of one or more <adapter/> - sections. Just add the adapters as needed. Usually the adapters work without problems when combined, but be careful not to use various pwm technolgies or setting the poll rates too fast. There are some constraints e.g. on naming the adapters (each one unique), so read the log output for errors.
Regards,
Gerhard

kaszpirowski
Posts: 23
Joined: Fri May 12, 2017 10:47 pm

Re: Pi Scratch new for free download now

Wed Jun 07, 2017 9:37 pm

Another question ... how to configure a servo where the connector is 3 pin ...

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

Re: Pi Scratch new for free download now

Thu Jun 08, 2017 4:45 am

Hello, servo usually have black (dark), red and yellow connectors. Connect 5V between black and red; connect black to rpi gnd and yellow to a gpio pin. For very small servo, it is possible to take the 5V from the gpio headers, for larger servos there is the need for an extra power supply.
If you look in the web, you find zillions of samples, e.g. http://razzpisampler.oreilly.com/ch05.html

For scratchClient, there are some ways to control a servo, the numbers are the chapter numbers from the doku:

6.1.3. GPIO Adapter, output for Servo motors (simple, uses rpi.gpio which has some jitter, available on vanilla raspbian)
6.8.6. Servoblaster (needs extra 'servoblaster' software for DMA)
6.3.4. PCA9685 16-channel, 12-bit PWM LED controller ( external controller board for pwm)
6.15. Arduino UNO Adapter (arduino uno/nano as a controller board, I like this as nano clones are cheap, fit on a breadboard and provide 5V tolerant in/out)

There is also a DMA lib 'RPIO2' based on RPIO in the distro which I use in my school class to drive servos:
8.2.6. DMA library support (RPIO2)
10.11. DMA_PWMServo

There are config snippets in the doku and sample files in the distro.
Hope this helps,
Gerhard

kaszpirowski
Posts: 23
Joined: Fri May 12, 2017 10:47 pm

Re: Pi Scratch new for free download now

Thu Jun 08, 2017 6:35 am

Servo hardware works .... i have test scripts in python which run servo ... the problem is that in case of scratch i cant run it ... i have browsed many other manuals where it seems easy (though: https: // www. Raspberrypi.org/documentation/usage/scratch/gpio/README.md) .... and yet the servo does not start ....

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

Re: Pi Scratch new for free download now

Fri Jun 09, 2017 12:07 am

Are you certain you are using the correct pin numbers? Don't forget that the built in scratch gpio server uses the BCM numbering. See https://pinout.xyz for a collection of illustrations about the pin numbering and usages.

I wrote that code, and the documentation, and the example Scratch project (Examples->Sensors and Motors->gpio-servoDemo) and it certainly works in my lab.
Making Smalltalk on ARM since 1986; making your Scratch better since 2012

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

Re: Pi Scratch new for free download now

Fri Jun 09, 2017 4:29 am

Here a sample config and step by step procedure for servo with scratchClient.
Copy this as a file config/config_gpio_servo.xml into the scratchClient folder.
You see in the xml file that the PWM pin is BCM-GPIO23, adjust as needed. This adapter uses rpi.gpio, which has some jitter but should work without more dependencies.

Code: Select all

<?xml version='1.0' encoding='utf-8' ?>
<config version='1.0'
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:noNamespaceSchemaLocation="config.xsd" >
       <description>
          Servo control.
          Input values are servo_A.
          Values 0..100.
       </description>
       <!-- =========================================================================== -->
       <adapter class='adapter.gpio.GpioOutputPWMServo'  name='servo_pwm'>
          <description>Sample GPIO PWM</description>

          <gpio port='GPIO23'>
             <default dir='OUT' pull='PUD_OFF' default='low' />
             <active dir='RESERVED' />
          </gpio>

          <input_value name='rate'>
             <variable name='servo_A'/>
          </input_value>

          <parameter name='frequency' value='50' />
          <parameter name='rate' value='50' />
       </adapter>

</config>
Then start scratchClient in a terminal with

Code: Select all

    cd ~/scratchClient
    python3 src/scratchClient.py -c config/config_gpio_servo.xml -v
The -v flag makes output more verbose. Keep the terminal open.
In terminal, you should see:

Code: Select all

    2017-06-08 19:49:33,688 - __main__ - INFO - Trying to connect to scratch.
    2017-06-08 19:49:33,838 - __main__ - WARNING - There was an error connecting to Scratch!
    2017-06-08 19:49:33,838 - __main__ - WARNING -   Unterstuetzung fuer Netzwerksensoren einschalten!
    2017-06-08 19:49:33,838 - __main__ - WARNING -   Activate remote sensor connections!
    2017-06-08 19:49:33,838 - __main__ - INFO -   No Mesh session at host: 127.0.0.1, port: 42001
Then start scratch1.4, enable 'remote sensor connections'. (sensor palette, rightclick on sensor value block and you can select this in context menu). In the terminal you should see then:

Code: Select all

    2017-06-08 19:50:30,369 - __main__ - INFO - Connected to Scratch !
Now, in scratch, create a variable 'servo_A' exactly as written here (upper, lowercase, underscore, no blanks). You see this name in the xml file in <variable name='servo_A'/>.
Set values for this variable from 0..100 and the servo should move.

To doublecheck the connection, open localhost:8080 in a browser on the pi, and navigate to adapters. There you should see a box with the input values you set by scratch. This validates that the connection from scratch to scratchClient is working.

If there are problems, pls copy the scratchClient output error messages (if any) and put this to the forum.

For the scratch2 connections (coming soon) this will be simpler, as the blocks are created from the config.

kaszpirowski
Posts: 23
Joined: Fri May 12, 2017 10:47 pm

Re: Pi Scratch new for free download now

Mon Jun 12, 2017 9:13 am

When config_gpio_servo.xml starts, the following messages appear:

Traceback (most recent call last):
  File "src / scratchClient.py", line 1268, in <module>
    ScratchClient = ScratchClient ()
  File "src / scratchClient.py", line 773, in __init__
    self.config.configure ()
  File "/home/pi/scratchClient/src/configuration.py", line 250, in configure
    self.configDelegate.configure ()
  File "/home/pi/scratchClient/src/configuration.py", line 481, in configure
    Self.adapterConfig (lAdapter, loggingContext, child)
  File "/home/pi/scratchClient/src/configuration.py", line 616, in adapterConfig
    Gpio = self.gpioConfig (loggingContext, background)
  File "/home/pi/scratchClient/src/configuration.py", line 521, in gpioConfig
    Gpio.portNumber = allEverGpios.getPort (gpio.port)
  File "/home/pi/scratchClient/src/configuration.py", line 79, in getPort
    ErrorManager.append ("gpio name in config file not known:% s", portName)
TypeError: append () takes 1 positional argument but 2 were given

Question what is the reason ....?

kaszpirowski
Posts: 23
Joined: Fri May 12, 2017 10:47 pm

Re: Pi Scratch new for free download now

Mon Jun 12, 2017 5:06 pm

Message with gpio16 set (not bcm):

root@raspberrypi:/home/pi/scratchClient# python3 src/scratchClient.py -c config/config_gpio_servo.xml -v
Traceback (most recent call last):
File "src/scratchClient.py", line 1268, in <module>
scratchClient = ScratchClient()
File "src/scratchClient.py", line 773, in __init__
self.config.configure()
File "/home/pi/scratchClient/src/configuration.py", line 250, in configure
self.configDelegate.configure()
File "/home/pi/scratchClient/src/configuration.py", line 481, in configure
self.adapterConfig(lAdapter, loggingContext, child)
File "/home/pi/scratchClient/src/configuration.py", line 616, in adapterConfig
gpio = self.gpioConfig( loggingContext, tle )
File "/home/pi/scratchClient/src/configuration.py", line 521, in gpioConfig
gpio.portNumber = allEverGpios.getPort(gpio.port)
File "/home/pi/scratchClient/src/configuration.py", line 79, in getPort
errorManager.append("gpio name in config file not known: %s", portName)
TypeError: append() takes 1 positional argument but 2 were given

Message with gpio23 set (bcm) :

root@raspberrypi:/home/pi/scratchClient# python3 src/scratchClient.py -c config/config_gpio_servo.xml -v
2017-06-12 19:04:24,454 - __main__ - ERROR - Errors: ["adapter 'servo_pwm': unknown tag 'parameter'", "adapter 'servo_pwm': unknown tag 'parameter'"]
2017-06-12 19:04:24,455 - __main__ - ERROR - There are errors in configuration file '/home/pi/scratchClient/config/config_gpio_servo.xml'
active threads <_MainThread(MainThread, started 1996423168)>
active threads <Timer(Thread-4, started 1971319904)>
scratchClient terminated

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

Re: Pi Scratch new for free download now

Mon Jun 12, 2017 5:30 pm

Hello,
one problem caused by a wrong formatting in an error message. It is corrected, pls download latest distribution..
The root cause is the naming of the gpio pin in the config file. Use 'GPIO00' (two zeros) till 'GPIO31' in upper case, no blanks. And only these BCM numbers which are available on the pi. Think you have a misspelling in the name.
In the servo config file, this is in

Code: Select all

	<adapter class='adapter.gpio.GpioOutputPWMServo'  name='servo_pwm'>
		<description>Sample GPIO PWM</description>

		<gpio port='GPIO23'>  <!-- use names precisely from GPIO00 to GPIO31 -->
			<default dir='OUT' pull='PUD_OFF' default='low' />
			<active dir='RESERVED' />
		</gpio>
        	<input_value name='rate'>  <!-- leave this name as is -->
			<variable name='servo_A'/>  <!-- modify this name according to your needs; this is the name used in scratch -->
		</input_value>

		<parameter name='frequency' value='50' />
		<parameter name='rate' value='50' />
	</adapter>
scratchClient allows renaming of these port names. As there are pin oriented tutorials, people using wiringpi or BCM numbering worlds, I thought it useful to not force someone to other conventions. And there is my school course, where the adapter board has its own numbering too. See config/portmapping.xml to get an idea on how this works. Internally scratchGPIO works with bcm numbers only.

The other error is also a place where I recently changed code. Is also corrected in current download. Sorry for the problems with this.
Regards,
Gerhard

kaszpirowski
Posts: 23
Joined: Fri May 12, 2017 10:47 pm

Re: Pi Scratch new for free download now

Mon Jun 12, 2017 8:57 pm

When config_gpio_servo.xml starts, the following messages appear:

root@raspberrypi:/home/pi/scratchClient# python3 src/scratchClient.py -c config/config_gpio_servo.xml -v
2017-06-12 22:53:37,212 - gpio.RPi_GPIO_GPIOManager - INFO - GPIOManager setActive, True
2017-06-12 22:53:37,213 - gpio.RPi_GPIO_GPIOManager - INFO - 0.6.3
2017-06-12 22:53:37,215 - __main__ - INFO - event_connect
2017-06-12 22:53:37,215 - __main__ - INFO - Trying to connect to scratch.
2017-06-12 22:53:37,216 - __main__ - INFO - Connected to Scratch !
2017-06-12 22:53:37,217 - adapter.gpio - INFO - Adapter, setActive servo_pwm True
2017-06-12 22:53:37,217 - gpio.RPi_GPIO_GPIOManager - INFO - activeSetting
Exception in thread scratchClient:
Traceback (most recent call last):
File "/usr/lib/python3.4/threading.py", line 920, in _bootstrap_inner
self.run()
File "src/scratchClient.py", line 918, in run
self._connect()
File "src/scratchClient.py", line 970, in _connect
module.setActive(True)
File "/home/pi/scratchClient/src/adapter/gpio.py", line 454, in setActive
adapter.adapters.GPIOAdapter.setActive(self, state);
File "/home/pi/scratchClient/src/adapter/adapters.py", line 410, in setActive
self.gpioManager.setGPIOActive(gpio, active)
File "/home/pi/scratchClient/src/configuration.py", line 168, in setGPIOActive
self.delegateGPIOManager.setGPIOActive(gpioConfiguration, state)
File "/home/pi/scratchClient/src/gpio/RPi_GPIO_GPIOManager.py", line 138, in setGPIOActive
self.setGpioState(gpioConfiguration, gpioConfiguration.active_setting)
File "/home/pi/scratchClient/src/gpio/RPi_GPIO_GPIOManager.py", line 144, in setGpioState
logger.debug("setGpioState %s", str(setting))
File "/home/pi/scratchClient/src/configuration.py", line 118, in __str__
return "GpioSetting[dir={dir:s}, pull={pull:s}, default={default:s}]".format(dir=self.dir, pull=self.pull, default=self.default)
TypeError: non-empty format string passed to object.__format__

Return to “Scratch”

Who is online

Users browsing this forum: No registered users and 1 guest