Introduction: Brainwaves Bend a Fork

In the 1970's, a psychic onymous Uri Geller introduced smooch-bending using his mental powers and became famous for it.

Comfortably, I don't claim to follow a psychic, simply I idea it would be fun to be able to bend a spoon or fork using my brainwaves, and this would glucinium a good first off project utilizing mental powers. After some explore on the Internet, the idea improved into a plan and then a projection. A NeuroSky headset can sense brainwaves and transmit them to an Arduino microcontroller victimisation Bluetooth. The Arduino can drive a servomechanical motor which pulls a thread connected to a fork, bending information technology.

If you're not familiar with these devices, the following golf links may be useful:

Getting started with Arduino https://www.arduino.mil/nut/Guide

https://web.instructables.com/A-Beginners-Pass over-to...

Online Arduino category: https://www.instructables.com/Arduino-Class/

NeuroSky's website: https://hive away.neurosky.com/pages/mindwave

hypertext transfer protocol://developer.neurosky.com/docs/doku.php?id=sta...

Differences between the 4 models of MindWave: http://support.neurosky.com/kb/mindwave-mobile-2/...

NeuroSky's Arduino project (it uses a BlueSMiRF Blluetooth module instead of the HC-05 I used. The sample code (which runs on an Arduino) should work okay regardless of the type of Bluetooth module.):

http://developer.neurosky.com/docs/doku.php?id=min...

There are 4 main stairs in this protrude:

  1. Configure the HC-05 and pair IT with the MindWave.
  2. Make the branch mechanism.
  3. Wire the Arduino.
  4. Upload the Arduino sketch (the code) and apply it.

Supplies

PARTS for the electronics:

  1. NeuroSky MindWave Mobile 2 headset and 1 AAA assault and battery
  2. A computer (I used an Orchard apple tree iMac)
  3. Arduino Uno Beaver State other model and its USB cable
  4. HC-05 Bluetooth module
  5. Servo efferent (I used a Solarbotics HXT900 Micro Servo)
  6. Breadboard and bread board wires
  7. Green LED and yellow LED
  8. 2 x 330 ohm resistors
  9. 2 x 1K ohm resistors
  10. 2 x 2k Georg Simon Ohm resistors
  11. Great power source, or so 5 volts, such as 3 AA batteries in a holder

PARTS for the fork mechanism:

  1. Small box surgery case to hold the branch out and control system. It could be rigid plastic, wood or metal
  2. Plastic fork or spoon
  3. Bolt and testis to attach the fork
  4. Wriggle-tie to attach the servo
  5. Thread to link the fork to the servo, about 12" long (30 centimeter)
  6. Q-tip (with the ends cut off) or something like-minded to hold the wander in a proficient pose

TOOLS

- Drill to make holes in the fork and box

- File to make the fork flexible

- Glue to hold the Q-tip in place

- Screwdriver

Step 1: Configuring and Conjugation the HC-05, Part 1: Wiring the Arduino

A a few websites describe how to set up an HC-05 Bluetooth module for the NeuroSky MindWave, but none of the methods worked for me. Maybe the reason was that my HC-05 has a newer version of firmware? Or my MindWave is a newer model? Anyway, I researched other Internet websites for info well-nig configuring and pairing an HC-05, and eventually figured come out of the closet how to do it.

Photos of the front and noncurrent of an HC-05 are shown.

Plug the HC-05 into the breadboard and connect it to the Arduino as described infra and shown in the photograph.

  1. HC-05's RXD to pin 11 via a potential divider made from 2 resistors,
  2. TXD to pin 10,
  3. GND to GND,
  4. EN to pin 9 via a potential difference partition made from 2 resistors.
  5. Do not tie HC-05's VCC yet.

The reasonableness for using voltage dividers is that HC-05's RXD and EN tend to dice after getting 5 volts for some time, and the voltage should be reduced to 3.3 volts. The potential divider consists of a 1K ohm resistance with one end associated to Arduino's 5 volts and the other end to a 2K ohm resistance with its other end connected to GND. Ii voltage dividers are needed, one for RXD and the other for EN.

