Giter Site home page Giter Site logo

balassy / useless-box Goto Github PK

View Code? Open in Web Editor NEW
95.0 14.0 32.0 625 KB

A useless box device with ESP8266 and Visual Studio Code.

License: MIT License

C 1.25% C++ 98.75%
esp8266 esp8266-arduino arduino-sketch vscode wemos-d1-mini proximity-sensor funny servo apds-9960

useless-box's Introduction

Smart Useless Box with ESP8266 and Gesture Sensor

A useless box made smarter with an ESP8266 microcontroller on a Wemos D1 Mini board and an APDS-9960 proximity sensor to give more funny responses.

Photo

YAUB (Yet Another Useless Box)?

Useless machines are not new, there are many versions available. You can create a simple one using a lever switch, however that will react always the same way. Using a programmable microcontroller you can create funny, unexpected responses, and by adding a proximity sensor you can surprise the user with actions before she would even turn on the switch!

This is a programmable useless box, so you have the option to implement additional reactions when you want to to further improve this funny little toy. What's more the used controller board has WiFi connectivity, so you can connect it to other online services (e.g. IFTTT) or smart assistants (Alexa, Cortana etc.).

Smart Useless Box in Action

Click the image below to see this box in action:

Smart Useless Box in Action

Hardware

The following hardware components are required to build this project:

  • 1 × Wemos D1 Mini board
  • 1 × APDS-9960 RGB, gesture and proximity sensor - there are multiple versions of this board, use one that follows the pinout of the SparkFun module to simplify wiring. I used this cheap one from AliExpress.
  • 2 × SG90 servo motors
  • 1 × Switch - you have to test this to ensure it flips easily and the servo is strong enough to flip it, so I bought mine in the nearest electronics hardware store.
  • 1 × 1kΩ resistance
  • Male pin headers:
    • 1 × 1x2 for the switch
    • 2 × 1x3 for the servo motors
    • 1 × 1x5 for the sensor
  • Prototype board or PCB - to create a shield for the Wemos D1 Mini.
  • Pin headers - to connect the shield to the Wemos D1 Mini.
  • Dupont cables or wires with connectors.
  • BluTack - to mount the wires and the controller board.
  • M3 screws - to mount the lids.

Wiring

The wiring is designed to create a custom shield for the Wemos D1 Mini ESP8266 microcontroller-based board, instead of soldering the cables directly to the board. In this way you can easily assemble the parts or even reuse them in the future.

Schematics

Schematic

PCB

PCB

The PCB was designed with Fritzing, and you can download the source file to further customize it to your needs.

You can also download the Gerber files which you can use to order the PCB from your preferred PCB manufacturer. (Note: I've created my prototype manually then documented it in Fritzing, so I have not tested this PCB yet.)

Software

The source code in this repo is created with Visual Studio Code using the Arduino plugin from Microsoft, but it should work with the Arduino IDE as well.

The code in this repository is preconfigured with the pin layout shown in the wiring diagram above, but if you decide to connect the parts to different pins, you have to update the values in the config.h file.

After finalizing the pin configuration (or using the default one) just upload the code to the Wemos D1 Mini board.

The responses of the box are implemented in the useless-box.ino file, and the run() function is responsible for selecting and executing the reaction to a flip of the switch or to a signal from the sensor. Feel free to add new logic or remove any existing reaction you don't like in this function.

The Box

I designed a custom box for this project which can be 3D printed or even further customized. You can download the model from Thingiverse or MyMiniFactory.

Happy Printing! :)

About the author

This project is maintained by György Balássy.

useless-box's People

Contributors

balassy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

useless-box's Issues

Question about File format?

Hello, I am waiting on my sensor board to arrive in order to finish building this. I just wanted to

  1. Thank you! This is an awesome project! I had wanted to do one along these lines for sometime! I am planning on trying to add a speaker, and mp3 module to play random taunts and insults at the player LOL!
  2. I was curious, what program is the PCB-Gerber.zip file made for? it looks like it's for manufacturing the PCB. In the past I had a version of Eagle that I did that from, but recently got Fritzing, so that is my new go to. I have always used the process of thermal transfer from laser print to the copper, then etched it with some home brew CuCl2. However I am considering trying to make my own tool mount for my 3d printer to make it a miniature 2D CNC. If these files are for some opensource or free milling app that would be really good to know!

