Raspberry Pi Zero W: fast headless Wifi configuration with SSH

Yesterday I received a Raspberry Zero W, that for approximately $10 include Wifi and Bluetooth (byebye dongles) but no Ethernet port.

This post contains the instructions for configuring the Raspberry Pi Zero W so that he connects to the wifi network at the first startup of Linux, without wasting time (after that, you can log on via SSH).

  1. Download Jessie Lite image from the official repository (5 min)
  2. Download Etcher and burn the image on SD card (5 min)
  3. Insert the SD card in your notebook and open the boot folder of the SD Card
  4. Create an (empty) file called ssh (this enable SSH on startup)
  5. Create a wpa_supplicanf.conf file with the following content
network={
    ssid="YOUR_WIFI_SSID"
    psk="YOUR_WIFI_PASSWORD"
    key_mgmt=WPA-PSK
}

Insert the SD in your Raspberry Pi Zero W, attach the power USB, connect your computer to the wifi, scan the network to find the raspberry IP address …and you can connect via SSH 🙂

Posted in Raspberry, Uncategorized | Tagged , , , , , | Leave a comment

ESP8266: Smartphone door opener for less then 10$

Sometimes you have your hands full of bags, umbrellas, etc. In these cases it would be useful to open the door without keys, simply finishing ahead.

My idea is to use a smartphone to trigger the opening of the door, using a microcontroller inside my house and an application on the cloud to manage the communications of the system.

For my jobs experience, I know very well that with a RaspberryPI + wifi (45$) or an Arduino Yùn (60$) the project is feasible, but:

  • my challenge is implement the whole system with a cost lower than 10$
  • It is a waste to use an entire operating system to push a button

So, I choose the well known ESP8266 module.

esp8266_relay_intercom_IMG_20160207_112909

Recipe

  • 1 ESP8266 dev board like NodeMCU (~8$)
  • 1 Relay (~1$)
  • NodeJS application on Azure websites  (0$)

I bought all the hardware on my favourite chinese mall Bangood.

System

Intercom Esp8266 (2)

How it works

  1. On the cloud there is a NodeJS app (websocket server + http server)
  2. The ESP8266 board is connected to NodeJS app via websocket, using my home wifi network
  3. When certain conditions are met, the smartphone makes a HTTP request to NodeJS app
  4. When NodeJS app receive specific http request, send a command to the websocket
  5. The ESP8266 board receive the command instantly (< 0.2s) and activate the relay digital pin
  6. The Relay receive current and trigger the switch on the intercom
  7. The door is unlocked

Code

Soon publish the code on Github for both ESP8266 and NodeJS apps

TLTR

At the beginning I wanted bypass entirely the intercom, but after few attempt I realize that the intercom protocol is not well documented. Audio, video and signal all on 2 wire at 26-28V. Definitely easier to simulate the press on the intercom button using a relay.

IMG_20160204_193929 copy

IMG_20160205_210522

After write the Esp8266 code with Arduino, I wrote the server parte with NodeJS and a webpage.

From an architectural perspective the initial system is composed by a single server and two client (Esp8266 and Smartphone) that communicating with a persistent connection (websocket).

Due to the websocket connection limit of free azure websites (max 5 connection) an other economic considerations, I upgrade the system to limit the websocket connection only to the indispensable Esp8266 side, letting the smartphone using classic HTTP requests to send commands to the server.

I build a webpage with a on/off butto to test the system, and it works! After 2 weeks of continuous running without any problem, I am fully satisfied: I can open my door with a touch on my smartphone.

But it would be great if I could open the door without touching the smartphone. So I started to investigate the conditions and technologies to upgrade the system the next level.

As often happens, any simplification for the user adds layers of complexity to the system, and the variables become many:

  • location (gps and wifi based)
  • walk paths
  • hours of the day
  • days of the week
  • wifi ssid available
  • network to which my mobile phone is connected

The approach based on a web page was no longer sufficient: i switch to native app.

Posted in Arduino, diy, Maker | Tagged , , , , , , , , , , | 6 Comments

Oculus Rift handmade with Lego and google streetview

Recently I build an Oculus Rift like low cost alternative to simulate the original device.

I have a smartphone with hd screen and find on Amazon an interesting kit (2 lens, 1 strap). So, I build a lego structure to bring together this elements, and wrote a small ios app that show two view, one for eye.

The gyro and accelerometer sensor make possibile to track the head movement, so the last ingredient was to find an app that show multiple 3d view based on sensors.