Step 2: Configuring and Pairing the HC-05, Part 2: the Write in code and HC-05 Commands

Find the sticker along the MindWave showing the Bluetooth address. This will be needed in one of the HC-05 commands. If your MindWave doesn't have a prickle, NeuroSky's Arduino undertaking describes how to determine it, low the title "Determining the MAC address of your MindWave Mobile" in this website:

http://developer.neurosky.com/docs/doku.php?id=mindwave_mobile_and_arduino

1. Start the Arduino app connected the computer.

2. Relate the Arduino's USB cable to the computer. The green unclouded on the Arduino should get on.

3. Download the cartoon .ino file located at the end of this step, or copy the pursuing code, which relays data between Arduino's Serial Monitor and the Bluetooth module, and paste it into a new Arduino sketch. (When writing these instructions, the instructables organisation sometimes born part of the #include statement located at the first of the code. It should be #admit followed aside a near arrow < followed past SoftwareSerial.h followed away a riight pointer >).

I found the code in the following YouTube video:

https://www.youtube.com/watch?v=lTvYbnr6aBo

#include<SoftwareSerial.h>
SoftwareSerial BT(10,11);

invalidate setup()

{

pinMode(9,OUTPUT);

digitalWrite(9,HIGH);

Serial.begin(38400);

BT.begin(38400);

Serial publication.println("Bluetooth AT command mode");

}

void loop()

{

if(BT.available())

Ordering.write(BT.read());

if(Serial.available())

BT.write(Serial.record());

}

4. Upload the sketch.

5. Patc pressing the small button ended the EN pin on the HC-05, connect HC-05's VCC to Arduino's +5v and keep the button pressed for few seconds until the warning light on the HC-05 begins to blink on for 2 seconds and off for 2 seconds.

6. Open the Arduino's Serial Monitor (crest right corner in the Arduino app window) on the computer and set the options in the lower right-minded recession to "Both NL & Atomic number 24" and "38400" baud rate order.

7. Click inside the input line of the Ordered Monitor window. Type AT on the computer's keyboard and closet Return. If the response is "Satisfactory" then retain. If IT's non "OK" then seek again. It sometimes doesn't go the early time.

8. Power-on the MindWave. The light beside switch is steady blue on the MindWave Raisable 2. Earlier models of the MindWave carr differently.

9. Eccentric AT commands As shown below. The response should constitute "OK" aft each mastery.

AT+UART=57600,0,0 Defines the baud rate used by the MindWave.

AT+Function=1 Sets the HC-05 American Samoa Master rather than Slave.

AT+PSWD=0000 Sets the password used by the MindWave.

AT+CMODE=0 To connect the HC-05 to a specific device.

AT+Assort=0 Specifies the Sort out of Device.

AT+INQM=1,9,48 Sets parameters for pairing.

AT+INQ to see if the HC-05 recognizes the MindWave. This may take 15-20 seconds to find the MindWave. One of the displayed devices should have the same address As on the MindWave sticker, in the data formatting xxxx:xx:xxxxxx. This address is used in the following 3 commands (shown A addr) except the colons mustiness be replaced by commas.

AT+PAIR=addr,30 (Strangely, there was no more "OK" reply here.)

AT+Tie down=addr (The red light on HC-05 distillery blinks on for 2 seconds and off for 2.)

AT+Linkup=addr

10. The warning light on the HC-05 should make 2 quick blinks all 3-4 seconds. The prototypal time I did the LINK command, the warning light didn't change. So I double-checked the wire pins were pushed down properly on the Arduino and breadboard, pulled out the +5v wire from the HC-05, did maltreat #5, and typed the Brace, BIND and LINK commands. This time, the scarlet white changed to 2 quick blinks every 3-4 seconds. This means the devices are paired. Next fourth dimension you use the devices, they will duet automatically within a couple of seconds.

