create every day - 福野泰介の一日一創

IchigoJam's I2C connects Raspberry Pi Sense HAT and Wii Nunchuck

2017/03/15 23:55:00
#IchigoJam #maker #english 

I2C can connect many devices!
I made a 8x8 simple paint tool using Raspberry Pi Sense HAT and Wii Nunchuck on IchigoJam.

JoyStick - Move the Cursor
Button 1 - Put a Red Dot
Button 2 - Put a Green Dot
Button 1 and 2 - Clear Screen

I updated IchigoJam - with 1.2b42 firmware (beta download from Facebook Group)
To use this program download it! You can't run on IchigoJam ver 1.2.1.

1 'Sense Paint 10 GSB@CLS:GSB@NINIT 15 @LOOP 20 GSB@NGET:X=X/27-1:Y=8-Y/27 30 N=20:GSB@PUTR 40 IF B=1 GSB@PUTB 45 IF B=2 GSB@PUTG 46 IF B=3 GSB@CLS 50 WAIT5:N=0:GSB@PUTR 60 GOTO@LOOP 100 'sense hat mat-led 105 @DRAW:IF I2CW(#46,0,#700,192) STOP ELSE RTN 110 @CLS:FORI=0TO192:POKE#700+I,0:NEXT:GSB@DRAW:RTN 120 @PUTR:POKE#700+X+Y*24,N:GSB@DRAW:RTN 125 @PUTG:POKE#700+X+Y*24+8,N:GSB@DRAW:RTN 130 @PUTB:POKE#700+X+Y*24+16,N:GSB@DRAW:RTN 500 'nunchuck 505 @NINIT 510 POKE#7C0,#F0,#55:IF I2CW(#52,#7C0,2) STOP 520 POKE#7C0,#40,0:IF I2CW(#52,#7C0,2) STOP 525 RTN 530 @NGET:IF I2CW(#52,0) OR I2CR(#52,#7C2,6) STOP 540 X=PEEK(#7C2):Y=PEEK(#7C3):B=~PEEK(#7C7)

How to blink a LED via web on IchigoJam using Sakura IoT Platform beta

2017/03/14 23:55:00
#IchigoJam #IoT #maker #english 

Let's make WoT!
The first step of Web of Things is also blinking a LED (エルチカ@ja).

4GエルチカWoT on IchigoJam

Taisuke Fukunoさんの投稿 2017年3月14日

1. Prepare hardwares
- Sakura's IoT module beta - Sakura's IoT Platform
- Break out board - Sakura's IoT Platform
- IchigoJam T - IchigoJam - with 1.2b42 firmware (beta download from Facebook Group)
- I2C level converter - PCA9306 - Akizuki Denshi
- some jumper wires

2. Regist the Sakura's IoT module
Make a project and a WebSocket service.

* Orange is module ID

3. Connect them
The signal voltage of Sakura's IoT module is 1.8V but IchigoJam is 3.3V.
So you have to change the voltage by PCA9306.
Cut a VCCB(right-top) pin and connect yellow wire (1.8V LOD_OUT of Sakura's IoT module) above.

Put the PCA9306 on the right of the Sakura's IoT Module.
Yellow : VCCA(left-top) - 3.3V on IchigoJam
Blue: SDA(left-middle) - SDA on IchigoJam
Green: SCL(left-middle) - SCL on IchigoJam
Orange: right-top of the Sakura's IoT Modlue - 5V on IchigoJam

VCCB(1.8V) - LOD_OUT(left of the Sakura's IoT Module) (Yellow)
GND(left of the Sakura's IoT Module) - GND on IchigoJam

And turn your IchigoJam on!
Wait a moment until single blinking the LED on the Sakura's IoT Module.

4. Send from the IchigoJam
Open the WebSocket service.

* Yellow is Token to access

Write this program to access Sakura's IoT Module. (beta needs checksum, so a little long code)

900 @I2C 910 M=PEEK(#701)+2 920 C=0:FOR I=0 TO M-1:C=C^PEEK(#700+I):NEXT:POKE#700+M,C 930 IF I2CR(79,#700,M+1,#780,N+1) STOP 940 C=0:FOR I=0 TO N-1:M=PEEK(#780+I):C=C^M:?M;" ";:NEXT:? 950 IF C!=PEEK(#780+N) OR PEEK(#780)!=1 STOP 960 RTN

And try this code to test! If you'll get "1 1 0" or "1 1 128" it's success!

POKE#700,1,0:N=3:GSB@I2C 1 1 0 OK

Wait until you will get "1 1 128". (0:4G no connections, 128:4G connected)
To put a data into the queue

C=1:A=123 POKE#700,#20,10,C,73,A,A>>8,0,0,0,0,0,0:N=2:GSB@I2C

To send data


You will get your data on the control panel.

5. Recieve from the web
Download the program in JavaScript from lchika@GitHub.
Rename the "sakura-setting-rename.js" to "sakura-setting.js".
Edit a name of module and a token on the "sakura-setting.js". (Abobe Orange and Yellow on your Sakura control panel)
This is a code to get the count of the receive queue.


Open "index.html" on your browser and touch the "ON" button.

You get "1" as receive queue count.


And you get a data!


6. Program WoT blinking a LED in BASIC!

1 'SAKURA's IoT beta recv test 100 @LOOP 110 GSB @CHK:IF N=0 WAIT 30:CONT 120 GSB @GET:?"RECV:";N:LED N 130 GOTO @LOOP 800 'IoT Lib 810 @CHK:POKE#700,#32,0:N=4:GSB@I2C:N=PEEK(#783):RTN 820 @GET:POKE#700,#30,0:N=#14:GSB@I2C:N=PEEK(#784):RTN 900 @I2C:'use M,C,I 910 M=PEEK(#701)+2 920 C=0:FOR I=0 TO M-1:C=C^PEEK(#700+I):NEXT:POKE#700+M,C 930 IF I2CR(79,#700,M+1,#780,N+1) STOP 940 C=0:FOR I=0 TO N-1:M=PEEK(#780+I):C=C^M:?M;" ";:NEXT:? 950 IF C!=PEEK(#780+N) OR PEEK(#780)!=1 STOP 960 RTN

Try to make your original WoT!

Thank you Web & Sir Tim! Welcome to the next web era!

2017/03/13 23:55:00
#IchigoJam #IoT #maker #english 

The next web era has come with Web of Things (WoT) and 5-star Open Data.
Mr. Japanese internet Jun Murai presented a honorary degree of doctor of Keio university to sir Tim!

And sir Tim presented to Murai-san. It's good long friendship!

Happy 28th Birthday World Wide Web

I got super rare items! "地球蜘蛛ノ巣@ja" is web in Japanese!

photo: Sir Tim, Mr. Murai and me with "HELLO! WoT" tag

WoT can be accessed via web.
Pressing the button on browser → websocket → Sakura IoT Platform β → turn on the LED on IchigoJam!

1 'SAKURA's IoT beta recv test 100 @LOOP 110 GSB @CHK:IF N=0 WAIT 30:CONT 120 GSB @GET:?"RECV:";N:LED N 130 GOTO @LOOP 800 'IoT util 810 @CHK:POKE#700,#32,0:N=4:GSB@I2C:N=PEEK(#783):RTN 820 @GET:POKE#700,#30,0:N=#14:GSB@I2C:N=PEEK(#784):RTN 900 @I2C:'use M,C,I 910 M=PEEK(#701)+2 920 C=0:FOR I=0 TO M-1:C=C^PEEK(#700+I):NEXT:POKE#700+M,C 930 IF I2CR(79,#700,M+1,#780,N+1) STOP 940 C=0:FOR I=0 TO N-1:M=PEEK(#780+I):C=C^M:?M;" ";:NEXT:? 950 IF C!=PEEK(#780+N) OR PEEK(#780)!=1 STOP 960 RTN

WoT with IchigoJam BASIC is so easy! (I want to be more)
see: Sakur's IoT Platform beta (さくらのIoT Platformβ)
use: "FXMA2102" to fix the level of volt. (OE must connect to VCC / don't need pull up)

My home town Sabae city was elected "Local IoT Acceleration Lab" today also. (鯖江市IoT推進ラボ@ja)
Mr. Jun Murai is chair of "IoT Acceleration Lab".

- ティム・バーナーズ=リー卿 慶應義塾大学名誉博士称号授与 記念講演会(3/14@三田,要申込) | 慶應義塾大学 湘南藤沢キャンパス(SFC)
- 「IoT Lab Selection」及び「地方版IoT推進ラボ」を開催し、受賞者を選定・表彰しました!(METI/経済産業省)

Micro Dot pHAT controlled by IchigoJam I2C

2017/03/12 23:55:00
#IchigoJam #KidsIT #maker #english 

I bought a "Micro Dot pHAT by PIMORONI" showed me at Raspberry Jam by Akkie-san.
IchigoJam can control this also using the adapter board to HAT (Sense HAT).

6 matrix LEDs are controlled by IS31FL3730.
These I2C address are #61/#62/#63. Each IC connects to 2 matrix LEDs difference directions (@A pattern / @B pattern on the following BASIC source code).

1 'MICRO DOT pHAT for IchigoJam BASIC 1.2.1 10 GSB@INIT 20 S=" HELLO! WoT ":M=0 30 FOR P=0 TO 5 40 C=PEEK(S+P+M):GSB@PUTC 50 NEXT:GSB@UPDATE:M=(M+1)%(LEN(S)-5):GOTO 30 60 END 100 @INIT 110 FOR I=#61 TO #63 120 POKE#800,0,`11000:IF I2CW(I,#800,2,#800,0) STOP 130 POKE#800,#D,`1110:IF I2CW(I,#800,2,#800,0) STOP 140 POKE#800,#19,30:IF I2CW(I,#800,2,#800,0) STOP 150 NEXT 160 RTN 200 @PUTC:'P=pos0-5,C=char 210 A=#63-P/2:IF P&1 GSB@A ELSE GSB@B 230 RTN 300 @A 310 FOR I=0 TO 6 320 D=PEEK(C*8+I)>>2:N=0 330 FOR J=0 TO 4 340 N=N+D&1<<(4-J):D=D>>1 350 NEXT 360 POKE#700+I,N 370 NEXT 380 POKE#800,1:IF I2CW(A,#800,1,#700,7) STOP 390 RTN 400 @B 410 FOR I=0 TO 4 420 N=0 430 FOR J=0 TO 6 440 N=N+PEEK(C*8+J)>>(6-I)&1<<J 450 NEXT 460 POKE#700+I,N 470 NEXT 480 POKE#800,#E:IF I2CW(A,#800,1,#700,5) STOP 490 RTN 500 @UPDATE 510 FOR A=#61 TO #63:POKE#700,#C,1:IF I2CW(A,#700,2,#700,0) STOP 520 NEXT:RTN

Try to modify!
First of all, it's very easy to change the message on line 20!

Next I want to try to control "Rainbow HAT" for Android Things by Google!

- the code of Sense HAT
- the code of Micro Dot pHAT
- Rainbow HAT
- Raspberry Pi Boards, Kits, HATs, and Accessories - Next Day Delivery - Pimoroni

Raspberry Pi Sense HAT controlled by IchigoJam I2C

2017/03/11 23:55:00
#IchigoJam #KidsIT #maker #english 

Raspberry Pi Sense HAT used with Astro Pi released!
This board has 64 full color LEDs, a joystick, Gyroscope, Accelerometer, Magnetometer, Temperature, Barometric pressure and Humidity. You can access all devices via I2C.

This is a demo video using the Matrix LED controlled by IchigoJam I2CR/I2CW command.

You can connect just 5 pins (5V, GND, 3.3V, GPIO2:SDA and GPIO3:SCL) *see GPIO on RPi
You have to add external pull up(2-3kΩ to 3.3V) SDA and SCL on IchigoJam.

Program on your IchigoJam

10 FOR I=0 TO 192:POKE#701+I,RND(2):NEXT 20 POKE#700,0:IF I2CW(#46,#700,1,#701,192) STOP 30 GOTO10

I made a board to connect the HAT from IchigoJam.

This program shows IchigoJam characters to the matrix LED by your joystick manipulations!

1 'SenseHAT 10 GOTO300 100 'C:CHR P:COL B:BG 105 P=RND(#FFF)+1:B=RND(2)<<8+RND(2)<<4+RND(2) 110 FOR I=0 TO 7 115 N=PEEK(C*8+I):A=#701+I*24 120 FOR J=0 TO 7 125 D=B:IF 128>>J&N D=P 130 POKEA+J,D&#F 140 POKEA+J+8,D>>4&#F 150 POKEA+J+16,D>>8 160 NEXT 170 NEXT 180 GSB200:RTN 199 'send LED data 200 POKE#700,0:IF I2CW(#46,#700,1,#701,192) STOP 210 RTN 299 'main (joystick) 300 POKE#700,#F2:IF I2CR(#46,#700,1,#700,1) STOP 310 K=PEEK(#700) 320 IF K=2 C=C+1:GSB100 330 IF K=16 C=C-1:GSB100 333 IF K=1 C=ASC("A"):GSB100 334 IF K=4 GOTO 500 336 IF K=8 GOTO 400 340 GOTO 300 399 'demo 400 FOR C=0 TO 223:GSB100:NEXT:CONT 500 FOR I=0 TO 192:POKE#701+I,RND(2)*4:NEXT:GSB200:CONT

I accessed a ID EEPROM written settings also.
Connect GPIO27:ID_SD GPIO28:ID_SC (don't have to pull up) *see doc

5 'header 6 P=12 10 POKE#800,0,0:IF I2CR(#50,#800,2,#802,P) ERR 20 N=[4]:?STR$(#802,3),"N:";N,"len:";[5],[6] 30 'atom 35 FOR I=1 TO N 40 POKE#800,0,P:IF I2CR(#50,#800,2,#802,128) ERR 50 ?"type:";[1],"cnt:";[2],"len:";[3] 60 'vendor info 70 IF [1]=1 L=PEEK(#802+28):?STR$(#802+30,L),STR$(#802+30+L,PEEK(#802+29)) 80 'GPIO map 90 IF [1]=2 ?"drive:";PEEK(#802+8),"power:";PEEK(#803+8):FOR J=0 TO 27:?"GPIO";J;":";PEEK(#804+8+J):NEXT 95 'DT blob 96 IF [1]=3 FOR J=0 TO 100:C=PEEK(#802+8+J):?CHR$(C);:NEXT:? 100 P=P+8+[3]:NEXT

Try another HATs!

- Sense HAT
- Rainbow HAT
- Raspberry Pi Boards, Kits, HATs, and Accessories - Next Day Delivery - Pimoroni
- the code of Micro Dot pHAT

Silver IchigoJam without Solder Mask by PCBGOGO

2017/02/28 23:55:00
#IchigoJam #PCB #maker #english 

There are many PCB making service companies.
I tried to order to PCBGOGO.
I found an option "none (なし)" of the solder mask I've not seen.

This is IchigoJam silver edition!!

Without solder mask!

GND pattern is opened so be careful to solder!

The crystal must solder with some spaces from PCB.

I've got Bus Buttons rev2 too. It's nice that delivery time is short!

- プリント基板試作・製作・製造のPCBGOGO.JP【中国基板試作メーカ】

Math with Programming "Sum in Your Head" on IchigoJam with Tilted LCD

2017/02/27 23:55:00
#IchigoJam #maker #english 

The computer helps you whole life!
Of cause your school life too.

This program helps to improve your speed of calculation for IchigoJam.

10 S=-1:W=31 20 N=0:S=S+1:W=W-1 30 FOR I=1 TO 3 40 CLS:WAIT10 50 M=RND(9)+1 60 LC 7,3:?M 70 WAITW 80 N=N+M 90 NEXT 100 CLS:INPUT"ANS?",A 110 IF A=N ?"OK!":WAIT30:GOTO 20 120 ?"NG! A:";N 130 ?"SCORE:";S

"Flash Sum in Your Head" (フラッシュ暗算@ja)

IchigoJam with LCD shield for IchigoJam.

If you solder the LCD tilted, you can use IchigoJam like the laptop!

Hello Pla-RoBoHoN! Build with the OLFA Art Knife 10B and Talk

2017/02/19 23:55:00
#maker #robo #english 

I built a PLA-RoBoHoN plastic model full scaled robot phone RoBoHoN by SHARP.

I chose green eyes from 5 colors.

It's a great tool the art-knife by OLFA to finish its shape of the part!

I've done!

I want to be spoken by PLA-RoBoHoN Instead of real RoBoHoN.

say -v Princess "hello i'm pla robo hone. nice to meet you."

It's fun the say command on Mac!
This program to say a sample sentence by all of the American English talkers.

say -v '?' | grep en_US | while read i; do say -i -v `echo ${i} | awk '{print $1}'` ${i} ; done

modified "say のサンプルを全部喋らせる - Qiita"
recommends: Agnes, Alex, Junior, Kathy, Princess, Samantha, Trinoids, Vicki, Victoria

say -v Kyoko "こんにちは、ぼくプラロボホン。よろしくね"

Kyoko is Japanese speaker on the "say" command of Mac.

Cutlery Card expantion for Kids IoT Hackathon

2017/02/18 23:55:00
#maker #KidsIT #sabae #IchigoJam #english 

Let's control a ¥400 servo motor (SG-90) by IchigoJam to help your mother!

And connect FaBo #103 → IN1, #109 → IN2, #101 → LED

There are Cutlery Card expantion for Kids IoT Hackathon (CutleryCard_ex1.pdf)

Hack with cards!

Make by paper!

Presentation it!

Automatic wash‐line polea rod

Memo to remember items to buy

Vacuum cleaner robo

Automatic dust box

Thank you for your great creations!

- こどもIoTハッカソン (Kids IoT Hackathon)

Failure teaches Success / PCB of Sabae bus for realtime open data was updated

2017/02/17 23:55:00
#maker #PCB #sabae #IchigoJam #english 

I got 11 pieces of PCBs for Sabae Bus from elecrow. (I ordered 29 Jan)

I found wiring misses all pattern of tact switches are wrong!
I had to cut each 2 legs of the tact switch to fix.

It works! This is a test program on IchigoJam.

10 FOR I=1 TO 6:OUT I,-1:NEXT:'switch to IN from OUT pin 20 ?BIN$(IN(),11) 30 WAIT 5 40 GOTO 20

I updated the PCB as version 2
"Bus Buttons by taisukef d3fc1ea69f75ebd6 - Upverter"
- added holes on four corners
- added silks on each switches
- added a LED for the slide switch
- fixed a PCB pattern of the tact switch
- fixed a PCB pattern of the slide switch

Failure teaches Success! Keep to create!

この作品は「Creative Commons — CC BY 4.0」の下に提供されています。
CC BY 福野泰介 - Taisuke Fukuno / @taisukef / high-res profile image