Thursday, 19 February 2015

Creating Instruments

Fun and learning has brought me to my next progression of sailing, mainly building my own flavor of digital instruments. Over the last few years I found that the instrumentation on Santeria had poor visibility at night (green back light), not plainly visible to the driver in daylight, along with other pains along the way (not working in heavy sea state)!

On a poor mans mentality, I set out to conquer the display of the 3 most important pieces of sailing data onboard Santeria, mainly:
  • Apparent wind speed
  • Apparent wind angle
  • GPS speed

Here is what I was looking for:
  1. Instrumentation must be below deck. Water resistant, but not waterproof.
  2. Must be red letters with black background
  3. Must be visible from a standing or seated position in the cockpit by leaning midship and peering through the companionway with the bottom companionway board in place
  4. Must be plainly readable from 14 ft
  5. Use common circuit components available though local or online electronic stores
An above deck B&G mast display on the VOR65 Alvimedica, and not what I was setting out to achieve! These are excellent
displays if you have the budget

I was hoping that this exercise wouldn't be too tall an order and that this would be a continuation from my previous electronics learning from years past. Here is how it went:

Googling "digital display" brought up several different display options. LCD displays were "a dime a dozen" and were generally very inexpensive but I couldn't seem to find one that had large visible digits. Reading the electronic datasheet and schematic of these displays quickly showed that there was significant wiring and development necessary just to display information.

I found some online stores (Adafruit and Sparkfun) that sell LCD displays for Arduino and Raspberry Pi and incorporated a serial backpack. This backpack uses common serial communication protocols to easily communicate with the display from these micro computing platforms. The backpack simplifies the integration of these display into common electronic project use SPI and I2C serial communication. In the end the text size would be too small to be clearly readable from 14 ft. I dropped the idea of affordable LCD displays ad this little guy was approximately 24$ US. The price was good, but scaling up to large readable LCD digits was too expensive for my budget. This was a 16 character X 2 lines. To display wind speed, wind angle and gps speed I only need 4 X 1.

LCD Negative Red display - This model allow the developer to change the text color with a static black background.

Googling "4 X 1 display" brought up a new type of digital display, the 7 Segment Display. 7 segment displays decimal characters using a 7 segment approach. These displays are commonly found it digital clocks, calculators and digital meters.

Each of the 7 segments are used to display decimal characters
and some alphabet characters

Going back to the online stores (Adafruit and Sparkfun) I also found that they sell these displays and are very inexpensive by themselves. Reading the datasheet and schematic of these displays also showed that there was significant wiring and development necessary just to display information.

Both adafruit and sparkfun have incorporated a serial backpack with these devices, but only Sparkfun sell a large 20mm digit with a serial backpack. Like the LCD display, this backpack uses common serial communication protocols to easily communicate with the 7 segment display and uses SPI and I2C serial communication. I felt that 20mm digits would be large enough to be clearly readable from 14 ft. I found a Toronto based retail company, Creatron, that sells Arduino peripherals. They have 2 Toronto location (Victoria Park and Sheppard, College and Spadina) and I could easily go to their store and pick up the components and avoid shipping charges from adafruit and sparkfun. A sparkfun 4 digit 7 segment red display with open segment serial backpack shield. 20mm 7 segment display with sparkfun's open segment shield. Has breakouts for UART, SPI and I2C serial

Next, I needed a "brain" for my electronics project. In electronics the brain is called integrated circuit (IC) or more commonly known as microchips. Picking an IC for this project was based on the following criteria:

  • Must be well supported by way of forums and source code
  • Simple interface that's easy to understand
  • Must have a Universal Serial Interface (USI) that supports one of the SPI, I2C or UART serial protocols
  • Preference to UART as I'm familiar with this protocol from previous projects
A google search later and I found several different Atmel microchips with a ton of user support and source code, mainly the ATTiny2313, ATTiny45 and ATTiny85.

  • All chips support USI
  • The ATTiny2313 had built in SPI, I2C and UART capabilities, whereas the Tiny45 and 85 didn't
  • The ATTiny2313 was a 20 pin chip and the ATTiny45 and 85 used 8 pins
  • Even though the ATTiny85 didn't have hardware to handle UART, I found out that it was possible to handle the UART in code on the ATTiny45 and 85
  • The ATTiny2313 has 2KB of programmable memory, the ATTiny45 and 85 4KB and 8KB respectively
In the end I decided to go with the ATTiny85 because of the number of pins and the significantly higher programmable memory available with this chip.
Pinout of ATTiny85 chip



