Feed on
Posts
Comments

We are getting ready to release the next minor revision of OpenSprinkler DIY kit, numbered 2.2u. This revision is largely the same with the current 2.1u, with three main differences:

  1. MCU clock speed is increased to 16MHz (from 12MHz previous), by using a 16MHz crystal.
  2. Built-in USB-Serial chip is added, by using CH340G, which is a common chip in low-cost USB-serial converters.
  3. With the hardware serial chip, the bootloader is also changed to use Arduino Optiboot, at 115200 bps baud rate and a bootloader size of only 512 bytes.

IMG_0249IMG_0248

The first change above is to increase the processing speed and hopefully make the controller faster at handling complex algorithms and transferring data with the Ethernet controller. The second change above is mainly to solve the issue that it has been increasingly painful to install USBasp driver on Windows 8+. To understand the background, all of these have to do with firmware upgrade — how to reflash the microcontroller with new firmwares. Back in OpenSprinkler 2.0, I used to have a separate ATtiny45 chip on board to function as a USBtinyISP programmer, which can reflash the main MCU (ATmega644). This is not an ideal design because it involves an extra chip that we have to program; also USBtinyISP is not particularly fast. So when I designed OpenSprinkler 2.1, I made the conscious decision to get rid of ATtiny45. Instead, I decided to implement a USBasp bootloader for ATmega644, which can present the MCU itself as a USBasp programmer when a button is pressed on start-up. This is quite appealing because no extra chip is required, and the programming speed is considerably faster. The only caveat is that to use USBasp in Windows, you need to install the open-source USBasp driver. This was not the most pleasant thing to do, but wasn’t a big deal as the driver was fairly easy to install.

That is until when Windows 8 came out, with this feature called driver signature enforcement. It basically means the driver needs to be digitally signed with Microsoft, otherwise it won’t allow you to install the driver. Let’s be honest, for open-source developers, who wants to pay the big bucks to get the driver signed? So suddenly this has created an even bigger barrier for average users. The only way around the issue is to boot Windows 8 into a mode that disables driver signature enforcement. This step turns out to be unnecessarily complicated. I’ve often received comments about how it’s painful to install USBasp driver for Windows 8. I recently made a video to demonstrate how to update OpenSprinkler firmware — in this 11-minute video, 6 minutes were spent purely on explaining how to install USBasp driver for Windows 8. That’s an evidence of how unnecessarily complicated it is!

Anyways, I set out to find a better solution, and was glad that I discovered the CH340 chip. It’s basically a USB-serial chip that is often found in low-cost USB-serial cables / converters. It’s really inexpensive (less than 30 cents) and requires very few peripheral elements (just a crystal and filter caps). With this chip, you can now use the standard serial monitor to debug your program, and the bootloader can also now use the standard Arduino bootloader.

ch340g_closeup

What I like the most about this chip though, is that it does not require driver for Windows 7, 8 and above. What? Is that even possible? Yup, I’ve verified it — Windows 7, 8 and 8.1 all recognized it right away. The fact that it doesn’t require driver just makes it a whole lot easier to upgrade firmware. Windows XP and Mac OS still require driver for it, though, but that’s light years better than installing driver for Windows 8.

You may be wondering: wait a minute, what about the FT232 chip, which has been available on the standard Arduino since the beginning? Isn’t what I am trying to do here already done? Sure, CH340 is basically a replacement for FT232 — both are USB-serial converters. But there is an economic reason to go for it: even at volume quantity like 1000, FT232 costs about $3 to $4 per chip. That compared to 30 cents for CH340? You tell me. Another nice thing about CH340 is that it comes with SOIC-16 packaging, which is very easy to solder even by hand. This makes it more appealing than other low-cost alternatives like PL2303 and CP2102.

OK, I’ve done enough advertisement. I am not in any ways associated with the company that makes this chip, I am just excited, and regret that I didn’t know about it earlier 🙂

4 Responses to “Sneakpeak Preview of OpenSprinkler DIY kit v2.2u”

  1. Stephen says:

    Hi Ray,
    I am not able to locate the CH340G though Amazon or Mouser. Where are you getting these chips?
    Stephen

  2. james says:

    Cant find any DIY kit now. 2.1 discontinued and 2.2 not released?

    Please help.

    James

Leave a Reply