Friday, December 11, 2015

Raspberry PI Zero is here

I just received mine. And it just works. It takes a ridiculous amount of energy, and works just like its bigger brothers. Just a couple of things to keep in mind:
  • Use the latest RasPian image, I used - successfully - the one from Nov-11, 2015 (2015-11-21-raspbian-jessie.img)
  • If you use a desktop USB keyboard, you need a powered USB hub
  • Once started, do not forget to expand your file system, so it uses all the space available on your SD card
I used it with the small Edimax Wireless USB dongle (the powered hub is not required for this one), I got started in no time. I was able to ssh to it and run everything on it! So far, it is an amazing machine. A real fully featured Linux computer for $5. And 20 times more memory than the one I had in my desk 25 years back...
Check out Eben Upton's video about that:

That would remind many things to some of us... Amstrad, Amiga, Atari, wow! I must be getting old.

PS: About the pinout: Put the SD Card on top, the biggest Raspberry design under the board. The pin #1 (3V3) is at the top left of the header.

Thursday, November 19, 2015

Monitor the Boat, remotely

With a FONA connected on the Raspberry PI (where the NMEA Console is running), you can remotely monitor what's going on.
Sending a '?' returns the menu, all subsequent available commands are 1 or 2 character long.

The feature has been implemented - as usual - as a UserExit. This UserExit is in the Desktop repo, the FONA Java interface is here.
Add the following parameter to the command line:

Just by sending an SMS, you can retrieve the data read by the Raspberry PI on board, like True Wind Speed, Battery Voltage, Air and Water Temperature, etc, all you need is a smart phone that can send and receive SMSs.

That sounds promising...

This assumes that the boat is docked in a place where there is SMS coverage, of course. I'm working on an Internet version, with a Particle Photon, or an ESP8266...

Saturday, June 06, 2015

Scala on the Raspberry PI

