Take a look at this video to see it in action.
- Intel Edison
- SparkFun Base Block
- SparkFun GPIO Block (solder headers, either male or female, to use the pins)
- 4 LEDs (red, green, blue, yellow)
- 4 330Ω resistors
- 4 1kΩ resistors
- 4 NPN transistors
- Plenty of jumper wires
Setting up Edison
If you haven't already, follow the Getting Started instructions from Intel, then return to these instructions.
Package manager configuration
Add AlexT's unofficial opkg repository. It contains many precompiled packages that can be installed by simply typing
opkg install <package name>.
To configure the repository, add the following lines to
src/gz all http://repo.opkg.net/edison/repo/all src/gz edison http://repo.opkg.net/edison/repo/edison src/gz core2-32 http://repo.opkg.net/edison/repo/core2-32
Update the package manager and install the first package we need:
opkg update opkg install git
git installed, we can now clone this repository onto Edison.
Installing MRAA using Edison helper scripts
Note: Newer versions of the Edison firmware may already have MRAA installed, so this step may be unnecessary.
edison-scripts provides a set of scripts for simplifying some things on Edison. Although only one script is needed for this demo, it may be useful for future projects. To use it, do the following:
git clone https://github.com/drejkim/edison-scripts.git ~/edison-scripts # Add ~/edison-scripts to PATH echo 'export PATH=$PATH:~/edison-scripts' >> ~/.profile source ~/.profile
Then, run the following:
# Install MRAA, the low level skeleton library for IO communication on Galileo, Edison, and other platforms installMraa.sh
Installing Node.js packages
- Navigate to
- Install the Node.js packages by typing
Note: You can use the Edison Mini or Arduino Breakout boards. However, the pin mappings will differ. For more details, see this tutorial from SparkFun.
Wiring up the circuit
Shut down Edison and unplug it from power. Connect the LEDs to the GPIO block as shown:
Important: The direction of the LEDs and the transistors matter! For the LEDs, the anode (longer leg) connects to a 330Ω resistor, while the cathode (shorter leg) connects to the collector of the transistor. When the flat edge of a transistor is facing you, the order of the pins from left to right are as follows: emitter, base, and collector.
Testing the circuit
To see if the LEDs are configured correctly:
- Navigate to
- Run the blink code by typing
The LEDs should blink on and off simultaneously.
Running the demo
Updating the WebSocket address
web/app.js. The section of the code looks like this:
// MODIFY THIS WITH THE APPROPRIATE URL var socket = io.connect('http://myedison.local:8080');
myedison with the name of your Edison.
Running the Node.js server
- Navigate to
- Run the server by typing
The Node.js server should now be running. The console will look something like this:
HTTP server listening on port 8080
Using the web client
Open a browser window and navigate to
myedison is the name of your Edison. You should now be able to control the LEDs from the browser! If you are unable to access the page, make sure your PC is on the same WiFi network as your Edison.
Using the iOS client
Using the Android client