gobot.io/x/gobot@v1.16.0/platforms/intel-iot/curie/README.md (about) 1 # Curie 2 3 The Intel Curie is a tiny computer for the Internet of Things. It is the processor used by the [Arduino/Genuino 101](https://www.arduino.cc/en/Main/ArduinoBoard101) and the [Intel TinyTILE](https://software.intel.com/en-us/node/675623). 4 5 In addition to the GPIO, ADC, and I2C hardware interfaces, the Curie also has a built-in Inertial Measurement Unit (IMU), including an accelerometer, gyroscope, and thermometer. 6 7 For more info about the Intel Curie platform go to: [https://www.intel.com/content/www/us/en/products/boards-kits/curie.html](https://www.intel.com/content/www/us/en/products/boards-kits/curie.html). 8 9 ## How to Install 10 11 You would normally install Go and Gobot on your computer. When you execute the Gobot program code, it communicates with the connected microcontroller using the [Firmata protocol](https://github.com/firmata/protocol), either using a serial port, or the Bluetooth LE wireless interface. 12 13 ``` 14 go get -d -u gobot.io/x/gobot/... 15 ``` 16 17 ## How To Use 18 19 ```go 20 package main 21 22 import ( 23 "log" 24 "time" 25 26 "gobot.io/x/gobot" 27 "gobot.io/x/gobot/drivers/gpio" 28 "gobot.io/x/gobot/platforms/firmata" 29 "gobot.io/x/gobot/platforms/intel-iot/curie" 30 ) 31 32 func main() { 33 firmataAdaptor := firmata.NewAdaptor("/dev/ttyACM0") 34 led := gpio.NewLedDriver(firmataAdaptor, "13") 35 imu := curie.NewIMUDriver(firmataAdaptor) 36 37 work := func() { 38 imu.On("Accelerometer", func(data interface{}) { 39 log.Println("Accelerometer", data) 40 }) 41 42 imu.On("Gyroscope", func(data interface{}) { 43 log.Println("Gyroscope", data) 44 }) 45 46 imu.On("Temperature", func(data interface{}) { 47 log.Println("Temperature", data) 48 }) 49 50 gobot.Every(1*time.Second, func() { 51 led.Toggle() 52 }) 53 54 gobot.Every(100*time.Millisecond, func() { 55 imu.ReadAccelerometer() 56 imu.ReadGyroscope() 57 imu.ReadTemperature() 58 }) 59 } 60 61 robot := gobot.NewRobot("curieBot", 62 []gobot.Connection{firmataAdaptor}, 63 []gobot.Device{imu, led}, 64 work, 65 ) 66 67 robot.Start() 68 } 69 ``` 70 71 ## How to Connect 72 73 ### Installing Firmware 74 75 You need to flash your Intel Curie with firmware that uses ConfigurableFirmata along with the FirmataCurieIMU plugin. There are 2 versions of this firmware, once that allows connecting using the serial interface, the other using a Bluetooth LE connection. 76 77 To setup your Arduino environment: 78 79 - Install the latest Arduino, if you have not done so yet. 80 - Install the "Intel Curie Boards" board files using the "Board Manager". You can find it in the Arduino IDE under the "Tools" menu. Choose "Boards > Boards Manager". 81 82 Search for the "Intel Curie Boards" package in the "Boards Manager" dialog, and then install the latest version. 83 84 - Download the ZIP file for the ConfigurableFirmata library. You can download the latest version of the ConfigurableFirmata from here: 85 86 [https://github.com/firmata/ConfigurableFirmata/archive/master.zip](https://github.com/firmata/ConfigurableFirmata/archive/master.zip) 87 88 Once you have downloaded ConfigurableFirmata, install it by using the "Library Manager". You can find it in the Arduino IDE under the "Sketch" menu. Choose "Include Library > Add .ZIP Library". Select the ZIP file for the ConfigurableFirmata library that you just downloaded. 89 90 - Download the ZIP file for the FirmataCurieIMU library. You can download the latest version of FirmataCurieIMU from here: 91 92 [https://github.com/intel-iot-devkit/firmata-curie-imu/archive/master.zip](https://github.com/intel-iot-devkit/firmata-curie-imu/archive/master.zip) 93 94 Once you have downloaded the FirmataCurieIMU library, install it by using the "Library Manager". You can find it in the Arduino IDE under the "Sketch" menu. Choose "Include Library > Add .ZIP Library". Select the ZIP file for the FirmataCurieIMU library that you just downloaded. 95 96 - Linux only: On some Linux distributions, additional device rules are required in order to connect to the board. Run the following command then unplug the board and plug it back in before proceeding: 97 98 ```sh 99 curl -sL https://raw.githubusercontent.com/01org/corelibs-arduino101/master/scripts/create_dfu_udev_rule | sudo -E bash - 100 ``` 101 102 Now you are ready to install your firmware. You must decide if you want to connect via the serial port, or using Bluetooth LE. 103 104 ### Serial Port 105 106 To use your Intel Curie connected via serial port, you should use the sketch located here: 107 108 [https://github.com/intel-iot-devkit/firmata-curie-imu/blob/master/examples/everythingIMU/everythingIMU.ino](https://github.com/intel-iot-devkit/firmata-curie-imu/blob/master/examples/everythingIMU/everythingIMU.ino) 109 110 Once you have loaded this sketch on your Intel Curie, you can run your Gobot code to communicate with it. Leave your Arduino 101 or TinyTILE connected using the serial cable that you used to flash the firmware, and refer to that same serial port name in your Gobot code. 111 112 ### Bluetooth LE 113 114 To use your Intel Curie connected via Bluetooth LE, you should use the sketch located here: 115 116 [https://github.com/intel-iot-devkit/firmata-curie-imu/blob/master/examples/bleIMU/bleIMU.ino](https://github.com/intel-iot-devkit/firmata-curie-imu/blob/master/examples/bleIMU/bleIMU.ino) 117 118 Once you have loaded this sketch on your Intel Curie, you can run your Gobot code to communicate with it. 119 120 Power up your Arduino 101 or TinyTILE using a battery or other power source, and connect using the BLE address or name. The default BLE name is "FIRMATA".