Raspberry Pi Camera Server

It’s so easy to set up a Raspberry Pi Camera Server because of RPi-Cam-Web-Interface. I’m using these materials;

  • Raspberry Pi Zero W with Jessie Lite
  • Raspberry Pi NoIR Camera Board, Version 2
  • Raspberry Pi Zero Camera Adapter (this is required because the camera port on the Raspberry Pi Zero is smaller compared to the camera port on the Raspberry Pi 2 or 3)

Here are the steps:

  1. Prepare a new Raspberry Pi with Raspbian
  2. Make sure it’s connected to a network and you can ping it from your computer
  3. Confirm that the camera is working, run this command you should see the live video for 6 seconds. If this works then proceed to the next step. Otherwise fix this first.
    raspistill -v -f -vf -t 6000
  4. Run these commands to install the RPi-Cam-Web-Interface:
    sudo apt-get update
    git clone https://github.com/silvanmelchior/RPi_Cam_Web_Interface.gitcd RPi_Cam_Web_Interface
    chmod u+x *.sh
  5. From your computer, go to (IP is your Raspberry Pi’s IP)
  6. Voila!

Upgrade Windows 10 Home to Professional on a Dell laptop

I have a Dell XPS laptop and it came with Windows 10 Home installed. I had a Windows 10 Professional license tied to my Microsoft account.  I wanted to upgrade my Home installation to a Professional installation, here’s how I did it:

UPDATE: The following steps did not work as I had hoped. It didn’t not accept my other Microsoft account’s Windows 10 Pro license. I ended up buying the Windows 10 Pro license from Play-Asia for very cheap. I still went through steps 1-5 and then I entered the new Windows 10 Pro key. And it didn’t work! I ended up calling Microsoft and activated it over the phone. And done! 🙂

  1. Open Windows 10 Settings and go to activation
  2. Click on Product Key and use this one VK7JG-NPHTM-C97JM-9MPGT-3V66T. (This is a generic Windows 10 Professional key, it will simply allow you to perform the upgrade)
  3. Perform the upgrade
  4. After restart, Windows will ask for activation
  5. Open Windows 10 Settings and go to activation
  6. Click on Troubleshoot
  7. Click on “I recently changed hardware on this device” and select the license from the Microsoft account
  8. Sign in to your Microsoft account (the one with the Windows 10 Professional license) and voila!

Raspbian (PIXEL) with SDL2 (compiled from source)

Here are the instructions to (re)installing SDL2 on Raspbian by compiling from source.

sudo apt-get remove --purge libsdl2-dev
sudo apt-get autoremove
sudo apt-get install build-essential libfreeimage-dev libopenal-dev libpango1.0-dev libsndfile1-dev libudev-dev libasound2-dev libjpeg-dev libtiff5-dev libwebp-dev automake
sudo apt-get install libraspberrypi-dev raspberrypi-kernel-headers
mkdir build && cd build
wget https://www.libsdl.org/release/SDL2-2.0.5.tar.gz
cd SDL2-2.0.5
./configure --disable-pulseaudio --disable-esd --disable-video-mir --disable-video-wayland --disable-video-x11 --disable-video-opengl
sudo make install
sudo ldconfig

Hooray! SDL performance is much much faster! 🙂

SOURCE 1: https://solarianprogrammer.com/2015/01/22/raspberry-pi-raspbian-getting-started-sdl-2/
SOURCE 2: http://choccyhobnob.com/tutorials/sdl2-2-0-5-on-raspberry-pi/


Eclipse (Neon.2) and SDL2