I not find the app, so I wrote a small ios app that show 2 streeview frame, rotating the view point based on sensors. The result is simple and awfull 🙂

Posted in Uncategorized | Leave a comment

Lego plays Ruzzle: nxt & nodejs powered robot

Today I have uploaded a video ‘Lego plays Ruzzle‘ on Youtube, to show how my creation works.

I like to mix different technologies to create something innovative.

I love Lego, and recently discovered Ruzzle, a popular mobile game. So, I decided to mix Lego, Ruzzle, Javascript, bash and other pieces to create a super robot 🙂

lego-plays-ruzzle

In this project I used:

  • Tablet with Ruzzle
  • Bash script for:
    • Bash script for download screenshot of device
    • Process image with Imagemagick
    • Recognize character from image with Tesseract
  • NodeJS for:
    • Solving Ruzzle
    • Optimizing the plan
    • Send via bluetooth to Lego Mindstorm
  • Nxc program to receive plan via bluetooth
  • Absolute Position Regulator library for precise control of lego motors

Ruzzle solver scheme (3)

The project is open source, and the code is on Github:

https://github.com/albertosarullo/ruzzle-mindstorm-nxc-nodejs-solver

More photos are on Flickr:

http://www.flickr.com/photos/silvana_g/8459161766/in/set-72157632723812787/

Other article on Lego Ruzzle Solver:

In march 23 I talked about history of my robots @ Codemotion Rome. Below you can finde the slides of my talk:

 

Any feedback / request is appreciated !

 

 

 

Posted in Android, Javascript, Uncategorized | 31 Comments

Ruzzle Lego Solver: first photo

After some day of building, conding, and testing, I publish the first photo of my Lego Ruzzle Solver.

The robot use 3 NXT motors: one for x-axis movement, one for y-axis movement, and one for move the “finger” up and down. To decrease friction, the two movable parts of robot are supported on rigid wheels, like a bridge crane.

Ruzzle Lego Mindstorm Solver

A curious thing: the capacitive touchscreen of the tablet require human fingers (attached to human body) to dispatch touche event. Because attach fingers to lego mindstorm motor require detaching fingers from my body, I have discover that conductive sponge is a very good alternative, and because vegetal sponge is conductive, I have buy it at supermarket for 1 euro saving my real fingers.

Posted in Uncategorized | Tagged , , , , , | 1 Comment

Ruzzle Lego Mindstorm NodeJS Solver

Yesterday I start to build a new Lego Mindstorm project to solve Ruzzle, a popular iOS/Android game.

My goal is to merge both software (image processing, ocr, solver) and hardware (mechanics, servos, fake finger on a touchscreen) worlds, building a funny Lego robot.

On software side:

  • Bash script for download screenshot of device
  • ImageMagick to process screenshot image
  • Tesseract for character recognition
  • NodeJS for:
    • solving ruzzle game
    • send the plan to lego mindstorm nxt via bluetooth

On hardware side:

  • Lego Mindstorm (nxt)
  • Nxc program that receive plan via bluetooth
  • Absolute Position Regulator for precise control of servo

When I have something working, I post nxc program on Github:

  • https://github.com/albertosarullo/ruzzle-mindstorm-nxc-nodejs-solver

 

Posted in Android, Ipad, Iphone, Javascript | Tagged , , , , , , , , , | Leave a comment

Facebook Flash Apps and Firefox: bug and workaround

If you develop a flash iframe facebook application that records images / video from the user camera, you have serious problem on Firefox on mac OSX: you are unable to interact with the flash settings dialog box.
Continue reading

Posted in Facebook, Flash | Tagged , , , , , , | Leave a comment

Javascript Accelerometer Demo and Source

IOS 4.2 (with new Safari Mobile) has the possibility to read sensor data like accelerometer and gyroscope directly from Javascript.
Continue reading

Posted in Ipad, Iphone, Javascript | Tagged , , , , | 25 Comments

ActionScript: IE8 navigateToURL bug and workaround

Flash player on IE8 has a bug: the call to actionscript function navigateToURL(urlRequest) always opens in a new window.
Continue reading

Posted in Actionscript | 1 Comment

Google Map V3: Markerclusterer with custom tooltip/title

Markerclusterer, part of Google Maps Utility Library, is a Javascript library that helps developers to manage a large number of markers, grouping near markers into a single “cluster”.

Continue reading

Posted in Google Map, Javascript | Tagged , , | 19 Comments