January 13, 2014

Jollyturns

Work

Jollyturns - a ski/snowboarding mobile application I worked on for more than 2 years, is finally live!

The focus for the first release was on providing as much ski resort information as possible. We produce the ski resort information ourselves, and it includes detailed information on ski lifts, ski runs, restaurants/lodges, snow and weather information.

Future releases will focus on better statistics and improved social interaction.

Please check it out and let me know what you think by sending email to support@jollyturns.com.

Posted by ovidiu at 11:37 AM | Comments (0) |

May 06, 2013

BeagleBone Black vs Arduino Uno

Arduino | BeagleBone | Cool gadgets

I just received my BeagleBone Black from Adafruit. It's a very sweet board and the price is just right. US $45 will get you a 1GHz ARM processor with 512MB RAM and 2GB flash, built-in Ethernet (10/100Mbps), video graphics card with HDMI output port, 65 I/O ports, 4 hardware UARTs. A very capable board for driving the various small projects I have in mind.

The first project I will work on is to replace a Guruplug+Arduino-based project that was driving my projection screen. The setup I had was quite nice, but it appears the Guruplug died after running great for the past few years.

Posted by ovidiu at 05:44 PM | Comments (0) |

June 17, 2011

Rsync over ssh: the dreaded "writefd_unbuffered failed to write 4 bytes to socket" error

Open Source

I use rsnapshot to implement a backup solution for the computers in my home. Rsnapshot runs as a cron job on a ReadyNAS Pro Business Edition system with 6 2TB drives inside (a total of 7.4TB in an X-RAID2 configuration). It backs up the data from a Mac Pro using rsync over ssh. I would have used TimeMachine but its inability to reliably run on non-Apple hardware and with volumes larger than 2TB drives me nuts.

Every once in a while, especially when I have some new fresh data to be backed up, I see rsync start up but it mysteriously dies after a short while (in in /var/log/rsnapshot.log). Running the same command in a terminal gives the following error:

rsync: writefd_unbuffered failed to write 4 bytes to socket [generator]: Broken pipe (32)
rsync error: timeout in data send/receive (code 30) at io.c(1530) [generator=3.0.7]
rsync error: received SIGUSR1 (code 19) at main.c(1306) [receiver=3.0.7]

Both the source and the destination machines were using rsync 3.0.7. The command line I was running on the source machine (readynas):

root@readynas:~> /usr/bin/rsync -a -v --iconv=UTF-8 --timeout=180 --archive \
    --compress --delete --numeric-ids --relative --delete-excluded --copy-unsafe-links \
    --rsync-path="/opt/local/bin/rsync" --rsh="/usr/bin/ssh -p 22 \
    -o 'ClearAllForwardings yes' -o 'ServerAliveInterval 60'" \
    root@monster:/Volumes/BigDisk /backup/hourly.0/monster/BigDisk/

I upgraded rsync both on the source machine (the ReadyNAS), as well as on my Mac Pro to 3.0.8, by manually compiling the latest version. However the error still persisted.

Googling around didn't reveal any solution to the problem, which apparently goes back all the way to at least 2008. On one forum a poster suggested removing the compression from rsync and let ssh handle it. This works for small files but it tends to break on the larger files (larger than 15GB in size).

What seems to work best however is remove compression altogether. Another thing I've done is to use rsh instead of ssh. Here is the new command line (note the new paths to rsync 3.0.8 on each machine).

root@readynas:~> /usr/local/bin/rsync -a -v --iconv=UTF-8 --timeout=180 --archive \
    --delete --numeric-ids --relative --delete-excluded --copy-unsafe-links \
    --rsync-path="/usr/local/bin/rsync" --rsh="/usr/bin/rsh" \
    root@monster:/Volumes/BigDisk /backup/hourly.0/monster/BigDisk/
Posted by ovidiu at 02:48 PM | Comments (1) |

December 08, 2010

Arduino Tiny Web Server - part 3

Arduino

Update (September 3rd, 2011): The code is on Github: https://github.com/ovidiucp/TinyWebServer

A zip file of the latest version of Arduino TinyWebServer can be found here https://github.com/ovidiucp/TinyWebServer/zipball/master.

