Code Monkey home page Code Monkey logo

fsr's Introduction

Teejusb's FSR Guide

A complete software package for FSR dance pads.
Join the discord for any questions/suggestions

Features

  • React web UI to customize sensitivity
  • Profiles & persistence
  • Light support

Screenshots

Requirements

  • A Teensy or Arduino
    • uses native keyboard library for Arduino and Joystick library for Teensy
  • Python 3.6+
    • virtualenv
  • Node 12+
    • yarn

Hardware setup

Follow a guide like fsr-pad-guide or fsr to setup your Arduino/Teensy with FSRs.

Firmware setup

  1. Install Arduino IDE (skip this if you're using OSX as it's included in Teensyduino)
  2. Install Teensyduino and get it connected to your Teensy and able to push firmware via Arduino IDE
  3. In Arduinio IDE, set the Tools > USB Type to Serial + Keyboard + Mouse + Joystick (or Serial + Keyboard + Mouse)
  4. In Arduinio IDE, set the Tools > Board to your microcontroller (e.g. Teensy 4.0)
  5. In Arduinio IDE, set the Tools > Port to select the serial port for the plugged in microcontroller (e.g. COM5 or /dev/something)
  6. Copy in the code from fsr.ino
  7. By default, A0-A3 are the pins used for the FSR sensors in this software. If you aren't using these pins alter the SensorState array
  8. Push the code to the board

Testing and using the serial monitor

  1. Open Tools > Serial Monitor to open the Serial Monitor
  2. Within the serial monitor, enter t to show current thresholds.
  3. You can change a sensor threshold by entering numbers, where the first number is the sensor (0-indexed) followed by the threshold value. For example, 3180 would set the 4th sensor to 180 thresholds. You can change these more easily in the UI later.
  4. Enter v to get the current sensor values.
  5. Putting pressure on an FSR, you should notice the values change if you enter v again while maintaining pressure.

UI setup

  1. Install Python
  2. Install Node
    • Install yarn. A quick way to do this is with NPM: npm install -g yarn
  3. Within server.py, edit the SERIAL_PORT constant to match the serial port shown in the Arduino IDE (e.g. it might look like "/dev/ttyACM0" or "COM1")
    • You also may need to modify the sensor_numbers variable.
  4. Open a command prompt (or terminal) and navigate to ./webui/server with cd webui/server
  5. Run python -m venv venv (on Windows you may need to replace python with py)
  6. Run venv\Scripts\activate (on Linux you run source venv/bin/activate)
  7. Run pip install -r requirements.txt to install dependencies
  8. Then move to the ./webui directory by doing cd ..
  9. Run yarn install && yarn build && yarn start-api
    • On Linux, you'll also need to edit the start-api script in ./webui/package.json to reference venv/bin/flask instead of venv/Scripts/flask

The UI should be up and running on http://localhost:5000 and you can use your device IP and the port to reach it from your phone (e.g. http://192.168.0.xxx:5000 )

Troubleshooting

  • If you use localhost in your browser and if the UI looks choppy, try using your local IP instead
  • If you see the following error, ensure the "Serial Monitor" isn't already open in Arduino IDE serial.serialutil.SerialException: [Errno 16] could not open port /dev/cu.usbmodem83828101: [Errno 16] Resource busy: '/dev/cu.usbmodem83828101
  • If you notice that your input is delayed and perhaps that delay increases over time, you can sometimes rectify that by restarting the server. Close your start-api window and run it again.

Tips

Make a desktop shortcut (Windows)

Create a new text file called start_fsrs.bat and place it on your desktop.

start "" http://YOUR_PC_NAME_OR_IP:5000/
cd C:\Users\YourUser\path\to\fsr\webui
yarn start-api

Now you can just click on that file to open the UI and start the server.

fsr's People

Contributors

teejusb avatar dominickp avatar dependabot[bot] avatar dominick-peluso-bose avatar

Watchers

James Cloos avatar

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.