NodeMCU ESP8266 CP1202 Programming (Blink)

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.

Image result for cp1202 nodemcu

Here are the steps I followed:

  1. Install the drivers from https://www.silabs.com/products/development-tools/software/usb-to-uart-bridge-vcp-drivers
  2. Download the ESP8266 board information for Arduino
    1. Open the Arduino IDE
    2. Click on the File menu and then Preferences
    3. In the Additional Boards Manager URLs, enter this: http://arduino.esp8266.com/stable/package_esp8266com_index.json
    4. Click Ok
    5. Click on the Tools menu, click Boards and then click Boards Manager
    6. Wait for it to download the new boards information
    7. Search for ESP8266 and install it
  3. From the Tools menu, select the following:
    1. Board: NodeMCU 1.0 (ESP-12E Module)
    2. Flash Size: 4M (3M SPIFFS)
    3. CPU Frequency: 80MHz
    4. Upload Speed: 115200
    5. Port: (whichever COM port it is)
    6. Erase Flash: Sketch Only
  4. From the File menu, click Examples, click ESP8266 and then click Blink
  5. Compile and download
  6. Voila! 🙂
Advertisements

Lucid Code Examples

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 🙂

Binary Counter (updated)

Here’s a simple binary counter using the onboard LEDs on the Mojo V3:

Capture

Source code: https://github.com/coytar/Snippets/tree/master/Lucid/BinaryCounter

UPDATE:
I found an even simpler code:

Capture

Source code: https://github.com/coytar/Snippets/tree/master/Lucid/BinaryCounterV2

ISE 14.7 + Mojo V3

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!

IOT Smoke Alarm Notifier

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

 

IValueConverter

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:temp1

The fix is surprisingly easy:

  1. Change that line to “<local:Application…”
  2. Build the solution
  3. Change it back to “<local:ID2Converter…”
  4. Voila!

In case you’re wondering, my xaml.vb file looks like this:

Imports System.Globalization

Public Class ID2Converter
 Implements IValueConverter

 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
 End Function

 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
 End Function
End Class

Public Class MyClass
' blah blah blah
End Class

So, you can put the IValueConverter in the same xaml.vb as the class using it. No need to declare namespace etc 🙂

Arduino + DS1307 RTC

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:

IMG_20151121_202254

Materials Used:

  • Arduino Uno R3
  • 16×2 LCD Shield
  • DS1307 board (I used this one) but you could use this one too
  • CR2032 button cell

Wiring details:

(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)

  1. Uno’s 5V (via LCD Shield) to RTC’s 5V
  2. Uno’s GND (via LCD Shield) to RTC’s GND
  3. Uno’s Analog Pin 4 (via LCD Shield) to RTC’s SDA
  4. Uno’s Analog Pin 5 (via LCD Shield) to RTC’s SCL
  5. Leave the other pins unconnected
  6. Put the button cell in!

You can find the code here. And voila! 🙂