tinkerboard

package
v1.8.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 21, 2017 License: Apache-2.0, Apache-2.0 Imports: 7 Imported by: 0

README

Tinker Board

The ASUS Tinker Board is a single board SoC computer based on the Rockchip RK3288 processor. It has built-in GPIO, PWM, SPI, and I2C interfaces.

For more info about the Tinker Board, go to https://www.asus.com/uk/Single-Board-Computer/Tinker-Board/.

How to Install

We recommend updating to the latest Debian TinkerOS when using the Tinker Board.

You would normally install Go and Gobot on your workstation. Once installed, cross compile your program on your workstation, transfer the final executable to your Tinker Board, and run the program on the Tinker Board as documented here.

go get -d -u gobot.io/x/gobot/...
Enabling GPIO pins

To enable use of the Tinker Board GPIO pins, you need to perform the following steps as a one-time configuration. Once your Tinker Board has been configured, you do not need to do so again.

Note that these configuration steps must be performed on the Tinker Board itself. The easiest is to login to the Tinker Board via SSH:

ssh linaro@192.168.1.xxx
Create a group "gpio"

Create a Linux group named "gpio" by running the following command:

sudo groupadd -f --system gpio

If you already have a "gpio" group, you can skip to the next step.

Add the "linaro" user to the new "gpio" group

Add the user "linaro" to be a member of the Linux group named "gpio" by running the following command:

sudo usermod -a -G gpio linaro

If you already have added the "gpio" group, you can skip to the next step.

Add a "udev" rules file

Create a new "udev" rules file for the GPIO on the Tinker Board by running the following command:

sudo vi /etc/udev/rules.d/91-gpio.rules

And add the following contents to the file:

SUBSYSTEM=="gpio", KERNEL=="gpiochip*", ACTION=="add", PROGRAM="/bin/sh -c 'chown root:gpio /sys/class/gpio/export /sys/class/gpio/unexport ; chmod 220 /sys/class/gpio/export /sys/class/gpio/unexport'"
SUBSYSTEM=="gpio", KERNEL=="gpio*", ACTION=="add", PROGRAM="/bin/sh -c 'chown root:gpio /sys%p/active_low /sys%p/direction /sys%p/edge /sys%p/value ; chmod 660 /sys%p/active_low /sys%p/direction /sys%p/edge /sys%p/value'"

Press the "Esc" key, then press the ":" key and then the "q" key, and then press the "Enter" key. This should save your file. After rebooting your Tinker Board, you should be able to run your Gobot code that uses GPIO.

Enabling I2C

To enable use of the Tinker Board I2C, you need to perform the following steps as a one-time configuration. Once your Tinker Board has been configured, you do not need to do so again.

Note that these configuration steps must be performed on the Tinker Board itself. The easiest is to login to the Tinker Board via SSH:

ssh linaro@192.168.1.xxx
Create a group "i2c"

Create a Linux group named "i2c" by running the following command:

sudo groupadd -f --system i2c

If you already have a "i2c" group, you can skip to the next step.

Add the "linaro" user to the new "i2c" group

Add the user "linaro" to be a member of the Linux group named "i2c" by running the following command:

sudo usermod -a -G gpio linaro

If you already have added the "i2c" group, you can skip to the next step.

Add a "udev" rules file

Create a new "udev" rules file for the I2C on the Tinker Board by running the following command:

sudo vi /etc/udev/rules.d/92-i2c.rules

And add the following contents to the file:

KERNEL=="i2c-0"     , GROUP="i2c", MODE="0660"
KERNEL=="i2c-[1-9]*", GROUP="i2c", MODE="0666"

Press the "Esc" key, then press the ":" key and then the "q" key, and then press the "Enter" key. This should save your file. After rebooting your Tinker Board, you should be able to run your Gobot code that uses I2C.

How to Use

The pin numbering used by your Gobot program should match the way your board is labeled right on the board itself.

r := tinkerboard.NewAdaptor()
led := gpio.NewLedDriver(r, "7")

How to Connect

Compiling

Compile your Gobot program on your workstation like this:

$ GOARM=7 GOARCH=arm GOOS=linux go build examples/tinkerboard_blink.go

Once you have compiled your code, you can you can upload your program and execute it on the Tinkerboard from your workstation using the scp and ssh commands like this:

$ scp tinkerboard_blink linaro@192.168.1.xxx:/home/linaro/
$ ssh -t linaro@192.168.1.xxx "./tinkerboard_blink"

Documentation

Overview

Package tinkerboard contains the Gobot adaptor for the ASUS Tinker Board.

For further information refer to tinkerboard README: https://github.com/hybridgroup/gobot/blob/master/platforms/tinkerboard/README.md

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Adaptor

type Adaptor struct {
	// contains filtered or unexported fields
}

Adaptor represents a Gobot Adaptor for the ASUS Tinker Board

func NewAdaptor

func NewAdaptor() *Adaptor

NewAdaptor creates a Tinkerboard Adaptor

func (*Adaptor) Connect

func (c *Adaptor) Connect() (err error)

Connect initializes the board

func (*Adaptor) DigitalPin

func (c *Adaptor) DigitalPin(pin string, dir string) (sysfsPin sysfs.DigitalPinner, err error)

DigitalPin returns matched digitalPin for specified values

func (*Adaptor) DigitalRead

func (c *Adaptor) DigitalRead(pin string) (val int, err error)

DigitalRead reads digital value from the specified pin.

func (*Adaptor) DigitalWrite

func (c *Adaptor) DigitalWrite(pin string, val byte) (err error)

DigitalWrite writes digital value to the specified pin.

func (*Adaptor) Finalize

func (c *Adaptor) Finalize() (err error)

Finalize closes connection to board and pins

func (*Adaptor) GetConnection

func (c *Adaptor) GetConnection(address int, bus int) (connection i2c.Connection, err error)

GetConnection returns a connection to a device on a specified bus. Valid bus number is [0..1] which corresponds to /dev/i2c-0 through /dev/i2c-1.

func (*Adaptor) GetDefaultBus

func (c *Adaptor) GetDefaultBus() int

GetDefaultBus returns the default i2c bus for this platform

func (*Adaptor) Name

func (c *Adaptor) Name() string

Name returns the name of the Adaptor

func (*Adaptor) PWMPin

func (c *Adaptor) PWMPin(pin string) (sysfsPin sysfs.PWMPinner, err error)

PWMPin returns matched pwmPin for specified pin number

func (*Adaptor) PwmWrite

func (c *Adaptor) PwmWrite(pin string, val byte) (err error)

PwmWrite writes a PWM signal to the specified pin

func (*Adaptor) ServoWrite

func (c *Adaptor) ServoWrite(pin string, angle byte) (err error)

ServoWrite writes a servo signal to the specified pin

func (*Adaptor) SetName

func (c *Adaptor) SetName(n string)

SetName sets the name of the Adaptor

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL