This is the tutorial for programming the NodeMCU CP1202 board using the Arduino IDE. The code that will be used is the Blink example. And the board that I’m using looks like this.
Here are the steps I followed:
- Install the drivers from https://www.silabs.com/products/development-tools/software/usb-to-uart-bridge-vcp-drivers
- Download the ESP8266 board information for Arduino
- Open the Arduino IDE
- Click on the File menu and then Preferences
- In the Additional Boards Manager URLs, enter this: http://arduino.esp8266.com/stable/package_esp8266com_index.json
- Click Ok
- Click on the Tools menu, click Boards and then click Boards Manager
- Wait for it to download the new boards information
- Search for ESP8266 and install it
- From the Tools menu, select the following:
- Board: NodeMCU 1.0 (ESP-12E Module)
- Flash Size: 4M (3M SPIFFS)
- CPU Frequency: 80MHz
- Upload Speed: 115200
- Port: (whichever COM port it is)
- Erase Flash: Sketch Only
- From the File menu, click Examples, click ESP8266 and then click Blink
- Compile and download
- Voila! 🙂
I figured that instead of creating a blog entry of each little Lucid program I make I’ll keep uploading them to Github. They should be fairly easy to understand. I’ll make a blog entry for any complex programs I make that require a little explanation.
You can find them here: https://github.com/coytar/Snippets/tree/master/Lucid/
Feel free to contact me if you have any questions 🙂
Here’s a simple binary counter using the onboard LEDs on the Mojo V3:
Source code: https://github.com/coytar/Snippets/tree/master/Lucid/BinaryCounter
I found an even simpler code:
Source code: https://github.com/coytar/Snippets/tree/master/Lucid/BinaryCounterV2
I wanted to play with FPGAs so I bought a Mojo V3 board (https://embeddedmicro.com/products/mojo-v3). (FYI I got cheaper from another site). To use this board you need the Xilinx ISE software which is available for free. Xilinx provides two methods:
1) Download a pre built VM with the ISE software already installed
2) Download the install files and do it your self.
The obvious choice I thought would be option 1. I download the VM from here (https://www.xilinx.com/support/download/index.html/content/xilinx/en/downloadNav/design-tools/14_7-windows.html).
Here’s my quick review of the VM:
- It uses Oracle Linux 6.4 running Kernel 2.6-32.358 which can’t interface with the Mojo
- Despite my best efforts I couldn’t change enough settings to make it interface with the Mojo V3. Oracle Linux kept loading the Mojo as ttyUSB0 instead of ttyACM0, and I couldn’t change that.
After that experience I decided to build my own VM but this time use Ubuntu as the base system. I used Ubuntu 16.04 and everything worked beautifully!
I tried to follow this tutorial (http://www.simpleiothings.com/10-diy-wifi-smoke-alarm-notifier-roost-nest-alternative-full-tutorial/) but it didn’t really work. It didn’t really explain everything but I think I understood it. In the end I got this error in LuaLoader:
Executing Interrupt Sensor Software
Listening for Sensor Inputs…
PANIC: unprotected error in call to Lua API (1a_interruptSensor.lua:39: ‘<eof>’ expected near ‘end’)
I didn’t like this Lua interface so I’m going to try something else.
Few things to note:
- you can no longer download the lua firmware, it is now a custom build service from https://nodemcu-build.com where you can specify which modules you want
If you’re making an WPF Visual Basic application and make a custom IValueConverter for the first time you’ll probably see this message
“The name <your_class> does not exist in the namespace “clr-namespace:<your_application>”
Here’s a screenshot from the XAML Designer:
The fix is surprisingly easy:
- Change that line to “<local:Application…”
- Build the solution
- Change it back to “<local:ID2Converter…”
In case you’re wondering, my xaml.vb file looks like this:
Public Class ID2Converter
Public Function Convert(ByVal value As Object, ByVal targetType As Type, ByVal parameter As Object, ByVal culture As CultureInfo) As Object Implements IValueConverter.Convert
' blah blah blah
Public Function ConvertBack(ByVal value As Object, ByVal targetType As Type, ByVal parameter As Object, ByVal culture As CultureInfo) As Object Implements IValueConverter.ConvertBack
' blah blah blah
Public Class MyClass
' blah blah blah
So, you can put the IValueConverter in the same xaml.vb as the class using it. No need to declare namespace etc 🙂
Another demo for interfacing an Arduino with the DS1307 Real Time Clock. The board I used (see here) also has an integrated 24C32 32K EEPROM which we won’t worry about in this demo.
Here’s a picture of my setup:
- Arduino Uno R3
- 16×2 LCD Shield
- DS1307 board (I used this one) but you could use this one too
- CR2032 button cell
(NOTE: If you’re using the same board as me then wire to the side of the board with the pins SQ, DS, SCL, SDA, VCC, GND & BAT)
- Uno’s 5V (via LCD Shield) to RTC’s 5V
- Uno’s GND (via LCD Shield) to RTC’s GND
- Uno’s Analog Pin 4 (via LCD Shield) to RTC’s SDA
- Uno’s Analog Pin 5 (via LCD Shield) to RTC’s SCL
- Leave the other pins unconnected
- Put the button cell in!
You can find the code here. And voila! 🙂