Sunday, November 20, 2016

IPv6, Arduino, and temperature

Referring to what I learned last time, I installed the SparkFun library for the HTU21D. Then I did a simple mash-up of MiniHTTPServer and SparkFun_HTU21D_Demo, and it worked on the first try. I think I spent so much time starting two years ago being frustrated with the uIP library that I guess I don't expect Arduino to be simple, or even to work. However, I can now read temperature and humidity over IPv6 for around $25 from eBay, now that I found a working IPv6 (single-stack) library in EtherSia. I'm not complaining, but it just feels anticlimactic after all those months of arguing with the first Ethernet library to have the second Ethernet library work right away with minimal effort.

Lesson (re)learned: Always use the right tool for the job.

For future reference, this sketch would not work with an Arduino with less memory than the Nano v3; it needs that 2kB of SRAM. My hardware is HTU21D for temperature and humidity, NanoShield and EtherSia for IPv6 Ethernet, and Arduino Nano v3.

My code with EtherSia_ENC28J60:
Sketch uses 12,162 bytes (39%) of program storage space. Maximum is 30,720 bytes.
Global variables use 1,263 bytes (61%) of dynamic memory, leaving 785 bytes for local variables. Maximum is 2,048 bytes.

My code, but claiming EtherSia_W5100:
Sketch uses 11,864 bytes (38%) of program storage space. Maximum is 30,720 bytes.
Global variables use 1,259 bytes (61%) of dynamic memory, leaving 789 bytes for local variables. Maximum is 2,048 bytes.

SparkFun_HTU21D_Demo:
Sketch uses 5,656 bytes (18%) of program storage space. Maximum is 30,720 bytes.
Global variables use 460 bytes (22%) of dynamic memory, leaving 1,588 bytes for local variables. Maximum is 2,048 bytes.

Packet Printer (EtherSia_ENC28J60):
Sketch uses 7,406 bytes (24%) of program storage space. Maximum is 30,720 bytes.
Global variables use 1,053 bytes (51%) of dynamic memory, leaving 995 bytes for local variables. Maximum is 2,048 bytes.

Mini HTTP Server (EtherSia_W5100):
Sketch uses 8,112 bytes (26%) of program storage space. Maximum is 30,720 bytes.
Global variables use 1,025 bytes (50%) of dynamic memory, leaving 1,023 bytes for local variables. Maximum is 2,048 bytes.

Saturday, November 19, 2016

Arduino Nano with IPv6

I haven't touched my Arduino Nanos in a while because they didn't do IPv6 with the arduino_uip library I thought would work. However, I poked around again, and found EtherSia, so I thought I would give it a try. In the intervening time, I have switched from Mac to Linux for my daily driver.

I went to the Arduino Getting Started page, and downloaded the latest version of the IDE for Linux. I connected my Nano v3 that has the FTDI controller, so I selected Tools (menu) > Board > Arduino Nano and Tools > Port > /dev/ttyUSB0. The software selected Tools > Processor > ATmega328 automatically (which is correct for the Nano v3, but not what the hardware-specific page says to expect). I selected the "Blink" sketch (the hardware equivalent of "Hello, World!", from File (menu) > Examples > 01.Basics > Blink), clicked on Verify, clicked on Upload, and my Arduino Nano is blinking at me.

The relevant output line from lsusb for me was:

Bus 003 Device 047: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC

When I run Tools > Get Board Info, I get
BN: Unknown board
VID: 0403
PID: 6001
SN: Upload any sketch to obtain it

No drivers were downloaded; it just worked. Despite knowing that I should quit while I'm ahead (so I can have dinner at a reasonable time), I wanted to try IPv6 from EtherSia! I went to Sketch (menu) > Include Library > Manage Libraries. I put "ethersia" in the Search box, it showed up, I clicked on Install next to the (most recent) version number, and that was just too easy. File > Examples > EtherSia > Minimal. I knew I would want it, so I brought up Tools > Serial Monitor as well. I switched it to 38400 baud (as mentioned in the sketch), and again it just works! I could even ping6 it!

Now I just need to see how it feels about reporting temperature and humidity from HTU21D over IPv6 into my monitoring. That can wait until after dinner!

Thursday, November 17, 2016

TIL: Roku NASA HD

The NASA channel on my Roku wasn't working this afternoon before the launch; luckily we checked on it early enough to get through the ads without missing the launch. So I turned to Google, and I learned that ...

  1. The NASA public Roku channel has ads (from the channel dev).
  2. And more importantly, there's a NASA private Roku channel that is HD, with multiple streams (I remember when I couldn't watch the ISS because something else was on the NASA public Roku channel!), and no ads! (ref1 and Space Time, ref2 for NASA HD link)