Next I had to figure out how to both program and write programs for this chip.

To write programs for the ATTiny85, I used the Arduino IDE. It's an excellent IDE environment that compiles and builds the HEX file for a chip. The HEX file is flashed to the onboard chip memory. There doesn't appear to be limitations on the number of times you can program these chips.

I had a Raspberry Pi on lease from a friend so I wanted to use this device to flash programs to the chip. I found an excellent instructable that gives good instruction on how to program an ATTiny chip. Following the instructions, I created and loaded a very basic "blinky" program that flashes an LED on and off from an output pin of the chip. Another way of programming the ATTiny is using Sparkfun's ATTiny programmer that plugs into the USB port of your computer. The USB programmer coupled with the Arduino IDE development environment can accelerate the programming of these chips in a very streamlined fashion. If I were going to do this again, I would likely buy this programmer and simplify the programming of the chips.

Programming the ATTiny85 with the Raspberry Pi


Now having an approach to programming and flashing the chip, I now wanted to be able to read an inbound UART signal, parse out the data and send it to the display. After a few days of searching, I found this blog where someone had already figured out how to parse out data using the ATTiny85 chip from an incoming UART data signal and output the result to a 7 segment display. This was an amazing find and this blog post alone super-accelerated my ability to work with these chips and complete this project before the sailing season. Many thanks to the author for a well written instruction set and answering my questions in a professional and timely manner.

Next I purchased an Ultimate GPS chip from Adafruit. This chip would supply realtimeGPS speed information for my project.

Adafruit Ultimate GPS Breakout - 66 channel w/10 Hz updates - Version 3

The GPS chip outputs UART based NMEA sentences. The sentence we are interested in is $GPRMC as it contains the data for speed over ground. Hooking this GPS chip up to the ATTiny85, and the ATTiny85 to the display will satisfy my project GPS speed reqiurement. For detailed wiring diagram of the gps, ATTiny85 and display see this blog.

To get both apparent wind speed and apparent wind angle from my boats anemometer to the 7 segement display, I had to convert the RS-232 signal down to UART and then push the UART signal to ATTiny85's, one for wind speed and one for wind angle. The code on each chip was modified to output either wind speed or wind angle to the display. I had to modified ParseGPS code from this blog post to instead parse out the $IIVWR sentence from the anemometer and output the result to a 7 segment display. Having dedicated ATTiny's and 7 segment displays for each data point (GPS speed, wind speed, wind angle) would make my project a reality.

My project needed an enclosure box and I found one at Creatron.

190x120x60mm enclosure


After some serious modifications of the project box, soldering of circuitry, testing and debugging, we have a winner!

The final product hooked up to an anemometer on my workbench.
Top: wind angle
Middle: wind speed
Bottom: Gps Speed


  • 1" digits
  • Box isn't for above deck use
  • Spent under 200 $ in components to build it.
  • Ultimate GPS chip is mounted inside the box.

  • To help the visibility of digits in sunlight, I added a clear red plastic sheet over the 7 segment displays. It helps with the visibility by adding contrast.

Monday, 7 July 2014

Whitby 50

On June 25, 2014, Dave Thompson and I entered the Whitby 50 open race. Forecasts had the winds very light, from the South, then shifting to the North around midnight. Winds remained very light from the South until about 1/2 mile from the Ajax weather buoy where they quickly shifted North and built to a steady 6 knots. Heading back to the finish line, winds were shifty during the first 2 tacks and resulted in us tacking on the knocks and getting a significant lift.

Ended up in 3rd place overall. Happy with the result!


Thursday, 22 May 2014

2014 NCYC Marks deployed

The Newcastle Yacht Club race marks went on-line today.

Thanks to Dennis, Rod, Dave, and his other brother Dave for making this happen.

Looking good boys!



Spinnaker sheet turning block

With my electronic projects on hold, I've went back to modifying / improving my rigging and sheeting setup by adding a flange + cam cleat to this particular system. This spinnaker turning block has an upper and lower spinnaker  block mounted on each rear quarter of Santeria's transom. There has been so may times where I wished I could cleat off the spinnaker at this block, on a windy day , or single handed, or simply to reduce cordage clutter within the cockpit. With a sprink and a ploink and a rickety pop....well....Bobs your uncle.
Materials:

