Category Archives: Site

Working with the LinkIt Smart 7688

As an embedded systems engineer I am always interested in new systems. I’ve worked with the NixCore X1 boards and got pretty deep in to the OpenWRT/LEDE environment. For those that don’t know, OpenWRT is a Linux system designed for deeply embedded systems with pretty limited resources. It was designed to be run on routers like the Linksys WRT54G series but it is much more than that. I’ve been keeping my eye on dev boards and SOMs that support OpenWRT and I came across the LinkIt series of boards from Seeed Studios and Mediatek, specifically the LinkIt Smart 7688. These are fully supported by OpenWRT, are FCC certified and available for only $15 each! I purchased one of the LinkIt Smart 7688 boards a while back and haven’t really messed with it too much. Since Protologcal was due for a new post I thought I would share my experience working with the LinkIt, booting it up for the first time, poking around the insides, and then upgrading the firmware.


  • MT7688AN Mediatek SOC
  • 580MHz
  • 128MB RAM
  • 22 GPIO
  • 3x UART
  • SPI
  • I2C
  • USB Host
  • Ethernet connections (100 base)
  • 802.11bg/g/n 2.4GHz

First boot:

With OpenWRT embedded systems like the LinkIt, there is almost always a serial port console allowing access to the bootloader and the root system. This allows developers to upgrade the firmware from a physical connection with the least amount of software. This is the starting point for all of my embedded system hacking, get the console and see what the system does.

I added the LinkIt to a breadboard, found the pinout diagram, connected up my FTDI232R-3v3 cable to UART2 as per this info, 57600 baud 8-N-1. Powering up the board through the micro-USB and you get the very familiar Ralink uBoot menu (Ralink is the original SOC+WiFi manufacturer purchased by Mediatek). uBoot is a bare-metal bootloader application that allows you to update the firmware on the device before the ‘true’ system boots. We will dive more in to that later. By default uBoot times out after a few seconds and hands control off to the Linux system partition which boots the kernel and enables the system. After a ton of messages we can hit enter and are dropped in to the standard OpenWRT console.

I was really impressed to see the standard OpenWRT 15.01 Chaos Calmer banner on the console, this to me means that Seeed or Mediatek didn’t do a lot of messing around with the stock system. For those who have worked with OpenWRT the system was pretty vanilla, the WiFi config uses the standard /etc/config/wireless, the init system appears to be unmodified, opkg reported all the packages (stock package list here), dropbear ssh server, etc. This is really really good to see, nothing crazy was running and taking up 100% CPU, so we have a pretty darn open development platform right out of the box, nicely done Mediatek!

Firmware upgrades:

I like to roll my own OpenWRT firmware, that way I have full control and I know what is installed in the system (no NSA or botnet backdoors!). Before getting in to building a custom OpenWRT image I like know that I can go back to the stock image if I really mess something up. Mediatek has a lot of information on how to upgrade the firmware on their Mediatek Labs website, so after some reading here is how you can flash a new image:

  • From stock firmware there is a web based flashing utility that uploads an image file and uses OpenWRT’s sysupgrade utility
  • You can also copy the firmware image to a USB drive and use uBoot to flash the image
  • uBoot has menu options for downloading via Serial and TFTP

The web upgrade UI is from the device, so you need to connect a computer to the open WiFi access point “Linkit_XXXXX” and go to from a browser. Using the web based upgrade path I was able to upgrade my LinkIt to the latest 0.9.4 firmware just as a test. This upgrade took a few minutes and there was no real indication on what was going on, other than the blinking orange LED. The serial console didn’t show anything during the sysupgrade, so you just have to upload and hope for the best.

The uBoot USB based upgrade path is a little better. First you copy your image file to a FAT formatted USB drive and name it lks7688.img. Then you plug the drive in to an USB OTG cable connected to the USB data port. Hold the wifi button on the LinkIt and reset the device with the reset button. With the serial console connected you can see that uBoot detects the wifi button held down, and after 5 seconds it starts searching for a USB drive. What is interesting is that the console outputs:

“5: System Load Linux then write to Flash via USB Storage.”

