Introduction: The Depression Bot 5000

About: I'm a full stack developer and I make useless robots in my free time

If you've ever come home feeling a bit too happy and full of yourself, then this project is for you!

Within minutes the Depression Bot 5000 will send you back to the comforting abyss of sadness that we all know and love.

In this Instructable I will guide you in recreating my invention, the Depression Bot 5000, by using the Arduino as a slave to a Raspberry Pi to roast you when the lights turn off. (Wow depression and slavery in one tutorial!?)

Please subscribe to my YouTube channel Bolillo Kremer to see this robot ruining my day and for more useless robot videos in the future!

Supplies

Isn't the anticipation to be depressed killing you? Then quickly go grab the following items...

  • Arduino
  • Raspberry Pi
  • Solar Panel or LDR Sensor
  • Tissues (to dry your tears)

Step 1: See What You're Getting Yourself Into

Watch this video to give you a better understanding of what you might be getting yourself into.

Step 2: The Circuit

The circuit for this project seems way too good to be true, but it's not.

Literally all you have to do is plug the positive wire from your Solar Panel into A0 on your Arduino and the negative wire into GND. No additional components are required because small solar panels give off a very small voltage.

As long as the solar panel gives off less than 5 volts, we will be free from any danger of damaging the Arduino.

Step 3: Arduino Code

In the Arduino IDE we need to test how dark is dark enough to start ruining your life by testing the voltage of the Solar Panel.

The video above cuts to where the Arduino Code is running

This code prints out a value (voltage)

const float RefVolts = 5.0;            // 5 volts max
const int SolarPanel = 0;              // Analog Pin A0


void setup()
{
  Serial.begin(9600);
}
void loop()
{
  int val = analogRead(SolarPanel);
  float volts = (val/ 1023.0)*RefVolts;             //Calculates volts output
  Serial.println(volts);
}

Test it out by putting your hand over the Solar Panel or shining light into it.

The voltage should increase with the amount of light.

When you find the sweet spot of where you want the depression bot to take action, set that voltage to print out something along the lines of "Your day is being ruined".

In my example, if the voltage was below .40, it would print "Roasting..."

const float RefVolts = 5.0; // 5 volts max
const int SolarPanel = 0; // Analog Pin A0

void setup() { Serial.begin(9600); }

void loop() { int val = analogRead(SolarPanel); float volts = (val/ 1023.0)*RefVolts; //Calculates volts output Serial.println(volts);

if (volts <= 0.40) // When the lights are off { Serial.println("Roasting...");

}

if (volts > 0.40) // When the Lights are on { Serial.println("Subscribe to Bolillo Kremer on YouTube"); } }

Step 4: Installing Requirements on Raspberry Pi

I'm sorry in advance for everything you will have to go through in this step.

In your Raspberry Pi Terminal type the following code to install the Arduino IDE...

sudo apt-get install arduino -y

Then install nanpy and its firmware into your downloads folder with these commands...

cd Downloads
git-clone <a href="https://github.com/nanpy/nanpy">https://github.com/nanpy/nanpy</a>
git-clone <a href="https://github.com/nanpy/nanpy-firmware">https://github.com/nanpy/nanpy-firmware</a>

Now navigate to nanpy-firmware from Downloads and configure nanpy with these following commands...

cd nanpy-firmware/
./configure.sh

From here, navigate back to the Downloads folder and copy the nanpy sketch into the Arduino IDE...

cd ..
cd ..
cp -avr nanpy-firmware/ ~/sketchbook/libraries

Now to make nanpy run with python...

cd nanpy
sudo python3 setup.py install
sudo python setup.py install

Then make a folder on the Desktop called nanpy. You probably don't need to do this one by command but...

cd ..
cd..
cd Desktop
mkdir nanpy

Phew that was a lot. To make it all work, we need to install pygame with this one last command...

sudo apt-get install python-pygame

Congratulations on making it this far! At this point you probably don't even need the depression bot to make you feel uneasy.

Now just Upload the nanpy sketch to your Arduino using the Arduino IDE on the Pi.

(located in File> Sketchbook> libraries> nanpy-firmware> Nanpy)

Step 5: Programming the Raspberry Pi

All of your hard work is about to pay off!

After this long strenuous process, the dark comforting void of sadness is exactly what you need, right?

Writing the python script is very similar to writing the c++ code in the Arduino IDE...

In this python script we connect to the Arduino using nanpy and use pygame to play whatever audio we have in a continuous loop.

When the lights turn off, the audio will play.

When you turn them back on again the audio will start where it left off.

Be sure to save the python script in the nanpy folder that you created on your Desktop.

from nanpy import (ArduinoApi, SerialManager)
from time import sleep import pygame

pygame.init()

Roast = pygame.mixer.music.load("Roast.wav") SolarPanel = 0 RefVolts = 5.0 playing = True pygame.mixer.music.play(-1) pygame.mixer.music.pause()

try: connection = SerialManager() a = ArduinoApi(connection = connection) except: print("Failed to connect to Arduino")

try:

while True: val = a.analogRead(SolarPanel) volts = (val/1023.0)*RefVolts; print(volts)

if (volts >= 0.20 and playing == True): pygame.mixer.music.pause() print("Not Roasting") print("Music Paused") playing = False elif(volts >= 0.20 and playing == False): print("Not Roasting") elif(volts < 0.20 and playing == True): print("Roasting") elif(volts < 0.20 and playing == False): pygame.mixer.music.unpause() print("Roasting") print("Music Unpaused") playing = True else: print("Error")

except: print("ERROR")

</p><p>except: print("ERROR")</p>

Step 6: Ruining Your Life

In order to make the depression bot live up to it's name, we're gonna need to ask our friends to make fun of us.

I found out an easy way we can get them to roast us is by insulting them without any context.

After you have a decent amount of slander (or until you can't take it anymore) you will want to type them into this website and download them as an .MP3

https://ttsmp3.com/

Then use this website to convert your heart-breaking .MP3 into a .WAV using this website

https://audio.online-convert.com/convert-to-wav

Finally, put that .WAV in the nanpy folder along with your python script.

Step 7: Grab the Tissues (For Crying!)

Grab the tissues from your computer desk and be prepared to shed some tears as you run the Depression Bot 5000 program by opening the .py file from IDLE and going to Run> Run Module




Step 8: Subscribe to Bolillo Kremer

If you enjoyed this tutorial or enjoyed my invention of the Depression Bot 5000, or just enjoyed any part of this, please subscribe to Bolillo Kremer.

I will be making more funny robot projects very soon and I would really appreciate your support!

Thank you so much! I'll see ya on the next tutorial ;)