As Scala compiles its files as Java class-files, they run on a regular JVM, with a few Scala-specific jar-files in the classpath.
Even if it is not the most productive way to get work done, it is possible to compile Java files on the Raspberry PI, as well as Scala files. Personally, I prefer to develop in an IDE, and use FTP to push the classes to the Raspberry PI, it's much faster, and the IDE is much more productive than vi.
The explanations I found here got me started.
And again, as Scala runs on a Java Virtual Machine (JVM), all the work done with PI4J is fully available from Scala.
The following code (available on github) shows how to read a BMP180 from Scala:
 import adafruiti2c.sensor.AdafruitBMP180

 object Scala_101 {
   def main(args: Array[String]) {
     println("Hello, Scala world!")
     val bmp180 = new AdafruitBMP180
       val temp  = bmp180.readTemperature
       val press = bmp180.readPressure / 100
       println(s"CPU Temperature   :  ${SystemInfo.getCpuTemperature}\272C")
       println(s"Temp:${temp}\272C, Press:${press} hPa")
       case ex: Exception => {
To run it, I used a script like this:
 sudo java -classpath "$CP" Scala_101
And all is good, the output is
 Hello,Scala world!
 CPU Temperature  :40.6°C
 Temp:22.5°C, Press:1010.73 hPa

Thursday, May 07, 2015

Web Console improvements

With the Raspberry PI now able to behave as an Access Point, almost all devices can connect to it (Apple, Android, all kind of phones or tablets). Using an HTML5 enabled browser makes live easier than writing a dedicated application for the given Operating System.
That's why we now have some improvements in the Web Console:
See above the "Night" scheme, with or without borders for the displays
Same for the "Day" scheme.

The HTML5 console is accessed from http://machine:port/html5/console.html, default port being 9999.
If you have installed node.js and the WebSocket user-exit, then you access the WebSocket console from http://machine:9876/data/
It is still self-contained, no external framework is used (like JQuery et al). Those are great - for sure - but this is to be run on a boat at sea, with Internet out of reach.
Notice on the snapshots that several data come from some sensors hooked-up on the Raspberry PI. They can be shown or hidden from the preferences or from the Console Admin page.
Notice that the Console Admin page has been removed from the Console, it can now be accessed from a separate URL, on the admin port (8080 by default) at http://machine:port/html5/admin.html, started when the console is in headless mode:
The default values on the pages above come from the Desktop Preferences.
And there is now a CLI (Command Line Interface) for to access those preferences from a non-graphical environment (like on the Raspberry PI).
The class to launch is olivsoftdesktop.PreferencesCLI. An entry will added soon in the User Interfaces.

All this runs fine on the Raspberry PI, all the snapshots above have been taken with the Raspberry PI run node.js as server.

An idea...

Anyone with a smartphone or a tablet can access those live data. The problem is to type in the right URL...
Once you have chosen your configuration (IP address and ports), you can generate QR Code ( worked for me), print them, and post them somewhere in the boat. Whoever wants to reach the data just uses his QR Scanner - all smart stuffs have at least one - and boom! You're in!

HTML5 console

HTML5 WebSocket console

HTML5 Admin console
Those pages support query string parameters theme and border. theme can be 'white' or 'black', border can be 'Y' or 'N'.
Like in http://machine:9999/html5/console.html?theme=white&border=N

There are several QR Code generators, including some you can run off-line. This one works just fine, and can be installed on the computer on the boat, so you can generate your codes from anywhere. As you can see here.

Thursday, March 05, 2015

OpenCPN on the Raspberry PI model 2

I just received the new Raspberry PI model B, it comes with 1Gb of RAM.
And it seems that OpenCPN runs just fine on it!
I started from the last NOOBS available from the Raspberry PI website.
Here are the steps I had to go through to build it:
Prompt> sudo apt-get update
Prompt> sudo apt-get install -y libgtk2.0-dev gettext git-core cmake gpsd gpsd-clients \
  libgps-dev build-essential wx-common libwxgtk2.8-dev \
  libglu1-mesa-dev libgtk2.0-dev wx2.8-headers \
  libbz2-dev libtinyxml-dev libsdl1.2debian xcalib

Prompt> git clone
Prompt> cd OpenCPN/
Prompt> mkdir build
Prompt> cd build
Prompt> cmake ../
Prompt> make
Prompt> sudo make install
After that, at the prompt you enter:
Prompt> opencpn &
And that's it!
And by the way, it works the same on all the Ubuntu-like distributions I tested.

Thursday, January 08, 2015

Version available

New version - for both the Weather Wizard and the Navigation Console - is available, at the usual place.
Few new features, minor UI improvements, and big uptake for the Raspberry PI.
A new feature for the Weather Wizard in headless mode, you can download several composites at the same time (one after the other actually). Use the -composite: and -pattern: parameters, separate each value with a comma.
For example, on Windows:
 set PRMS=-composite:./patterns/01.Favorites/01.3.00.Pacific.Sfc.500.Tropic.GRIB.ptrn
 set PRMS=%PRMS%,./patterns/01.Favorites/06.01.AllPac.Faxes.Satellite.ptrn
 set PRMS=%PRMS% -interval:360 
 set PRMS=%PRMS% "-pattern:/yyyy/MM-MMM | | yyyy-MM-dd_HHmmss_z | _Pacific | waz,/yyyy/MM-MMM | | yyyy-MM-dd_HHmmss_z | _Pacific.SatPic | waz"
 set command=java %JAVA_OPTIONS% -client -classpath "%CP%" -Dheadless=true main.splash.Splasher %PRMS%
On Linux and Mac:
 PRMS=$PRMS -interval:360 
 PRMS=$PRMS "-pattern:/yyyy/MM-MMM | | yyyy-MM-dd_HHmmss_z | _Pacific | waz,/yyyy/MM-MMM | | yyyy-MM-dd_HHmmss_z | _Pacific.SatPic | waz"
 command=java $JAVA_OPTIONS -client -classpath "$CP" -Dheadless=true main.splash.Splasher $PRMS