If you look at the boot menu there is no option for 5, it jumps from 4 to 7. Rebooting without the wifi button pressed, and entering 5 into the uboot menu and the system drops in to the same USB update routine, so there are a few ways to start this upgrade.

When uBoot finds the drive it will automatically burn the lks7688.img system image file to the correct location in the SPI flash. The system reboots and you have a new firmware image. The USB update still takes about 2 minutes, but that’s better than the 3+ minutes for the web update method. I did not try the serial or TFTP upgrade methods, that is going to take some digging in to the SPI flash partitioning done by Mediatek, but I’m sure it is possible. Again, I was really happy to see there is a commonly accepted bootloader method to upgrade firmware, not some janky software solution!

Overall, I am quite impressed with the LinkIt Smart 7688, it is powerful, open, well documented, and cheap embedded system. The next steps are to create a footprint in Eagle PCB, make a few adapter boards for some hardware I have here, and then build a custom OpenWRT image. In a later post I will go over how to build and download OpenWRT, with support for the WiFi hardware on the LinkIt, to make a truly custom embedded Linux platform!

NixCore X1 with RGB LED Strip

My friends here in Colorado started a new company called NixCore, a Linux enabled processor board that takes 1 Watt of power. They asked me to take their new NixCore X1 product for a spin and see what I could make with it. I looked around the lab/office and came upon my RGB LED strip from China. Since this RGB strip uses a variant of SPI I thought it would be a good test for the little NixCore X1 board.

The NixCore X1 is an Ralink RT5350 SoC (System on Chip) processor running at 360MHz, with 8MB of flash, and 32MB of RAM. The board takes only 1 watt of power (less than 200mA at 5V) and has all the outputs you would expect from a microcontroller, I2C, GPIO, PWM. It also has software based SPI (Since the SPI port is used by the flash) which is still pretty fast. I’ve worked with embedded Linux systems and know how much of a pain it is to get a driver running, so having a Linux install with an SPI driver exposed to userspace was a godsent. With some commands, a simple C file, and a Buildroot compiler I was able to port my Mbed code to the NixCore X1 pretty easily. All I had to do is make a new SPI device on some GPIO pins, open the “/dev/spidev1.0” device and start writing data to it, the driver takes care of all the hard stuff. Using C you can fopen(“/dev/spidev1.0″,”w”) and then write as any other file. Here are the steps:

Build the compiler:
NixCore helped me out with that, but just select mips32r2, Little Endian and uClib on Buildroot and you should be good.

Compile the code:
Given the code, you can control the strip via the command line
(Make sure you add -I and -L entries to the buildroot install)

Install the spi-gpio-custom-driver on the running X1:
insmod spi-gpio-custom bus0=1,22,23,24,0,50000

Run the code:

This driver is software based and (from my tests) runs up to 400KHz. It uses GPIOs 22 as CLK,23 as MOSI and 24 MOSI (Even though there is no input data) on the NixCore X1. This translates to pins 27,30 and 22 on the header. I hooked up the RGB strip directly to the 3.3V CLK and MOSI and wrote a simple C file based on my Mbed code.

Honestly, to my surprise I was able to control a single pixel of the strip right off the bat, I expected the driver functioned but I was still a little skeptical. It didn’t take long to address the entire strip. At a comm rate of 50KHz this updates the strip at about 40ms or 25 HZ. As I mentioned the rate could be updated to about 400KHz which would be about 200Hz for a 5M strip, more than enough to beat the human eye.

After I made the C application to set the color I took it a step further and added a web page and CGI script to change the color of the strip based on a web page.

Here are some videos of the strip in action:

And, of course, the code and webpage for the processing: Code1, Code2, Makefile, Webpage files.
Goto http://[IP_ADDRESS]/color.html

Overall I really like the NixCore X1 (I am biased since they are my buddies) but you might want to check them out at

CNC board and USB microscope