What is it?

Arduino TinyWebServer is a library implementation of a small web server running on an Arduino Duemilanove or Uno using the new Ethernet Shield released at the end of September 2010. The new Ethernet Shield adds a microSD card right on the board, in addition to fixing a number of hardware bugs from the previous iteration.

The library is meant to provide a Web interface to your Arduino project. It is not meant to be a full Web server implementation, just the minimum amount to let you get started quickly.

To save precious memory space on your Arduino, TinyWebServer encourages you to develop your web applications as AJAX applications. This means that you should delegate the page generation and complex UI interactions to the Web browser, instead of trying to handle it on the Arduino side of your project. The only thing the Arduino should implement is retrieving and displaying the internal state, as well as modifying it using HTTP POST requests.

Changes from the previous release

As you're probably aware, a new Ethernet Shield for Arduino was released at the end September 2010. I bought one and I'm pleased to report that it fixes an annoying hardware bug present in the old shield. In addition it has a new microSD slot that is actually accessible through a dedicated SPI SS pin. This means that you can use an Arduino Duemilanove or Uno with the Ethernet Shield with no modifications whatsoever.

I finally had some time to update the Arduino TinyWebServer library to make it work with the new shield. As you can see in the picture above, the setup is much easier than with the old Ethernet Shield and the data logging shield. The new library version drops support for this kludgy setup.

  • Compared to the previous release, the new Arduino TinyWebServer release removes the dependency on the EthernetDHCP library. As a result you need to configure the IP address of the Ethernet shield manually inside the examples to match your network. Of course you can still add EthernetDHCP support to your own sketches if you wish.
  • The library now uses the SdFat library instead of the Fat16. This allows the use of microSD cards larger than 2GB, formatted with FAT32, not only cards less than 2GB formatted with FAT16.
  • The new release no longer uses a modified Ethernet library. It instead uses the existing Ethernet library that comes with the Arduino IDE.
  • The code was updated to work with the latest Arduino IDE, version 021.
  • I fixed a bug related to memory allocation and how the Ethernet Client objects were returned through the API.

In the new release I've added a new example that shows how you can control an LED from a regular Web browser. The video below demonstrates how it works.

Documentation

Arduino TinyWebServer is a library and as such requires you to write code customized for your own application. Some almost ready-to-go examples can be found inside the distribution in the examples/ directory. Follow the instructions in the README.txt files for each of the examples.

An explanation of the library's API can be found in this older post. Some things like the EthernetDHCP code no longer apply, so please look at the new examples for the updated code. Still most of the code is still applicable.

Posted by ovidiu at 10:36 PM | Comments (2) |

Transcode AVCHD to MPEG using ffmpeg

Open Source | Photo

I recently bought a Panasonic Lumix DMC-LX5 camera, which records video in both MPEG and AVCHD formats. The camera has some nice improvements over the previous LX3 camera. I really like the extended zoom range, 24-90mm versus the 24-60mm in the old camera. Another feature I really love is the ability to zoom while shooting a movie. The sounds quality improved significantly as well, some videos I took with the old camera had some strange sound issues.

One thing that drove me nuts however was the inability of iMovie 7 or Final Cut Express to import the AVCHD movies I made with the camera. They would import only the first few minutes of the movie and invariably stop after that. The MacOS X software that comes with the camera doesn't handle movie files, and the Windows version sucks badly.

So I was stuck with no way of converting the AVCHD movies to an MPEG file format that can be viewed on MacOS X. Adobe Photoshop Lightroom 3, the program I use to catalog the photos and videos I take, does not understand AVCHD either.

You can however convert the .MTS files from the AVCHD directory created by the camera using the open source ffmpeg tool. To do this, make sure you have MacPorts installed on your computer, then install ffmpeg like this:

sudo port install ffmpeg +gpl +lame +x264 +xvid +mp3 +aac

Once you have ffmpeg installed, you can convert the MTS files like this:

ffmpeg -i <file>.MTS -vcodec mpeg4 -f mp4 -sameq <file>.mpg
Posted by ovidiu at 10:54 AM | Comments (0) |
 
Copyright © 2002-2011 Ovidiu Predescu.