This instructable will teach you how to connect a NodeMCU ESP8266 to an Intel Quark D2000 board. At the end of this tutorial, you will be able to control an LED connected to the D2000 over wifi! You will choose whether to turn on or off the LED, that command will be send over wifi to the ESP8266, and the ESP8266 will process the information, and send the correct data to the D2000 to turn on or off the LED.
When I was first getting started, it was difficult to find good tutorials for getting started with the ESP8266 and the D2000 board. I finally managed to figure out how to program the ESP8266 with the Arduino IDE. However, it was harder to find a good explanation and tutorial on having pin input for the D2000 board.
I hope this tutorial helps you learn how these work!
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: Materials
Here's just a few things you're going to need before we can get started:
- Intel Quark D2000 board
- NodeMCU ESP8266
- A breadboard
- Jumper wires
- 2 micro USB cables
Step 2: Getting Started With NodeMCU ESP8266
We will be programming the ESP8266 with the Arduino IDE. Open the Arduino IDE.
Go to File -> Preferences.
Under Additional Board's Manager URL, copy and paste http://arduino.esp8266.com/stable/package_esp8266com_index.json then click ok.
Now go to Tools -> Board -> Boards Manager. The esp8266 boards should show up, and install that library.
After the boards are installed, go to Tools -> Board, and choose your board from the ESP8266 Modules.
Choose the correct COM port, and you're now ready to upload programs!
Step 3: Getting Started With Quark D2000 Board
Go to https://registrationcenter.intel.com/en/forms/?productid=2580 and sign up to download the software for the D2000 board. After it downloads, follow the installation instructions to finish installing the software.
For the first time you use the board, you will need to flash the ROM. Go to Intel ISSM -> Update Target ROM.
To start a new project, go to Intel ISSM -> New Intel QMSI/BSP Project
Enter a name for your project, and select the gpio template.
Step 4: D2000 Board Code
Copy and paste the code into main.c from the project you just created with the Intel ISSM.
Let's go over some of the lines of code so you understand what's going on.
- PIN_OUT is the output pin that the LED is connected to, and PIN_IN is the pin that will receive the input to turn on/off the LED
- cfg.callback = gpio_example_callback;
- When an interrupt occurs (PIN_IN goes from LOW to HIGH), the gpio_example_callback function is called
- The gpio_example_callback function finds out if the LED is currently on or off. If the LED is on, it get's turned off, and vice versa
There are more extensive comments in the code to help clarify it more.
Step 5: NodeMCU ESP8266 Code
Copy and paste the code to program the ESP8266. Some explanation of the code is below.
- bool state is the variable that tells if the LED is currently on or off
- If the client wants to change the state of the LED (it was off and they want to turn it on, or it was on and they want to turn it off), the ESP8266 sends a LOW, then HIGH voltage to the D2000 board
- This is because the interrupts are enabled on the HIGH pulse of the pin, so the input pin needs to go LOW then HIGH to change the state of the LED
Further explanation of the code is available in the comments in the code.
Step 6: Making Connections
The Quark D2000 board pinout can be found on page 10 of http://www.intel.com/content/dam/www/public/us/en/documents/guides/quark-d2000-crb-user-guide.pdf
The ESP8266 pinout can be found in the picture above.
Connect D7 from the NodeMCU to A0 on the D2000 board.
Connect pin SSO 10 on the D2000 board to the anode of the LED.
Connect a resistor to the cathode of the LED, and connect GND on the D2000 board to the resistor.
Connect 5V on the D2000 board to Vin on the NodeMCU, and GND on the D2000 to GND on the NodeMCU.
Step 7: Running the Code
Upload the code for the D2000 board. To run it for the first time, go to Debug As and choose (flashing). If a breakpoint is encountered, either press f8, or right click on the program in the Debug window, and choose Resume.
Upload the Arduino code to the ESP8266, and open the Serial Monitor. Once the ESP8266 connects to the wifi, an http address will show up on the monitor. Go to that address in your browser to connect to the ESP8266.
Once the http address has shown on the Serial Monitor, you can unplug the ESP8266 from the computer so it is only powered by the D2000 board.
On the webpage, click the buttons to turn on and off the LED!