Archive for the ‘Uncategorized’ Category

Notes: Rogers Wireless E-mail to Text

Tuesday, September 20th, 2016

Rogers has 2 ways (that I know of) for sending short e-mails to people as text messages.


Orange Pi Lite Notes

Tuesday, August 30th, 2016

Hey! It’s more notes!



Orange Pi Lite is, IMO, the only difficult Orange Pi to get working. Primarily, because it has WiFi, and no Network socket.

For an OS, use Armbian.

WARNING: the device will be unlit, no LEDs, until the OS image begins to boot. It could be half a minute before you see anything.

It can sometimes take a few tries to program the SD card correctly (either that or I’m using bad SD cards).

NOTE: Armbian will reboot a few times after first inserting a fresh memory card. You should wait a few minutes before you attempt to log in. When you see the red-light flashing, that means it’s about to reboot.

You’re going to need a way to view the console. Either by plugging in a mouse/keyboard/tv, or via a USB UART cable. UART pins are beside the USB ports. According to the image above, WHITE, GREEN, BLACK (TX, RX, GND). NEVER use the red (doesn’t provide enough power).

root password is 1234

Now for the work.

If you’re like me, you have a WPA2 protected WiFi network. I also hide my SSID, so there’s an extra step needed if you do that.

First, if you’re not already, become root.

It’ll save you a bunch of headaches, so again, become root. Don’t try to do this with sudo.

Generate a wpa_supplicant configuration.

Edit this file.

For security reasons, you may want to remove the line that shows your password.

If you use a hidden network, add a line “scan_ssid=1” to the network section. It should now look something like this:

Save and close the file. You can test the configuration like so.

If you wanted to manually connect to the internet, right now, you could do this.

To make this permanent, open up /etc/network/interfaces

Comment out or delete everything but the loopback. Your file should look something like this:

You can then restart networking.

And you should be on the internet now, and any time you reboot.

You can also now SSH in to it, and stop using your tv/mouse/keyboard. Hooray!


C.H.I.P. (by Next Thing Co) Notes

Monday, August 29th, 2016

Just some notes.


To reinstall (upgrade) the OS, go here:

You’re going to need a USB cable, and a jumper wire/paperclip. Ground the FEL line before plugging it in to your PC. If you’re on Linux, you’ll also have to follow some funny instructions to give your account permission to access the USB port via the Chrome web browser. For me the variable that’s supposed to be your login name wasn’t working, so I just used my login name directly.

The upgrade is all-or-nothing. Kernels can’t be updated with apt-get (yet).

If you go headless, getting WiFi configured can be a pain, especially if you have a hidden SSID. Common instructions are here:

The key thing is the command: nmtui

You can *almost* do everything in it. Manually adding a hidden SSID didn’t want to take for me.

SSID IS CASE SENSITIVE (also no matter how many times you type in an incorrect SSID, it wont work, *cough*).

Much further down in the post is some guy that talks about how to do it entirely from the command line. This is what you need.

nmcli con add con-name your_connection_name ifname wlan0 type wifi autoconnect no save yes ssid your_hidden_ssid

nmcli con modify your_connection_name wifi.hidden true wifi-sec.key-mgmt wpa-psk wifi-sec.psk your_passwd

# To connect
nmcli con up your_connection_name

# If it’s good, permanently make it autoconnect
nmcli con modify your_connection_name autoconnect yes
# or use the GUI (nmtui)

# To disconnect
nmcli con down your_connection_name

SSH comes preinstalled on 4.4. AVAHI (zeroconf) is preconfigured to give it the network name ‘chip’ (and chip.local), so you should be able to connect like so:

Getting the IP address is not ifconfig (though you can do sudo ifconfig).

Instead, use: ip addr

To not drive yourself crazy, make an alias for ll.

Install NodeJS.

Setup a simple web server.

AVAHI (Zeroconf) is also pre-configured. You should be able to connect to the server like so:


1 Wire

According to the “DIP” docs, the 1 Wire bus is located on LCD_D2 on pin header U13.

Arduino Notes

Saturday, August 27th, 2016

Just a bunch of scattered Arduino notes.



  • All data pins can be Digital Inputs or Outputs (i.e. D0-D13, A0-A5). Thus, 20 digital I/O pins
  • Caveat: D0 and D1 are shared by the UART bus used to communicate over USB. So if you want to avoid reading/writing weird values while connected to the PC, you may want to avoid these pins.
  • Pins D3, D5, D6, D9-D11, D13 have PWM’s attached to one of 3 (4) timers.
  • Timer1 (OC1x) on D9-D11 is the ‘fanciest’ timer. 😉
  • Pins A0-A5, as well as D4, D6, D8-10, D12 are all capable of Analog Input (not output)
  • To do analog out, use a PWM with some magic:
  • Each set of pins is a block.
    • PORTD is D0-D7 (8 bits*, DDRD)
    • PORTB is D8-D13 (6 bits, DDRB)
    • PORTC is A0-A5 (6 bits, DDRC)
  • Set the DDRx registers directly to write bytes (i.e. DDRD = B11111100;). You can read them too, and mask-out the data you’re not using
  • B11001010 macros can be used for bitmasks, etc
  • PinMode(pin,mode) – mode can be INPUT, OUTPUT, or INPUT_PULLUP
  • INPUT_PULLUP not available on D0 and D1.
  • D0 and D1 are actually the same pins as SCL and SCA. On the board twice for some reason.
  • Standard 4 pins with support for interrupts D0-D3. Leonardo does actually have one more (D7)
  • Serial.print(), Serial.println() to output to the PC console over UART.



