Tag Archives: serial

RS232 Shifter Board

As part of my project to make an Arduino based watchdog for my home server, I went and picked up a proper soldering iron today and assembled the RS232 Shifter Circuit I had purchased from Sparkfun/Mindkits.

I ended up getting a Goot soldering iron – it wasn’t too cheap, but the reviews I was reading online suggested it was the next best thing to a proper soldering station and a quality Japanese tool. It’s also 46W, so much better for the lead-free solder I’m using, compared to the crappy 15W DSE brand generic iron I was using previously.

Tool of the gods.

It made a massive difference to the soldering efforts, the lead-free solder melted without issue and flowed smoothly – plus the fine point conical tip made getting the solder into key areas a lot easier.

The tips are changeable and I’ve been advised by an electronics fixing friend to get a set of tip types, as certain ones suit different tasks better than others.

Whilst the new soldering iron is a huge improvement, my soldering skill is still a bit poor, I had a few text-book joins where the solder flowed perfectly and bonded with a smooth shiny surface, but a lot of my joins tend to be slightly one sided, where the solder hasn’t flowed right around the components lead and PCB hole which makes then a bit weak.

I’m also tending to leave too much solder on the component lead, which leaves larger joins than really needed, so need to work on how much solder I apply.

Parents, avert your children’s eyes from this soldering monstrosity!

On the flip side, the top looks great ;-)

After constructing the circuit, I gave it a test by connecting the TX and RX of the shifter circuit to the TX and RX on the Arduino, which basically uses the Arduino as an UART to RS232(over USB) adapter.

Then I connected the new DB9 port to my laptop and typed messages into the Arduino serial monitor, to have them passed through my new circuit and into my laptop’s DB9 port.

Amazingly, things worked first time and I’m able to successfully receive data via the shifter board – in my quick test TX from the shifter board wasn’t working, but it may have been a serial speed/config issue that I just need to tweak in the OS, rather than the board itself.

Arduino IDE to Minicom via an Arduino, my new shifter circuit and my laptop’s USB to RS232 adapter.

The next step is connecting this shifter circuit to the digital I/O ports on the Arduino and using the software serial library to add a second serial port to the device. I can then do the same to the HTC Magic serial break out and I’ll basically have an Arduno with 3 serial ports in total –  the onboard UART, the DB9 PC via shifter and the HTC magic.

Once that’s done, it’s just a case of writing the software needed to turn the collection of hacks into a hardware watchdog and serial remote access system. :-)

And once that’s all working, I’ll build a final solution using one of the Arduino prototyping shields from Freetronics, which will include all the shifter circuitry onboard and just provide a 2×5 IEC pin header to plug a ribbon cable directly into the server’s motherboard serial port header.

Android via serial to Arduino

Whilst I’ve been pretty busy lately, I recently made another order from Mindkits and got to work with testing some of my ideas for my Arduino-based remote management solution for my home server.

There’s 4 major parts to this solution

  1. Connectivity to the computer’s serial port (a motherboard 10-pin header) and being able to communicate with the serial port using the Arduino.
  2. An Arduino controlled switch to turn the computer motherboard’s reset pins on and off.
  3. Connection into one of my old HTC Magic Android cellphones.
  4. Connection of 1-wire temperature sensors in key parts of the server’s case.

I’m using a stock standard Arduino Uno/Eleven for this project, for two main reasons:

  1. The HTC Magic phone is quite an old model of Android phones, effectively it’s the second generation after the original G1 and was the first officially available Android phone in New Zealand. Whilst I have loaded the last stable version of Cynogenmod released for it onto the phone, it’s only Android 2.2 and doesn’t feature the Android USB Accessory API support, so there was no point getting something like the USBDroid model.
  2. Rather than paying extra for ethernet connectivity, I’m planning to write an Android application that runs on the phone in the background that provides all the logic behind the remote management program for the server and connectivity via Wifi, 3G and SMS – I figure that the Android platform is better places for the management program anyway with a more sophisticated software

I purchased some protoshields for the Arduino, so my plan is to develop all my circuit logic as an addon shield so it will be possible to stack other shields on in future if I want to add some new applications/functionality to the system.

I’m new to the electronics, the Arduino coding AND the Android development requirements, so it’s an awesome learning curve project for me to start getting my head around all these technologies. :-)

The easiest bit to solve is the control of the computer’s reset header – I need this in order to be able to reboot a crashed system, something that has happened a couple of times due to flaky hardware.

To control the reset, I can use a simple transistor switched circuit, there’s a few resources around for novices to follow, I found this one useful. The only concerns I have is that I need to research and find out what the voltage on the reset headers is – I’m assuming 5V, but it could be anything from 3V to 12V….

Tested the switch by using the Arduino to turn on the LED using a transistor.

The connectivity to the server seems pretty straightforwards – I’ll be using an RS232 shifter circuit (like this one) to connect the PC serial port to the Arduino, although I might end up re-implementing that circuit directly on the protoshield and using a 10-pin IEC connector to plug directly into the motherboard’s serial header

The phone will be connected using the debug serial port in the HTC Magic – it seems a number of the earlier HTC models can provide serial over some of the extra pins in the ExtUSB plug they use.

I’m not totally sure how I’ll be connecting both serial ports just yet – the Ardunio has one hardware UART onboard on pins 0 and 1, but I’m not sure if I can use those without losing the ability to manage the Arduino via it’s USB port – ideally I want the capability to still update the Arduino from the server it’s connected to.

It is possible to connect additional serial ports using software and there’s even a handy library for it, so I have that option for one or both ports. I’ll just have to code my software to be aware that the connection might be lossy or imperfect and to be patient and retry stuff.

I purchased an (expensive!) breakout board for the ExtUSB port which will make the soldering a *bit* easier, but considering the size of it, it still won’t be any walk in the park…

From uber-tiny to just plain tiny :-/

Fortunately since I’m using Cynogenmod, all the OS-side software is sorted and the kernel built with the correct parameters to enable the serial port functionality, providing me with a /dev/ttyMSM2 character device out-of-the-box.

Because I wanted to give it a go and see how the phone ran, I used some header pins to connect to the breakout board as they fit in the holes snugly – there must be some better tools available for connecting to PCBs and device legs without soldering for testing purposes, so I’ll need to do some more research for future.

World’s dodgiest serial connection – also GND and TX pins connected only, it sends 2.8V into the Arduino which is OK, but I need to do a step down circuit before I can transmit from 5V back into the phone.

Hacky hacks

VNCd into the phone and sending messages over the serial line, which is connected to pin 1 (TX) on the Arduino, so the messages appear in the serial monitor

Based on these results it’s looking good – at least I’ve validated my understand of what is possible, so the next step is to turn some of this into a proper circuit.

My current plan is to do a short wire run from the ExtUSB connector breakout board into a small PCB which will split the output into the 3 wires for serial (RX, TX, Ground) and also take the 4 wires for USB and connect them to a USB port, so that I can plugin a USB cable to charge and manage the phone. From there, I can run the 3 serial wires to a header on the protoshield I’m building to connect into the Arduino.

I’ll have to work out how the Android phone and the Arduino will communicate for the management functionality, at this stage I’m planning to have an app that would send specific commands to the Arduino via serial and maybe the ability to get the output from the server’s serial port via the serial link to the Android phone by encapsulating the data or some other behavior.

Next steps is to get a better soldering iron so hopefully will be able to do the initial soldering I need for the HTC magic serial connection next weekend. :-)