Setup the Wifi password for a many iPads with KeyboArduino.

Dr. Saint-Jean

If you are setting a lot of iPads (My record is 350), typing in the WiFi password adds a lot of work. I have seen two solutions:

  1. Apple Configurator: With Apple Configurator you can connect as many iPads as you have USB conectors and setup the Profile. It’s effective, but very technical. Apple Configurator is not the friendliest software by Apple.
  2. Type each individual password and then allow the iPad to grab the profile from the MDM. Again, lots of additional work.

When we deployed iPads at MS137 in Queens, I sucesfully managed another way! Also somewhat technical, but a lot more fun than Apple Configurator.

I programed an Arduino microcontroller to act as a keyboard. Once plugged into an iPad, it automatically types the password on the iPad.

This is possible for two reasons:

  1. An Arduino microcontroller can pretend to be a USB keyboard.
  2. With the right adaptor, you can connect any USB keyboard into the iPad and it will receive the keystrokes.

Simple, right? There are of course a few nuances that make this a little bit harder than one would think.

Here is a step-by-step guide to building your own KeyboArduino.

A Note Before We Begin

This project requires some pretty advanced computer usage. You will need to input commands into the Terminal and install some open source packages in your Mac. In particular, you need to have Homebrew installed and up to date on your machine.

What You Need

  1. An Arduino UNO V3 microcontroller.
  2. A USB cable.
  3. A USB to Lighting adaptor.
  4. A Mac computer. You can do all this with a PC, but the instructions are Apple specific.
  5. Download the additional resource files onto your Desktop.

Step 1: Arduino Programming Enviroment Setup

The Arduino IDE allows you to program your arduino. The program we are going to use is a simple Mac App. Download and follow instructions here.

Once you are done, run the Arduino IDE.

Step 2: Install Some Additional Libraries

  1. On the Arduino IDE go to Sketch->Add File … and select the file named `USBKeyboard.h`
  2. Do the same for the file named `hid_keys.h`

Step 3: Program Your Arduino Board

This is the easy part! The code is really simple. Copy and paste this code into your Arduino IDE.

/* 
* KeyboArduino
* Change the wifi password before deploying
*/
#include "USBKeyboard.h"
const char* password = "WIFI Password Goes Here";
int index = 0;
bool finished = false;
USBKeyboard keyboard;
void setup()
{
Serial.begin(9600);
delay(1500);
}
void loop()
{
if (finished) {
delay(200);
return;
}
keyboard.print(password);
finished = true;
}

Plug in your Arduino microcontroller and in the Arduino IDE select the Upload button.

Now your Arduino is programmed!

Step 4: The Really Obscure Step

This step is obscure. Because your Arduino can either be programmed using the USB or be a Keyboard (not both at the same time), we now need to change the Arduino behavior.

First, short the RESET and GND pins.

  1. Now, on the Terminal, find the file Arduino-keyboard-0.3.hex. This file is in the folder firmware from the downloaded resources.
  2. In the terminal imput the commands:
%sudo dfu-programmer atmega16u2 erase
%sudo dfu-programmer atmega16u2 flash --debug 1 Arduino-keyboard-0.3.hex

If all went well, your Mac will now recognize a new Keyboard!

Step 5: Plug Everything In

If you followed the steps: you are done! If you are only reading this: you would be done if you followed the steps! Either way:

Unplug your Arduino from the computer, and connect the USB to the Lighting adaptor.

Going Back to Programming Mode

In step 4, we switched the Arduino to Keyboard mode. To re-program your Arduino you will need to switch it back to Programming mode. You will need to to this, for example, to change the wifi password.

  1. In the Terminal, find the file `Arduino-usbserial-uno.hex`
  2. In the terminal imput the commands:
%sudo dfu-programmer atmega16u2 erase
%sudo dfu-programmer atmega16u2 flash --debug 1 Arduino-usbserial-uno.hex

Now you can program your Arduino again!

Final Thoughts

Ok, so setting all this up seems like a lot of work. I say, wait until you have to type a 30 character password 300 times on a soft keyboard!

The nerd in me really enjoyed building this and I smile every time my KeyboArduino types a password on an iPad.

I’m working on a simpler version that will skip Step 4 and work with Arduino boards other than the Uno. Hope to have some good news soon!

    Dr. Saint-Jean

    Written by

    Co-founder and CEO at @school4one (http://www.school4one.com)

    Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
    Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
    Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade