This is a tiny implementation of PicoBoard that communicates with Scratch on Raspberry Pi via the serial port on GPIO (/dev/ttyAMA0). PIC12F1822 and PIC16F1823 are supported.
A demonstration of TinyPicoBoard on YouTube
Scratch on NOOBS 1.9.3 and 2.0.0 (Raspbian 2016-09-23) has a bug and it cannot detect /dev/ttyAMA0. Please use NOOBS 2.1.0 (Raspbian 2016-11-25) or later.
In order to disable the serial console, please remove "console=serial0,115200" from /boot/cmdline.txt. The result would be as follows.
dwc_otg.lpm_enable=0 console=tty1 root=/dev/mmcblk0p7 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait
Then please execute the following command.
$ sudo systemctl disable serial-getty@ttyAMA0.service
Finally, if you are using Raspberry Pi 3, please disable the on-board bluetooth device to avoid an interference of the serial device by adding the following line in /boot/config.txt.
dtoverlay=pi3-disable-bt
Then please reboot Raspberry Pi.
To write a program to PIC micro-controller, I use a software pickle on Raspberry Pi.
Please download pickle-4.0d.tar.gz, and please execute the following commands.
$ tar zxf pickle-4.0d.tar.gz
$ cd pickle
$ make
$ sudo make install
Then please create /home/pi/.pickle/config with the following lines. This configuration is for Raspberry Pi 2 and 3. If you are using Raspberry Pi Model B+, the first line should be "DEVICE=RPI".
DEVICE=RPI2
SLEEP=1
BITRULES=0x1000
BUSY=0
VPP=4
PGM=65535
PGC=17
PGD=27
MCP=0x20
FWSLEEP=30
DEBUG=1
Using the installed pickle, we write a program on the PIC micro-controller.
For PIC12F1822, please prepare a circuit shown in this figure.
2N7000 is a N-ch MOSFET. This is used for high-voltage (9V) programming of PIC as a level converter.
Then please execute the following commands.
$ p14 program 12f1822.hex
For PIC16F1823, please prepare a circuit shown in this figure.
Then please execute the following commands.
$ p14 program 16f1823.hex
For PIC12F1822, please prepare a circuit shown in this figure. Only "A", "B", "C" can be used as analog inputs.
For PIC16F1823, please prepare a circuit shown in this figure. All the inputs can be used.
Please right click the "slider sensor value" block, and show ScratchBoard watcher. Then please connect to /dev/ttyAMA0 as shown in this figure.