How to update codes and libraries for arduino 1.0

The arduino 1.0 IDE (integrated development environment), or the arduino software 1.0 has been released for a while now. Some of us are moving slowly to adopt it since all codes and contributed libraries (yeah that includes all my open-source libraries, darn) will have to be modified to run on the new environment. Here is a great article on how to make the change:

http://blog.makezine.com/archive/2011/12/arduino-1-0-is-out-heres-what-you-need-to-know.html

Besides the above article, here are some more subtle changes you have to make in order to get on board with the new IDE:

  1. Any time you have a hardware serial write command with zero as argument such as Serial.write(0) or Serial.write(‘\ 0’), you will have to replace them with the following: Serial.write((uint8_t)0). The reason behind this is that in the new Print class, which Serial class inherits from, the write(char*) method is no longer virtual but actually defined. This write(char*) method and the write(uint8_t) method are both non-virtual and become ambiguous when the argument is zero. The zero could mean zero BYTE value or zero pointer to char array, which is allowed (no other constant values are allowed as pointer). To clear it up, you force the zero into BYTE, or the unsigned 8-bit integer type: uint8_t
  2. Any other libraries that derive from the Print class will have the same issues. You have to do the above regarding to write(0).
  3. I’ll add more when I find more updates.

If you are using the New Soft Serial, then I recommend the following change: don’t make any changes and stay with arduino 0022. I have been unable to access the website that hosts the New Soft Serial library and I don’t think the library has been modified for arduino 1.0 yet. I’ll have to wait and see if anything further happens to this library, which I really like.

The NewSoftSerial is actually turned into the official SoftSerial, released with arduino 1.0 so all you have to do is to include the SoftSerial library.

Tube accident?!

A few days ago I ordered a bunch of IC’s (ATMEGA328P-PU, Yes!) from mouser.com, a rather large distributor, for the first time since I order from digikey often and they are close by. A small accident happened between perfect IC land and my home: one of the tubes was not sealed well. They cut the tube too short to hold 11 chips and a hole was punched on the end that ripped open on top and bottom because it was punched too close to the cut-off end. One chip is hanging half outside that open end since the rip narrowed the end to hold the chip there. There is no plastic pin to be found in the sealed antistatic bag indicating the plastic pin was gone before the bag was sealed, how unprofessional?! Saved $6 for 25 chips, compared with digikey, which always packs well. So I emailed them about this. In less than an hour, they corrected the issue by sending a replacement IC since the one hanging half outside can’t be trusted with anything serious anymore. Good work mouser! I’ll order more from them from now on!

The end of the tube with ripped open holes. Apparently someone needs a pair of new glasses after the holidays.

 

Oh, about tubes, I should probably write more about them, I mean, vacuum tubes, those that mostly emit electrons. They were the technology of the past century. Amazing stuff.

Which serial LCD to buy?

Every once in a while on the arduino forum, people ask about which serial LCD to buy so today I saw such a post again and wrote this reply. I am certainly biased towards this serial LCD issue as I make and sell the phi-panel family of serial LCDs and keypad panels myself but take whatever you consider as fair argument:

3 vs. 4 wires:
Some serial LCD comes with 3 wires, 5V, GND, and RX. Some comes with 4 wires, 5V, GND, RX, and TX. Some serial LCDs are just LCDs, i.e. an output device. So you don’t need to read back from it. This saves one line, the RX on your arduino. Some have both RX and TX for possibly these reasons:

  • Update firmware could require two-way communication for verifying the firmware at upload.
  • Read back from the LCD to see what’s on the display, don’t know why that’s important. Or read back type of serial LCD ie. serial number or model number so arduino knows there is a serial LCD connected.
  • The serial LCD can connect to other things. Again, this is a link to my product: this phi-panel has either integrated or optional 16-key keypad. The user input on the keypad is processed then transmitted TO arduino RX while commands to control the LCD or keypad (say enable/disable multi-tap) or messages to display on the LCD are transmitted FROM the arduino to the LCD panel. This requires two-way communications.

Cost:
Some serial LCDs are cheap because they don’t have a processor on board. They are the I2C serial interface, which arduino can connect to. These are simply I/O expanders that give you 8 additional I/O ports, enough to run the LCD. The backpack has no intelligence. The arduino spends all the resources and does all the work and needs to drive the display with special libraries provided by the makers. I know of two sources besides ebay, adafruit, and our forum member fm. Since there is no processor on the LCD backpack, the solution is cheap.

The more costly serial LCDs have on-board processors that controls the display and in the case of my LCD backpack, also possibly senses other inputs, process them, or even run multi-tap input or other fancy stuff on the on-board processor so your main arduino doesn’t need to worry about those. Those are more expensive and frees up resources on arduino and are more or less swappable with other serial LCDs with on-board processors without ever needing special libraries. Among a few of the sellers, sparkfun, moderndevice, some ebay sellers, mine, etc. All have the same level of intelligence except for mine, which is also the lowest cost with most functions. That might explain why both sparkfun and moderndevice are not interested in carrying my serial LCD. smiley-wink

