Setup the Wifi password for a many iPads with KeyboArduino.
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:
- 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.
- 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:
- An Arduino microcontroller can pretend to be a USB keyboard.
- 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
- An Arduino UNO V3 microcontroller.
- A USB cable.
- A USB to Lighting adaptor.
- A Mac computer. You can do all this with a PC, but the instructions are Apple specific.
- 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
- On the Arduino IDE go to Sketch->Add File … and select the file named `USBKeyboard.h`
- 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.
- Now, on the Terminal, find the file Arduino-keyboard-0.3.hex. This file is in the folder
firmware
from the downloaded resources. - 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.
- In the Terminal, find the file `Arduino-usbserial-uno.hex`
- 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!