TinyGo is Open Source Project Sponsored by Google . Its totally new LLVM Based Go Compiler to make it possible Go Programs on micro controller . including And Arduino Uno , Arduino nano33 IOT and https://microbit.org/ Adafruit Circuit Playground Express and other 32 different boards . TinyGO also targets Web Assembly (WASM)
According to Google, it is not uncommon for the Go compiler to generate WASM files of 10+ MB when importing libraries, with ~2MB being the minimum. Instead, a simple “hello world” program is translated into a 575 bytes WASM program by TinyGo.
Getting Started with TinyGo

Linux – Ubuntu / Debian
Make sure go already installed on your machine to install tinygo . recommendation GOv1.14
Getting latest Tiny-Go release
wget https://github.com/tinygo-org/tinygo/releases/download/v0.13.1/tinygo_0.13.1_amd64.deb sudo dpkg -i tinygo_0.13.1_amd64.deb
If you are on a Raspberry Pi or other ARM-based Linux computer, you should use this command instead:
wget https://github.com/tinygo-org/tinygo/releases/download/v0.13.1/tinygo_0.13.1_armhf.deb sudo dpkg -i tinygo_0.13.1_armhf.deb
Setting up PATH variable
export PATH=$PATH:/usr/local/tinygo/bin
You can test that the installation is working properly by running this code which should display the version number:
$ tinygo version tinygo version 0.13.1 linux/amd64
Additional Requirements for Microcontrollers on Ubuntu/Debian
To compile and flash TinyGo programs for AVR based processors such as the original Arduino Uno you must install some extra tools:
sudo apt-get install gcc-avr
sudo apt-get install avr-libc
sudo apt-get install avrdude
- Windows
NOTE: You cannot yet create Windows binary programs using TinyGo, only MCU and WASM targets.
first make sure recommended GO.1.4x+ version installed properly
Download source zip from official github repo
https://github.com/tinygo-org/tinygo/releases/download/v0.13.1/tinygo0.13.1.windows-amd64.zip
Setting Tinygo zip location
C:\tinygo\bin
set path by following commandset PATH=%PATH%;"C:\tinygo\bin";
Verify installation
tinygo version
- Macosx
i will be using on macos for this experiment
make sure any gov1.12+ installed on machine and make sure homebrew utility installed
You can use Homebrew to install TinyGo using the following commands:
brew tap tinygo-org/tools
brew install tinygo
Verify installation
tinygo version tinygo version 0.13.1 darwin/amd64 (using go version go1.13.4 and LLVM version 10.0.1)
Additional requirements for micro-controller
In this case I will be using Arduino Uno and i need to install some extra tools for compiling and flashing tiny go programs .
brew tap osx-cross/avr
brew install avr-gcc
brew install avrdude
its take some time to install .
Installing driver that support around 48 devices and sensors
go get tinygo.org/x/drivers
For more info check :- https://github.com/tinygo-org/drivers/
First Golang Program for IOT Device
Make sure you have plunged your IoT device :
package main import ( "machine" "time" ) func main() { led := machine.LED led.Configure(machine.PinConfig{Mode: machine.PinOutput}) for { led.Low() time.Sleep(time.Millisecond * 500) led.High() time.Sleep(time.Millisecond * 500) } }
Make sure your terminal path is exact same as your working directory
blinky1 sangam$ ls blinky1.go sangam:blinky1 sangam$ tinygo flash -target=arduino blinky1.go avrdude: AVR device initialized and ready to accept instructions Reading | ################################################## | 100% 0.00s avrdude: Device signature = 0x1e950f (probably m328p) avrdude: NOTE: "flash" memory has been specified, an erase cycle will be performed To disable this feature, specify the -D option. avrdude: erasing chip avrdude: reading input file "/var/folders/mg/_355pdvd741cz0z99ys9s66h0000gn/T/tinygo680816230/main.hex" avrdude: writing flash (558 bytes): Writing | ################################################## | 100% 0.13s avrdude: 558 bytes of flash written avrdude: verifying flash memory against /var/folders/mg/_355pdvd741cz0z99ys9s66h0000gn/T/tinygo680816230/main.hex: avrdude: load data flash data from input file /var/folders/mg/_355pdvd741cz0z99ys9s66h0000gn/T/tinygo680816230/main.hex: avrdude: input file /var/folders/mg/_355pdvd741cz0z99ys9s66h0000gn/T/tinygo680816230/main.hex contains 558 bytes avrdude: reading on-chip flash data: Reading | ################################################## | 100% 0.08s avrdude: verifying … avrdude: 558 bytes of flash verified avrdude done. Thank you. sangam:blinky1 sangam$
Changing the sleep time to 2000
package main import ( "machine" "time" ) func main() { led := machine.LED led.Configure(machine.PinConfig{Mode: machine.PinOutput}) for { led.Low() time.Sleep(time.Millisecond * 2000) led.High() time.Sleep(time.Millisecond * 2000) } }
Running Program again
sangam:blinky1 sangam$ tinygo flash -target=arduino blinky1.go avrdude: AVR device initialized and ready to accept instructions Reading | ################################################## | 100% 0.00s avrdude: Device signature = 0x1e950f (probably m328p) avrdude: NOTE: "flash" memory has been specified, an erase cycle will be performed To disable this feature, specify the -D option. avrdude: erasing chip avrdude: reading input file "/var/folders/mg/_355pdvd741cz0z99ys9s66h0000gn/T/tinygo419176077/main.hex" avrdude: writing flash (558 bytes): Writing | ################################################## | 100% 0.13s avrdude: 558 bytes of flash written avrdude: verifying flash memory against /var/folders/mg/_355pdvd741cz0z99ys9s66h0000gn/T/tinygo419176077/main.hex: avrdude: load data flash data from input file /var/folders/mg/_355pdvd741cz0z99ys9s66h0000gn/T/tinygo419176077/main.hex: avrdude: input file /var/folders/mg/_355pdvd741cz0z99ys9s66h0000gn/T/tinygo419176077/main.hex contains 558 bytes avrdude: reading on-chip flash data: Reading | ################################################## | 100% 0.08s avrdude: verifying … avrdude: 558 bytes of flash verified avrdude done. Thank you.
You will notice the blinking light cycle on Arduino Uno is changed .
Tinygo with Docker
now don’t need to worry about installing dependencies we have official tinygo image available . its open up new way of running and sharing tinygo image on different iot devices
https://hub.docker.com/r/tinygo/tinygo
Those who want to learn and explore more tinygo introduced browser based playground to learn .