11. Disconnect the HC-05's TXD wire from the Arduino's pin 10 and colligate it to the Arduino's RX (tholepin 0), disconnect the HC-05's wires from the voltage dividers and absent them, and remove the resistors used as the voltage dividers. The wiring should now be as shown in the photo.

12. Close the Serial Monitor.

13. World power-dispatch the MindWave.

14. Disconnect the USB cable from the Arduino or the computing device.

15. Quit the Arduino app.

Step 3: Making the Branch Mechanics

The commencement step is to find a suitable box or character. There are some possibilities, such atomic number 3 a candy or medication box, the bottom split up of a rectangular vitamin container operating room TUMS antacid container, etc.

Adjacent, file the grip of the spoon or fork to make it flexible. My fork had a ridge on each broadside of the handle. To keep the fork steady while filing the ridges slay, I clamped a knife to a micro wooden plank as shown in the pic, and held the branch out on the board and against the back of the stab blade spell filing. This worked well.

The construction of the mechanism is straightforward, as shown for my unit in the photo.

Tread 4: Wiring the Arduino

Starting with the circuit after measure #11 in Configuring and Mating the HC-05 (supra) the additive wiring should be as described and shown in the photo.

  1. One wire of a 330 ohm resistance to pin 2 and the other wire to the long wire of the green LED. The short wire of the jet LED goes to GND on the bread board.
  2. One electrify of a 330 ohm resistor to pin 4 and the other wire to the monthlong wire of the yellow LED. The short-stalked telegram of the yellow Light-emitting diode goes to GND on the breadboard.
  3. Pivot 9 goes to the betoken telegram of the servo. It's the yellow-bellied one.
  4. Orange conducting wire of the servo goes to the plus connection of the separate power source.
  5. Brown wire of the servo goes to GND on the breadboard.
  6. The negative connection of the separate power beginning goes to GND on the breadboard.

To double-check, the following parts should Be connected to the breadboard's GND: both LEDs, the servo, the Arduino's GND, the separate power source, and the HC-05. And the following parts should be connected to the bread board's plus power: the Arduino's +5V and the HC-05.

Step 5: Uploading and Using the Sketch

1. Start the Arduino app on the computer.

2. Link up the Arduino's USB cable's length to the computer. The HC-05 should make rapid blinks.

3. Connect the servo's power wires to a separate power source, and connect the harmful of that power source to the Arduino's or bread board's GND.