After much trial and error, here are the instructions to using Eclipse and SDL2:

  1. Download and install Eclipse Neon.2 for C/C++
  2. Download and install MingW
    1. Install to C:\Mingw\
    2. In the bin folder, copy gcc.exe and rename it to mingw32-gcc.exe
  3. Download SDL2 MingW version and unzip to C:\SDL2
  4. Add C:\mingw\mingw32\bin to your PATH
  5. Copy SDL2.dll to C:\Windows\SysWOW64 if running 64-bit or C:\Windows\System32 if running 32-bit
  6. Run Eclipse
  7. Create a new C project and select MingW toolchain
  8. Add a new C source file and add this code
    #include <SDL.h>
    int main (int argc, char** argv) {
     // Create window
     SDL_Window* window = NULL;
     window = SDL_CreateWindow ( "Hello World!", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 640, 480, SDL_WINDOW_SHOWN );
     // Setup renderer
     SDL_Renderer* renderer = NULL;
     renderer = SDL_CreateRenderer( window, -1, SDL_RENDERER_ACCELERATED);
     // Set background color to red
     SDL_SetRenderDrawColor( renderer, 255, 0, 0, 255 );
     // Clear window
     SDL_RenderClear( renderer );
     // Create a square at ( 50, 50 ) with 50 width/height
     SDL_Rect r;
     r.x = 50;
     r.y = 50;
     r.w = 50;
     r.h = 50;
     // Fill square with blue color
     SDL_SetRenderDrawColor( renderer, 0, 0, 255, 255 );
     SDL_RenderFillRect( renderer, &r );
     // Draw everything to screen
     // Wait for 5 seconds
     SDL_Delay( 5000 );
     // Close window and exit
     return EXIT_SUCCESS;
  9. Add “C:\SDL2-2.0.5\i686-w64-mingw32\include\sdl2” to the Project “Include”
  10. Add “C:\SDL2-2.0.5\i686-w64-mingw32\lib” to the Project “Library Paths”
  11. Add “mingw32, sdl2main, sdl2” (in that order) to the Project “Libraries”
  12. Compile and run! 🙂

Samsung SSD

The SSD I bought is a Samsung 850 EVO and it appears to be very fast. Make sure you install Samsung Magician software. It’s a nice tool for benchmarking and optimizing your SSD. All those optimizations that I mentioned in my previous post which I did manually, you can do that from the Magician.

Here is a screenshot of my benchmark:

SSD Benchmark



Freematics Telematics Kit #1 – Not so cool!?!?!

It was working for a while. I decided to tidy it up and use a breadboard. After plugging into the breadboard I tried to download a different program into the Nano, which worked. At some point the Nano’s driver in Windows stopped working. So I installed this http://www.ftdichip.com/Drivers/CDM/CDM%20v2.12.06%20WHQL%20Certified.zip. This also worked for a while. The next day it wouldn’t connect 😦

Everytime I tried to upload it would fail with “…avrdud…not in sync resp=0xca”. I eventually found this http://forum.arduino.cc/index.php?topic=73748.0 which provides instructions to test the board by performing a loopback test. I did that and the return from loopback test was “NON GENUINE DEVICE FOUND!”. Just great 😦

Update 1:
Here are the steps to fix it:
1) Follow http://electropit.com/index.php/2015/09/06/arduino-nano-v3-0-clones/. When it talks about burning the bootloader then follow http://www.instructables.com/id/How-To-Burn-a-Bootloader-to-Clone-Arduino-Nano-30/?ALLSTEPS
2) Install the Arduino USB drivers from C:\Program Files (x86)\Arduino\drivers\

And it works again! 🙂

The moral of the story? Buy genuine or buy compatible boards from a reputable source such as Core Electronics.


Freematics Telematics Kit #1 – Cool!

I bought one of these recently: http://freematics.com/pages/products/arduino-telematics-kit-1/

It’s an Arduino based OBD interface device. The kit comes with:

  • OBD II Adapter (Arduino powered)
  • Arduino Nano
  • I2C OLED screen (128×64)

They even provide a sample Arduino program for the Nano and it works!

Here’s my guide to setting it up:

  1. Go to https://github.com/stanleyhuangyc/ArduinoOBD and download the zip file
  2. Extract the zip file to “ArduinoOBD-master” and browse to the “libraries” folder
  3. Copy “MicroLCD”, “MPU6050” and “OBD” from the “libraries” folder to the Arduino libraries folder (located in ..\Documents\Arduino IDE\libraries)
  4. Go back to the “ArduinoOBD-master” folder and open “nanologger”
  5. Open “nanologger.ino”
  6. When you compile it you will receive an error about the sketch being too big. If you haven’t installed the microSD card breakout then you don’t need the data logging features. Go to “config.h”, line 8 where it “#define ENABLE_DATA_LOG 1” and change it to “#define ENABLE_DATA_LOG 0”
  7. Make sure you disconnect the OBD adapter wires from the Nano otherwise you won’t be able to download it
  8. Now you can compile and upload!
  9. Connect the wires as per http://freematics.com/pages/products/arduino-telematics-kit-1/
  10. Connect to your car and voila! 🙂