So my logical conclusion is to buy the phi-panel family of serial LCD for the lowest price (except for fm’s I2C backpack) and best functionality. The rest of them in terms of functionality are about 5,000 lines of firmware code behind.

Enclosing your project, the pursuit continues

In a previous post, I discussed my journey to enclose my projects. I have been thinking about this question for a while. Recently I developed my serial LCD keypad backpack, specifically to make the difficulty of creating a user interface goes away. Now it needs to be mounted. So I devised a plan to create a physical user interface with appropriate project box for LCD projects. Here is a finished picture, not too bad, right?

Here is a list of materials needed:

Here is a list of tools needed:

  • Dremel handheld rotary tool (includes a small cutter and a few abrasive disks)
  • A couple of drills (1/16 and 1/4 inches or 1mm and 3.5mm)
  • Utility knife or just a cutter
  • LCD printout
  • Screw driver

My choice of enclosure has an advantage:the enclosure has a 9V battery compartment :). If you decide to not buy my serial LCD keypad backpack, then there will be 20 wires between the front panel and inside the box, 8 for the keypad, and 12 for the display. You may want to use a ribbon cable or jumper wires. If you do get the backpack, you only need 4 wires instead of 20 plus the programming is much easier with the backpack. So your choice.

Cutting and drilling:

First, get a precise layout of your display including the PCB boarder, screw hole and size, and display area. I suggest you print it out on paper or draw it on paper. Make sure you check the actual display instead of solely relying on the spec sheet, which could be different from your display.

If you got the serial LCD backpack, you can download this file and print it out. Cut out one display diagram. Read this spec sheet, maybe it’s the same as yours so you can also use this file. Whatever way you get the layout, use double sticky tape and secure it symmetrically on the front of the enclosure, leaving some space above it, maybe 1/4 inch or 6mm.

Now use the dremel abrasive disk and carefully cut along the inner rectangle, or the dimension of your display’s viewable area, not the entire black frame. You want to be careful not to over cut. You can try to cut from the under side to help you remove the window. Once you’re done cutting, use a knife to free the four corners.

I messed up the top edge of the box a bit by getting the spinning chuck too close to the edge. No big deal. Now you can use the dremal cutting tool to cut the four corners. Here is the under side.

Now use the smaller drill bit to drill guidance holes at the screw holes. Then use the proper drill bit to open the hole up for your screws.

Now remove the printout and excess material. Mount the LCD to see how it looks like.

Here is the back side:

See the standoff on the enclosure? That is why you don’t want to cut the window too high.

A closeup on how I mounted the display:

Basically from top to bottom: nut, display PCB, standoff, then screw on the other side.

Now cut a slot at the bottom of the box top to allow the membrane keypad connection to pass inside the box:

Just don’t cut too low. Leave about 0.5 inch or 12 mm.

Then carefully remove the backing of the membrane keypad. Pass the connector through the slot and stick the keypad on to the box:

Tada! A good-looking box that you can use for anything! I am planning to add a GPS module inside of it and run a GPS logger with it. Please see the phi-2 shield page for the GPS project code.

Now the under side:

As you can see, the connector comes back up to about the bottom of the LCD. This way you can connect the LCD serial back pack easily without stretching the cable.

Later I will add an LCD backpack to the box. The box has enough space to hold a full-size Arduino UNO and some other stuff, plus a 9V battery compartment so you are all set for an exciting project.

Connecting:

If you don’t have an LCD backpack, I suggest you solder a female header on the back side of the LCD so you can run simple jumper wires between the LCD and arduino. For the potentiometer and LCD resistors, solder them inline. Also use jumper wires to connect the keypad to arduino. You will only have 4 free arduino pins left. Total of 20 arduino pins – 2 serial programming pins – 6 LCD pins – 8 keypad pins = 4 pins left.

Otherwise, use the LCD backpack and the 4 included jumper wires. The backpack only uses 2 arduino pins.You will have 16 free pins on your arduino.

Phi-panel face plates

Face plates are coming out! These are white 3mm acrylic face plates made from laser cutting. I didn’t choose color since I thought I could just paint the white to any color I wanted. Well, I don’t really have a spray painting can :((

If you want to make them, just leave a message here. I’ll be posting the design file in a while.

This is the design file in Corel Draw 11 (super old version). It should export into the .svg file for laser cutting at ponoko.com with the 180mm*180mm service (cheapest) if you also have Corel Draw. Otherwise, download the .svg file. I am not sure what software to use to modify .svg if you want some changes though.

To make it, set up an account at ponoko.com and choose acrylic (3mm thickness suggested).

Contains 2 16×2 face plate, 1 20×4 face plate, and one arduino uno support.

Corel Draw file:

http://code.google.com/p/phi-panel/downloads/detail?name=phi-panel_faceplate_v3.cdr&can=2&q=

Exported .svg file:

http://code.google.com/p/phi-panel/downloads/detail?name=phi-panel_faceplate_v3.svg&can=2&q=

Suggested push buttons: EG1861-ND, caps: EG1882-ND, EG1881-ND, EG1880-ND. All these are digikey.com part numbers. These are the cheapest ones I could find.
Suggested spacers: M3 thread 8mm spacing and M3 screw: 25509K-ND, H742-ND.