While in China I picked up a USB microscope for $25 USD. It’s an “2MP HD microscope with 600x magnification” according to the box and has 6 LEDs around the camera. I plugged it in and it was found right away by Linux as a video4linux device and works with VLC and Cheese. It’s been sitting next to my computer for about 2 weeks since I got back from China and I’ve been itching for some reason to use it. Tonight I made a small board on my CNC to test some new footprints and I thought it would be the perfect time to use the microscope to check out the cuts made by the bit. Using Cheese I was able to get some good shots of the PCB traces. The pictures are only 640×480, so I’m not too sure where the 2MP claim comes from.

I used my gcode_03 ULP script for Eagle (from my older site) to export the PCB to G-code. When I started working with the CNC for PCB routing I was using a 0.8mm end mill carbide bit, however I’ve noticed I get pretty clean cuts with a 30 degree “V” etching bit run at the max speed of my manually controlled spindle (Yes I know I need to find out the RPMs of that thing). The cuts made by the CNC are impressively clean and without burs. Each cut goes down 0.16 inches and the feed rate is 300mm/minute. The footprint is SOIC-8, the pads are 1.27mm x 0.635mm and the traces are 20mil. The cut is close to 0.5mm. The microscope did show what looks like copper particles in the track which was interesting to see. I’ve made a bunch of breakout boards and switch boards without shorting issues so I don’t know if these particles are big enough to cause a problem. Here are some pictures of the board using the microscope.

microscope image of board compared to a dime microscope image of the board microscope image zoomed in on traces

microscope image of cnc cut - two traces microscope image of cnc corner cut microscope image of cnc particles microscope view of SOIC-8 chip on pad

Reference PCB Business Card on a CNC

I’ve found myself in the situation a few times where I was trying to explain that PCBs can be routed using a low cost CNC, like the 3040 CNC I purchased on Ebay a while back.  Since I have routed dozens of PCBs this sounds obvious to me, however it is not very obvious to some of the engineers I have explained it to, it seems as if they can’t visualize what can be accomplished.  In those moments I wish I had an example PCB to show them.  Not to mention  a few times I was stuck without a quick way to measure small lengths, or I wanted to know the SMD footprint used for a resistor to see if I had one, or when I needed to compare the pin spacing of a cable to see if it is 0.1″.  A few days ago I found a post about TinkerRule, a reference PCB that could be used to solve pretty much all the engineering scenarios I just mentioned. I really liked what they did and it inspired me to see if I could make a reference PCB on my CNC in the form factor of a business card to fit in a wallet, that way not only would I have a useful tool, but I would have a demo of the capabilities of my CNC PCB router too!

It turns out that my small 3040 CNC is quite capable of making a 2.125 x 3.25″ PCB business card with a number of useful features, including an inch ruler, centimeter ruler, some reference traces, reference vias, reference holes, and  0.1″ grid.  The board also has 150 mil letters so it is easy to read.  Plus, since the single sided copper board I used is only about 50 mils thick, it’s only 50% thicker than a credit card, so it isn’t a noticeable addition to my wallet. This was the first pass and there are 2 missed sections, this was due to my setting of the router bit a little too shallow…things to fix on Rev 2.

20150103_153638 20150103_153645 20150103_223014

I have uploaded the Eagle PCB and GCode so anyone can download it and try and make their own: biz_pcb.brd & biz_pcb.ngc

I already have identified some things I want to change on Rev 2, any ideas or suggestions?

Debounce Calculator Online App

I finally got tired of punching numbers into my calculator for debounce circuits so I came up with a small javscript app to determine capacitance, resistance or time for a simple RC circuit. The script is already setup with values for input to a schmitt trigger inverter. This application is based on a single capacitor and resistor circuit as per this image.

Welcome to Protological

Protological is a site about electronics, DIY and software.  Our goal is to educate and share our experiences and projects with the world.  We will showcase projects from across the internet as well as posting information, schematics, code and documentation on our own development.  We also design electronics and we will offer our products via our online shop for purchase.

The major topics on Protological include:

  • PCB design
  • Microcontroller code
  • Prototyping
  • Electronic product development

Our goal is to have multiple posts per week in each of the major topics on the site as well as downloadable code and project files.  We will be documenting our progress at getting these posts out and pitfalls along the way.  As we get this site off the ground we would love support from the community, share your projects, hacks, mods and prototypes with us at and we will get them up on the site.

Happy building