1 - Stainless steel plate  3/32"
1- Abused cam cleat
1 - Fairlead
1 - Angry driller, but later decided to travel to Home Hardware and buy a Tungsten drill bit for stainless
1 - belt sander flipped upside down in a bench vice to round corners of stainless
1 - form fitted cutting board spacer for cam cleat (thank you dollar store)
2 - 7/32" bolts and nuts to attach the cam cleat to the stainless plate


Thanks to my son Bruin for his nautical tower blocks.


Tuesday, 10 December 2013

Multiple Bluetooth Endpoints

As mentioned in the last post, one of my winters project was to output the multiplexed NMEA signals from Raspberry PI to 2 different Bluetooth transceivers. Before hooking my Bluetooth creation to the Raspberry PI, I wanted to confirm that this setup would work. All this to share data across android devices using a custom NMEA app.

Last night I tested to see if the custom UART converter design could handle multiple Bluetooth transceivers on the same output circuit. I was worried that splitting 1 NMEA output across 2 Bluetooth devices could result in a depleted signal. Because the length of wire connecting the 2 Bluetooth transceivers is so short (and will be short when installed) I was hoping to see little to no reduction of signal quality going to either Bluetooth transceiver.

From the picture below, you can see the breadboard prototype and the 2 Bluetooth transceivers receiving a split NMEA output. 

Testing showed little to no signal depletion (measuring both volts and amps) after hooking the Bluetooth outputs to a voltmeter and comparing the main signal. The entire system, wind instrument + 2 paired Bluetooth transceivers draws 0.12 Amps, that's a whopping 1.44 Watts! Now I know why my 70 aH battery was still partially charged when mistakenly leaving this system on for 2 weeks.

Next I wired up my wind instrument to the breadboard prototype.



Now realizing that the length/distance of wire from the masthead to the electrical panel on Santeria is about 35 to 40 feet, I went ahead and uncoiled a 35 foot length of speaker wire and connected the data output wire of the wind instrument (to mimic the height of the mast). After connecting the speaker wire to the breadboard, I went ahead and paired 2 different Android devices, one to each Bluetooth transceivers. I turned on the fan to get the wind instrument moving, then started the custom Android app.

The results:

Tablet output:


Phone Output:




Giddie Up!

This should work quite nicely aboard Santeria. This double Bluetooth scenario significantly reduces the amount of redesign effort.

Next.....the Raspberry PI!



Monday, 28 October 2013

Raspberry Pi multiplexer


As mentioned in earlier articles I have created an electronic device that will convert my boats NMEA instrument signals (Wind instrument in my case) to a NMEA bluetooth signal. This in turn pairs and pushes this data to an android device where an android application displays apparent wind speed and apparent wind angle using a tablet or smart phone. This year I would like to add another NMEA based instrument to my boats system, more specifically a Depth, Speed and Temperature sensor. 

As it stands, the electronic device that converts NMEA instrument signal to bluetooth doesn't scale up to a multiple instrument scenario. So I'm proposing a slight modification to the custom UART converter device to accept more NMEA instrument signals.

The Raspberry Pi is a small computing device the size of a credit card. The purpose of this article is to not describe the purpose of the Raspberry Pi but to tell how we propose to use it to multiplex NMEA data and publish it via Bluetooth technology. 

Having more than one NMEA instrument on board has added a requirement to multiplex the different NMEA signals from each NMEA instrument into one Bluetooth output signal. Getting back to the Raspberry PI, the reason why it may be an appropriate device for multiplexing are the GPIO pins on the board. GPIO stands for General Purpose Input Output and can be programmed to accept a number of signal protocols. The one that is most interesting and compatible with my custom electronic device is the UART/TTL protocol. Here is the Raspberry PI Rev 2 pinout:


As you can see in the above diagram, there is one hardcoded UART TXD pin (pin 8) and one UART RXD pin (pin 10) on the board already. With the help of a little little python startup script, any one of the other 8 GPIO pins can be converted to accept UART signals. Why this is significant? Well, it now means that I could use the Raspberry PI, in conjunction with my custom serial to UART converter, to accept and multiplex a number of NMEA signals before pushing them out over bluetooth. I'd rather not have to connect with 2 or more bluetooth transmitters in order to get different NMEA instrument signal data (it just seems like bad design in my opinion). So, something like this:

























So this winters project is to:
  • Use the Raspberry PI to multiplex 2 or more different NMEA signals
  • Output the multiplexed signals from Raspberry PI to 2 different bluetooth adapters (so that more than 1 android device can view this data)
  • Update the design of the custom UART converter 
  • Find another NMEA instrument for testing and multiplexing signals (GPS, etc...)

Friday, 4 October 2013