4. Download the sketch .ino filing cabinet (set at the rattling ending of this step) or written matter the following computer code and paste information technology into a rising Arduino sketch. (When writing these instructions, the instructables system sometimes dropped part of the #include statement located at the beginning of the encrypt. It should be #include followed aside a left arrow < followed aside Servomechanism.h followed by a riight arrow >).

//
// LEDs on and servo moving when Attention is high

// December 1, 2022

// Arduino with HC-05 Bluetooth and NeuroSky MindWave Mobile 2

// Chicken LED on when Attn more than 50

// Green LED on when Attn more 70

// Servo moves 90 degrees when Attn is more 50

#let in<Servo.h>

#specify BAUDRATE 57600

#define YLED 4

#specify GLED 2

////////// Variables

Servo myservo;

byte payloadData[32] = {0};

byte Attention[5]={0};

byte checksum=0;

byte generatedchecksum=0;

int Plength,Temp;

int Att_Avg=0;

int k=0;

signed int j=0;

////////// Arduino setup

nullif setup()

{

Serial.begin(BAUDRATE);

pinMode(YLED, OUTPUT);

pinMode(GLED, Yield);

Order.println("Medium Attention Values");

myservo.seize(9);

myservo.write(0);

delay(15);

}

////////// Read data

byte ReadOneByte()

{

int ByteRead;

while(!Serial.available());

ByteRead = Serial.read();

return ByteRead;

}

////////// Intense program

void loop topology()

{

////// Search sync bytes and read data

while (1)

{

if(ReadOneByte() == 170)

{

if(ReadOneByte() == 170)

{

Plength = ReadOneByte();

if(Plength == 32)

{

generatedchecksum = 0;

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

{

payloadData[i] = ReadOneByte();

generatedchecksum += payloadData[i] ;

}

generatedchecksum = 255 - generatedchecksum;

checksum = ReadOneByte();

////// Obtain Attention data and calculate an average

if(checksum == generatedchecksum)

{

if (payloadData[28]==4)

{

if (j<4)

{

Attention [k] = payloadData[29];

Temp += Attention [k];

j++;

}

else

{

Att_Avg = Temp/4;

////// Display average Attention in Serial Monitor, go up servo, and light LEDs

Serial.println(Att_Avg, DEC);

// The succeeding 2 statements would move the servo based on average Tending level.

// Attention level is betwixt 0 and 100, moving servosystem between 0 and 100 degrees.

// But they are instantly comments because I decided to move the control system 90 degrees

// when average Attention is higher than 50.

// myservo.write(Att_Avg);

// delay(15);

if (Att_Avg>50)

{

digitalWrite(YLED, Squeaky);

myservo.write(90);

delay(15);

}

else

{

digitalWrite(YLED, LOW);

myservo.write(0);

delay(15); }

if(Att_Avg>70)

{

digitalWrite(GLED, HIGH);

}

else

{

digitalWrite(GLED, LOW);

}

j=0;

Temp=0;

}

}

}

}

}

}

}

}

5. Disconnect the HC-05's TXD wire from the Arduino's RX (PIN 0), upload the chalk out, and reconnect this RX wire.
6. Open the Nonparallel Monitor. Check that the baud rate is 57600.

7. Power-connected the MindWave. Later on a some seconds the HC-05 should make 2 quick blinks every 3-4 seconds, indicating the devices are paired.

8. Put the MindWave along your head. It should like a sho send on data to the Arduino. The Serial Monitor should show the Attention level all few seconds, the unhealthy LED should turn connected and the furcate stoop to when Attention is more than 50, and the green LED turn connected when Attention is more than 70.

9. When finished, close the Serial Monitor.

10. Power-bump off the MindWave.

11. Disconnect the USB cable length from the Arduino operating theater the computer.

12. Quit the Arduino app.

13. Disconnect the servo's power wires from the differentiate power seed.

Maximizing the Care Point

Ways to maximize the Aid level vary for different people. Here are some suggestions:

  1. Concentrate connected reading the heel of ingredients along a food container.
  2. Memorize some nutrition facts on a food container.
  3. Count backwards.
  4. Do arithmetic operations in your chief.
  5. Listen to a rap Sung and try to realize the words.
  6. Learn something in a words you'rhenium non fluent in.

    Important Notes

    1. If your HC-05's firmware is interlingual rendition 2 operating room 3, my understanding is that the command AT+INIT is needed before the AT+INQ command. My HC-05's firmware is version 4.0-20220815, and the AT+INIT command was not recognized. To check your HC-05's version, type this command: AT+VERSION
    2. If you press Arduino's Reset button, this restores the HC-05's settings to the factory defaults. All the pairing steps testament bear to be recurrent.
    3. If the HC-05's TXD is not disconnected from the Arduino's RX before a sketch is uploaded, an error message will appear at the bottom of the Arduino app's window on the computer screen. The following fault message is recurrent 10 times: avrdude: stk500_recv(): programmer is non responding avrdude: stk500_getsync() endeavour 1 of 10: non in sync: resp=0x00
    4. If using a servo, it needs a separate power source so much as 3 1.5 volt batteries. The GND of the Arduino must represent connected to the minus of the external superpowe source. Without external power, thither seems to be insufficient power from the USB source and the HC-05 loses its pairing when the servo activates. It pairs afterward a couple of seconds so unpairs following time the servo activates.

    Later Enhancements

    When I researched NeuroSky projects connected the Internet, information technology was fascinating to see which signals the developers chose to use in their projects. Most projects used entirely Attention and a few also utilized Meditation and/operating room Blinking.

    I plan to experiment with these other signals to control a golem vehicle Oregon a drone.

    Be the First to Contribution

    Recommendations

    • Anything Goes Competition 2022

      Anything Goes Contest 2022