Categories
News

Arduino & Delphi Cosplay

Me with a Spartan Boba Fett, but I thought he was more of a Delphi Dude ?(FanX Salt Lake City - 2018)
Me with a Spartan Boba Fett. I thought he was more of a Delphi Dude (FanX Salt Lake City – 2018)

Cosplay (aka costume-play) takes the fun and imagination of childhood dress-up to extreme levels only justifiable by an adult! Not only is it expensive, and needs a large time commitment, but it is rarely comfortable.

Comic conventions are the usual place to find cosplay, but Halloween is also a good excuse for some cosplay fun. I’m a huge fan of creative cosplay and love getting my picture with cosplayers.

In writing this post I realized I am frequently attaching LEDs to my face.

The V character from Cyberpunk 2077. Cosplayer Maul. photo by eosAndy.
The V character from Cyberpunk 2077. Cosplayer Maul. photo by eosAndy. His cosplay is much better than mine.

This year I am putting together my Ultimate Cyberpunk cosplay. The first part is a jacket based on the main character from the game Cyberpunk 2077 by CD Projekt RED. Neuromancer, by William Gibson, inspired the Cyberpunk 2020 RPG by Mike Pondsmith. They both inspired this unreleased video game Cyberpunk 2077.

I’m a big fan of both the book and the original RPG and am looking forward to the video game. I combined elements from all three sources for my cosplay. The character V is more of a Street Samurai / Solo, while I wanted to go for more of a Decker / Netrunner (a little Shadowrun RPG influence in there too).

At this point the secret is out, I’m a huge nerd. I love Role Playing Games, and Cyberpunk & Shadowrun are my favorite genres.

I didn’t have my RGB Shades in time for Salt Lake FanX, so I justed glued some extra LEDs (NeoPixel 4×4 grids) to my face. They represent cybernetic enhancements, which is why I left the wires exposed. I used an Arduino MEGA 2560 by ELEGOO as the controller. It also controlled the string of NeoPixel lights in the collar. I attached a Bluetooth keyboard to one wrist and an Android Pixel phone to the other. The phone was decorative for now.

Later I got my RGB LED Shades which will become the key to my outfit for this Halloween. The RGB LED Shades use an Arduino Mini as the brains. I added an HC-06 Serial Bluetooth module to control the leds remotely.

After soldering the HC-06 onto my shades I can power them up and pair my Android phone with the HC-06 module. One note about my soldering is that if you look you will see that it is connected to two analog pins instead of digital pins. On most Arduinos the analog pins can double as digital pins (see the Pinout).

Android Bluetooth Pairing Dialog
Android Bluetooth Pairing Dialog

After that, a TBluetooth component is able to open a socket to the shades. Start the pairing with Bluetooth1.DiscoverDevices( 5000 ); In the DiscoveryEnd event handler the following code will open a socket to the HC-06 module (Thanks to Boian Mitov for the basis of this code):

var
  ADevice   : TBluetoothDevice;
  AService  : TBluetoothService;
begin
  for ADevice in ADeviceList do
  begin
    // HC-06 is the name of the bluetooth device
    if ADevice.DeviceName = 'HC-06' then 
    begin
      Bluetooth1.Pair( ADevice );
      for AService in ADevice.LastServiceList do
      begin
        // FSocket is a TBluetoothSocket with larger scope
        FSocket := ADevice.CreateClientSocket( 
            AService.UUID, False );
        If Assigned( FSocket ) then
        begin
          FSocket.Connect;
          Break;
        end;
      end;
      Break;
    end;
  end;
end;

Once the socket is open you can send characters with this code.

FSocket.SendData( TEncoding.UTF8.GetBytes( 'D' ));

It is so easy to work with Classic Serial Bluetooth in Delphi (or C++Builder) and the TBluetooth component. You even could send a whole string or other binary data. For this project a single character was all I needed to change modes on the shades. A single character is also easier to process on the Arduino side. (Technically Bluetooth Classic works on all platforms, but on iOS you need special approval from Apple on a per app basis.)

RGB Rio Shades
I’m wearing the Rio RGB Shades with the Delphi powered controller on my Android phone

I took my RGB Shades with me to Sao Paulo Brazil for the 10.3 Rio preview. Even though the Bluetooth worked before the conference, my phone couldn’t make the connection on stage. When I opened my phone’s Bluetooth connection window it was obvious that with 750+ people in attendance there were a few hundred Bluetooth devices broadcasting on the same wavelength.

David Millington kicking off the Keynote
David Millington kicking off the 10.3 Keynote

My next project involves Bluetooth LE with these RGB LED Steampunk Goggles.

Jim wearing LED Steampunk Goggles
RGB LED Steampunk Goggles

I built them a year ago from an AdaFruit kit. Later I added a Bluetooth LE Module to make them controllable. Unfortunately, my soldering didn’t hold up and I need to rebuild them. This makes them both my previous and next cosplay project.

RGB LED Goggles, a horse mask, and a Los Angeles Kings hockey jersey
RGB LED Goggles, a horse mask, and a Los Angeles Kings hockey jersey (don’t ask)

I’m considering salvaging the NeoPixels and rebuilding them with an ESP32 microcontroller. The ESP32 is a little larger than the original Trinket microcontroller. This is because it has integrated Bluetooth LE, WiFi, and more pins. I’d also like to get some 50% mirrors to create an infinite LED tunnel effect (I’ll post pictures when I get them – it is really amazing).

I met Star Lord!
I met Star Lord!

I’ve worked with the TBluetoothLE component before and it is even easier to work with than TBluetooth. So I’m really looking forward to this project.

On the Arduino side, you can use the Arduino IDE and flex your C programming skills. Or you can do like I usually do and use Visuino by Boian Mitov of Mitov Software. It provides a visual drag and drop interface for programming Arduino devices. It won the Embarcadero Cool App contest in April 2017 as Boian used Delphi to develop Visuino. Boian also recently added RGB LED Shades support to Visuino (along with unboxing and assembly videos.)

Visuino makes Arduino and LED RGB Shade development easy. It is an Embarcadero Cool App developed with Delphi!
Visuino makes Arduino and LED RGB Shade development easy. It is an Embarcadero Cool App developed with Delphi!

I think Boian is a great guy who makes some great technology. Most of it has a free version and the commercial prices are very reasonable too. He is always very helpful as well.

Boian and Jim at the 2017 SoCal CodeCamp in Los Angeles
Boian and Jim at the 2017 SoCal CodeCamp in Los Angeles

So what’s next (after the Bluetooth LE RGB Steampunk Goggles obviously)? I’m working on a design for an electronic physical polyhedral die with Bluetooth LE. So you roll a physical die of a single size and it can become any number of sides you need, all controlled via your phone. Did I mention how much of a nerd I am?

I love polyhedral dice
I love polyhedral dice