Has 1 channel. Not ‘true’ UART, as true UART runs at 12v.

  • Uses Pins D0 and D1 (because of interrupts?). These pins also lack the optional pull-up resistors found on other Arduino pins.
  • 3 actual wires: TX, RX, GND. TX=Transmit, RX=Receive. Typically White, Green, Black
  • Data rate is typically 112 kHz (115200), but could be double that (230400)
  • Is technically “Full Duplex” because of the separate Transmit and Receive lines
  • Serial UART is an asynchronous protocol, WITHOUT a transmitted clock.
  • Devices must agree upon the data rate ahead of time, and must run their own perfectly sync’d clocks.
  • Primarily limited to communication between 2 devices. In theory multiple is possible, but it’s just not practical.


For that temperature sensor (DS18B20).

  • Uses ??

I2C/TWI (2-Wire)

For a variety of breakout chips. 16bit ADC (ADS1115), DAC (MCP4725), 64k EEPROM (24LC512), 128k SRAM (23LC1024*), 16bit Digital I/O Expander (MCP23017).

Loosely related to SMBus. Some SMBus devices could work over I2C.

  • Uses D2 and D3 (because of interrupts)
  • 3 actual pins: SCL, SDA, GND. SCL=Clock, SDA=Data
  • Open Drain, using 3-state logic (high, low, high-impedance).
  • Master/Slave(s). Technically it can have multiple masters, but the masters can’t directly talk to each-other over the bus (need to negotiate via another way).
  • Either 112 (7 bit w/ reserved) or ~1000 (10 bit) devices can be on the bus. Each needs a unique (often hardwired) ID. Chips often have extra pins you ground to set the unique ID to 1-or-more values, but it means you still have a limit of 2-8 instances of the same device on a bus.
  • Data rate is either 100 kHz, or 400 kHz. Later specs allow 1 MHz, 3.4 MHz and 5 MHz, but we don’t get to use those.
  • SCL and SDA have pull-up resistors, connected to the Master’s power. I.e. the default state is High.
  • Slaves ground the data line, to make the low signals. To go high, you leave it open.

SPI (4-Wire)

For SD Cards, Flash Memory (W25Q80BV), 10bit ADC (MCP3008), …

  • ???

Notes: Benchmarking VPS Bandwidth

Tuesday, June 21st, 2016

Just a quick set of benchmarks, seeing how fast my servers are at downloading and uploading. These aren’t the be-all/end-all of benchmarks. They’re just a rough look at what the performance of a machine is.

The following test is used.

Linode, New Jersey: $10 VPS server, 1 core, 2 GB RAM

I’m pretty happy with these results. This machine has the fastest SSD I’ve tested, and provide a good benchmark for expected performance.

Scaleway, Paris: €3 dedicated server, 4 core ARM CPU, 2 GB RAM

One of the most interesting features of Scaleway is that you can get ARM powered servers. This is their €3 ARMv7 powered server with 4 cores and 2 GB of RAM. They don’t perform as well as Intel servers (about half the SSD performance), but they still do a really impressive job. I’m really excited about the future of this stuff.

Scaleway, Paris: €3 VPS server, 2 core (Atom Xeon), 2 GB of RAM

Their lowest end x86_64 powered server. At this price point you can’t use add-on storage, but the performance is really decent, especially given the price.

Due to its low cost, and decent performance and disk space (50 GB), I moved Delorian to one of these.

Scaleway, Paris: €24 dedicated server, 8 core (Atom Xeon), 32 GB of RAM, addon 250 GB SSD

The legacy Ludum Dare server. Given the price (a mere €24), and it being a fully dedicated server, I’m incredibly impressed by the performance. I really wish Scaleway had a domestic datacenter. I’m loving everything they’re doing.

Notes: Big Binary MySQL/MariaDB Logs

Tuesday, May 17th, 2016

MySQL/MariaDB has several log files.

Since moving Ludum Dare to a new server, I ran in to an issue where I was running out of hard drive space. Some details:

  • Ubuntu 14.04
  • MariaDB 10.1
  • WordPress, plus some custom stuff
  • 50 GB of SSD space (main partition)
  • 250 GB of additional SSD space (alt partition)

The database itself is on the alt partition, but I kept running out of main partition space.

Most Google searches for my problem talk of the regular log files eating space, but my problem was specifically the binary logs. The binary logs are used by the MySQL/MariaDB family of DB engines as both a log of actions, and for synchronized replication.

I discovered the hard drive full problem by running:

I also learned that on some Linuxes, when you run out of hard drive space, it may remap /tmp/ to RAM, but not very much RAM, so some temp files may fail to create because there isn’t enough space to store them. I had to free up some hard drive space and actually reboot to make it stop doing that. This is an automatic behaviour, so it’s simpler just to reboot to make in unmap the new /tmp/ partition.

The binary logs on Ubuntu are stored here:

And are given names like “mariadb-bin.002412“. You can find this mentioned in the my.cnf file as the “log_bin” basename.

Binary logs are actually automatically purged, at least in the default Ubuntu install of MariaDB. But the purge time is set to 10 days. With Ludum Dare, we so aggressively did things, that we found 10 days to be too much, and would run out of space.

I’ve since change “expire_log_days” to 3, as it was roughly every 4 days I had to clear the logs, so the website would return.

My temporary fix would invole going to the /var/log/mysql folder and deleting a bunch of files (because the mysql client can’t delete files if there is no hard drive space).

And to make sure it was internalized correctly, I would connect to the DB via the mysql client and run a:

Which should be self explanatory.