We’ve been getting asked a lot about how you can connect the Nuimo to Arduino. We have also been trying to think of a good way to get everyone in the office to our morning stand-up meeting on time and Voila! — the perfect Arduino project occurred to us. Since building a hardware startup is…hard, we wanted to share with you one of the fun projects we've done along the way with Nuimo- these kinds of tangential explorations serve as a reminder to our team why hardware is awesome.

We recently attached our office Nuimo to an Arduino in order to automate the banging of a shiny new office gong to call the team to attention. Below we have shared step-by-step instructions on how you can hook up your own gong, in hopes that you will create and share other fun (and a little weird) projects using Nuimo.

What you need

To make the gong you need a few simple materials from a hardware store or maker space and a few hours of time. This is just one method of building the mechanism but could easily be reconfigured or hacked for a variety of results.

Mechanical Parts

Gong

Clamp

Mallet

12 M3 Screws 40MM

8 M3 Screw Nuts

4 Washers

1 Motor Coupling

Cable Tie

Piece of Acrylic ~55x45mm

Screwdriver

3D Printer

Electrical Components

Step-by-Step Assembly of Mechanism

Step 1: First begin by printing the 2 .stl files for the motor holder and mallet holder.

Link to Motor Holder File

Link to Mallet Holder File

When printing, we recommend that you use a 100% fill because the motor is fairly heavy. Likewise, then you don't have to worry about printing a support structure.

Step 2. Take the small piece of acrylic and drill 4 holes as shown below.

Step 3. Attach the acrylic plate using 4 of the screws, 4 washers and 4 screw nuts. Then attach the motor to the motor holder with 4 additional screws, placing the motor coupling over the shaft of the stepper motor once it has been mounted on the motor holder.

Step 4. Attach both halves of the 3D printed mallet holder around the handle of the mallet and secure with 4 screws and screw nuts.

Step 5. Thread the motor holder through the hanging rope of the gong, taking care to place it in the appropriate groove of the holder. Then attach the mallet holder shaft to the motor coupling so that the mallet hangs just in front of the face of the gong.

Step 6. Slide the motor holder over the shaft of the clamp and affix the clamp to the table with the shaft and tension bar (or handle of your clamp) pointing up.

You're done with this part! Now assemble the electronic components.

Assembly of Electronics

For our gong, we used a stepper motor that gives you the option to rotate the shaft at a precise angle To drive the stepper motor we use an EasyDriver — Stepper Motor Driver that allows us to give exact control over the ‘step angle’ or what direction and how much the motor rotates.

Additionally, we used a Bluetooth Low Energy (BLE) Module to allow our Arduino Uno to act as a peripheral device (since central mode is not possible). More on peripheral and central devices can be found on our recent post about BLE.

Step 1. To connect the electronics for the gong, we used the following schematic.

Step 2. With the code there are two things that must take place. First, the Arduino needs to be flashed with the firmware to advertise in peripheral mode. We used adafruits libraries to get the gong up and running in just a few minutes.

// This version uses call-backs on the event and RX so there's no data handling in the main loop!



#include <SPI.h>

#include "Adafruit_BLE_UART.h"



#define ADAFRUITBLE_REQ 10

#define ADAFRUITBLE_RDY 2

#define ADAFRUITBLE_RST 9



int dirpin = 3;

int steppin = 4;

int buttonpin = 7;

int polling = 0;



Adafruit_BLE_UART uart = Adafruit_BLE_UART(ADAFRUITBLE_REQ, ADAFRUITBLE_RDY, ADAFRUITBLE_RST);



/************************************************************/

/*!

This function is called whenever select ACI events happen

*/

/************************************************************/

void aciCallback(aci_evt_opcode_t event)

{

switch(event)

{

case ACI_EVT_DEVICE_STARTED:

Serial.println(F("Advertising started"));

break;

case ACI_EVT_CONNECTED:

Serial.println(F("Connected!"));

break;

case ACI_EVT_DISCONNECTED:

Serial.println(F("Disconnected or advertising timed out"));

break;

default:

break;

}

}



/************************************************************/

/*!

This function is called whenever data arrives on the RX channel

*/

/************************************************************/

void rxCallback(uint8_t *buffer, uint8_t len)

{

Serial.print(F("Received "));

Serial.print(len);

Serial.print(F(" bytes: "));

for(int i=0; i<len; i++)

Serial.print((char)buffer[i]);



Serial.print(F(" ["));



for(int i=0; i<len; i++)

{

Serial.print(" 0x"); Serial.print((char)buffer[i], HEX);

}

Serial.println(F(" ]"));



/* Echo the same data back! */

uart.write(buffer, len);

}



/************************************************************/

/*!

Configure the Arduino and start advertising with the radio

*/

/************************************************************/

void setup(void)

{

Serial.begin(9600);

pinMode(dirpin, OUTPUT);

pinMode(steppin, OUTPUT);

pinMode(buttonpin,INPUT);

while(!Serial); // Leonardo/Micro should wait for serial init

Serial.println(F("Gong is ready"));



uart.setRXcallback(rxCallback);

uart.setACIcallback(aciCallback);

uart.setDeviceName("BLEGong"); /* 7 characters max! */

uart.begin();

}



/************************************************************/

/*!

Constantly checks for new events on the nRF8001

*/

/************************************************************/

void loop()

{

uart.pollACI();

polling = uart.read();



int i,j;



if((polling == 120) || (digitalRead(buttonpin) == HIGH)){



Serial.println("Gong");

polling = 0;



digitalWrite(dirpin, HIGH); // Set the direction.

delay(300);





for (i = 0; i<65; i++) // Steps für Umdrehung

{

for (j = 0; j<2; j++) // Umdrehungen des Motors angeben

{

digitalWrite(steppin, LOW); // This LOW to HIGH change is what creates the

digitalWrite(steppin, HIGH); // "Rising Edge" so the easydriver knows to when to step.

delayMicroseconds(1000); // This delay time is close to top speed for this

}

}

// particular motor. Any faster the motor stalls.



digitalWrite(dirpin, LOW); // Change direction.



for (i = 0; i<65; i++) // Steps für Umdrehung

{

for (j = 0; j<2; j++) // Umdrehungen des Motors angeben

{

digitalWrite(steppin, LOW); // This LOW to HIGH change is what creates the

digitalWrite(steppin, HIGH); // "Rising Edge" so the easydriver knows to when to step.

delayMicroseconds(1000); // This delay time is close to top speed for this

}

}

}

delay(100);



}

Step 3. Next, a computer or smartphone in central role has to establish a connection with the Arduino and send a command. Once a command is sent the Arduino can drive the stepper motor to activate the gong.

Note: Since we don’t ship the Nuimo until October, you can connect the gong to your Smartphone or Computer using the following:

Android and iOS Smartphones by downloading nrf UART connect to “BLEGong” and send “x”

OSX Computers by downloading LightBlue connect to “BLEGong” and send “x”

Conclusion

Once you have connected the electronics, mechanism and code for the gong you are ready! You can see the results below:

The gong has been working well for us, everyone is on time to meetings so far. We can't wait to see what kinds of things you build with Nuimo. Please feel free to share them with us at hi@Senic.com.

This is Part 4/8 in the series “Building a Hardware Startup.” Check back for Part 5 about Design for Manufacturing.