Raspberry Pi Zero OTG mode

Story Horse?

The Raspberry Pi Zero support USB On The Go, given the processor, is connected directly to the USB port, unlike on the B, B+ or Pi 2 B, which goes via a USB hub.

Since there are so many who have experienced various problems with their Pi setup and connection I created the following steps that I used from Linux Ubuntu 16.04 with success.

With OTG mode, the process is like this:

  • Format the SD card on your computer
  • Tweak a few files on the SD card before ejecting it
  • Plug the SD card into the Pi
  • Plug the Raspberry Pi USB port into your computer
  • Share Internet with the Raspberry pi device
  • SSH to the Pi
  • Continue any setup on the device

This is a huge improvement as we no longer need to plug in the HDMI monitor or keyboard for initial setup!

When you plug the Pi into your computer in the above example, it is emulating a virtual Ethernet device. Essentially, your computer thinks you plugged a network card into it.

Let’s go:

1 – Downloaded Raspbian Jessie Lite image from here:


2 – Copied image to Micro SDHC card via these instructions:


$ sudo dd bs=4M if=2017-04-10-raspbian-jessie.img of=/dev/sdb status=progress


$ sudo unzip -p 2017-04-10-raspbian-jessie.zip | sudo dd of=/dev/sdX bs=4096

OR you can use Etcher https://etcher.io/

I recommend Etcher.io which will flash your SD card, in the same way, whichever of those Operating Systems you use on your PC/laptop.

3 – To help prevent Raspberry Pis around the globe from being hacked the RPi foundation have now disabled SSH on the default image. Just create a text file in /boot/ called ssh – it can be blank or you can type anything you want it.

To /boot add empty file: ssh


To share internet from USB

To /boot/config.txt add line with: dtoverlay=dwc2

To /boot/cmdline.txt after rootwait add: modules-load=dwc2,g_ether

4 – Unmount sd card, put in Pi Zero, connect USB cable between Pi Zero power port and Linux computer.

5 – From Linux computer:

Open the nm-connection-editor (from the panel). Select Wired connection 2 (RasPi on USB) & click Edit. Under ‘IPv4 Setting’ set ‘Method’ = ‘Shared to other computers’.

6 – SSH

$ ssh pi@raspberrypi.local (password = raspberry)


Once its booted you should now be able to open up the terminal, and using ping Raspberry pi.local you can see the RPi’s IP address.
Using this address in terminal type

ssh pi@


Code Everyday

What’s the crack jack?

Inspired by the code everyday article and by my new site/blog, I decided to follow the idea.

I Googled it and I found several similar ideas like #100DaysOfCode.
I found that people that were following the #100DaysOfCode was too obsessed to just commit and have the green line on GitHub and I found several different rules as well.

With that, I decided to change the rules and create my own version of one hundred days of code. And create something that was not just about commit every day.

I decided to set a couple of rules for myself:

  1. I set up a limit one hundred days.
  2. I must write code every day. I can write docs, or blog posts, or other things but it must be in addition to the code that I write.
    Here I count my Blog, my site, Github, RackHank and any draft on my whiteboard.
  3. It must be useful code.
  4. All code must be written before midnight.
  5. The code must be Open Source and up on Github.
  6. I can write in different languages and can do different projects.
  7. I’ve decided to code on the weekends as well

My plan is to create a habit of code every day.

I have been interested in changing the way I schedule my daily tasks. I used to get at home from work and pick up any of my side projects, whenever I could, even if I felt too tired to only grasp a few lines of code, and ultimately my projects didn’t get too far. As a good developer, I started several things and I never finished them …

Is exactly what I want to change with this!

Recently I found “Not learning at least 5 hours per week is the smoking of the 21st century.”  The 5-hour rule

With luck in one hundred days, I’m going to make a new post with the results.

Hello World Blog

Hey you!

I’ve been thinking an about creating a blog for some time, and today I finally Get up the courage to start something.

If a busy guy like Brendan Eich´s keeps a blog, why I can not have mine too?

The idea of this blog is something more personal, my point of view on a particular subject and something portfolio-style.
This blog is devoted to the community Nerd or Geek, for those who like IT and coffee, and containing random thoughts and opinions on things that interest me.

I’m gonna write about cool stuff I’ve worked on like, code, big data, Software Architecture, process, random picks at development or anything else and share nice hacks I’ve done or found.

Hope it’s gonna be somewhat useful for someone else than me.

As far as possible I will try to enhance and improve my English. I’m not native English speaker. Sorry about that!

The blog uses a WordPress theme and is hosted by Godaddy