Anyhow thanks again!
Cheers!

Unable to run

I am trying to get this work but without success so far.
I have encountered two issues with the code

  1. When opening the sketch the file needs to be renamed to have the same name as the folder, which in case of downloading from GitHub has -master at the end.
  2. Error while compiling which has been already solved here

But now, when I upload the code to the ESP, absolutely nothing happens. No matter what I do, nothing. I am sure the wiring is correct.

Any ideas, please?
Thanks!

Proximity value only between 0 and 4

Hi,
I used exactly the components listed here and wired everything as described. However I had to use Arduino IDE to flash my Wemos D1 Module. After flashing the console gives me Proximity Values between 0 and 4 randomly. It does not matter whether something is close or far from the sensor.

Anybody else has this behavior?

Kind regards

Analog proximity sensor

Any chance of Analog proximity sensor support?
I have several sharp sensors, I'm curious how they would do in this project.

Megépítettem, de nem működik

Szia!

Megépítettem, de nem működik. Induláskoz megzizzennek a szervók, és ennyi. Az arduino soros monitorban ilyenek vannak:
"⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮�⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮<⸮<⸮⸮⸮⸮⸮⸮⸮⸮<⸮⸮⸮⸮"

Segíts kérlek! Mit rontok el?

Üdv:
mmrobbie
[email protected]

Switch servo not works

I have made this Useless-box but switch servo rotate only 45 degrees. If in config.h I change 145 with other value servo rotate always 45degrees

Servos Moving Very slow

Everything seems to be working as expected but I have noticed my Servos are moving extremely slow.

Initially I have powered this from my laptop, now a standard USB phone charger, no change

I am running SG90 Servos as well

not working with esp8266

I tried using this with ESP8266, but initialization of the module fails.
Any ideas why?
Tell me if you do need any details to help debug it.
Or if you were able to use the sensor with an esp8266 could you share the details, that would be a huge help.
Thanks

failing when compiling ....

C:\Users\jocon\OneDrive\Dokumenter\Arduino\useless-box\proximity-sensor.cpp: In member function 'uint8_t ProximitySensor::getProximity()':
C:\Users\jocon\OneDrive\Dokumenter\Arduino\useless-box\proximity-sensor.cpp:45:19: error: control reaches end of non-void function [-Werror=return-type]
45 | Serial.println(F("ProximitySensor: Reading proximity value FAILED!"));
| ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1plus.exe: some warnings being treated as errors
Multiple libraries were found for "Servo.h"
Used: C:\Users\jocon\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.1.1\libraries\Servo
Not used: C:\Users\jocon\AppData\Local\Arduino15\libraries\Servo
exit status 1

Compilation error: control reaches end of non-void function [-Werror=return-type]

not sure what to do? any one can help
i only need the programing.. then i can test

Instructables request

Is there any instructables available to assemble the useless box ?
I remember one but i don't find the link
Thanks

Error when comiling in Arduino IDE

Have built and used your default pin layout, however get the following error when compiling using Arduino IDE, any suggestions?:-

C:[DocRoot]\Arduino\useless-box\proximity-sensor.cpp: In member function 'uint8_t ProximitySensor::getProximity()':
C:[DocRoot]\Arduino\useless-box\proximity-sensor.cpp:45:19: error: control reaches end of non-void function [-Werror=return-type]
45 | Serial.println(F("ProximitySensor: Reading proximity value FAILED!"));
| ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1plus.exe: some warnings being treated as errors
Multiple libraries were found for "Servo.h"
Used: C:*\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.1.1\libraries\Servo
Not used: C:*
\AppData\Local\Arduino15\libraries\Servo
exit status 1

Compilation error: control reaches end of non-void function [-Werror=return-type]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.