teejusb / fsr Goto Github PK
View Code? Open in Web Editor NEWFSR code used for dance pads
License: GNU General Public License v3.0
FSR code used for dance pads
License: GNU General Public License v3.0
Hi, I followed all the steps but I can't see the threshold realtime bars and sometimes the profiles disappear.
Works fine but I can't check if the sensors had pressure by default
Tried installing the latest version of Python (3.10.1), experiencing build wheel failures for multidict
and yarl
.
For now, the stable way to install Python is by installing Python 3.8.6.
When creating a profile with spaces, on next server restart the profile will fail to parse as it expects an exact number of space separated elements. This causes the profile to fail to load, and then the settings will get wiped when we attempt to next save the file.
We can migrate to a better representation for configuration (e.g. a JSON file) that does handle space separated strings as expected.
Per the issue title, I got the sketch compiling and uploading with arduino-cli, and could contribute some instructions if you care to have them.
hi, I wanted to ask if you will create an installation file for windows for the management of the FSR thresholds, in order to make it easier to manage the threshold change of each sensor, and if you increase the firmware for arduino, you will be able to configure the 16 sensors configuration that you can then possibly manage the calibration from a single program that can be installed on windows
Thanks for providing this excellent code to the community.
Unless I'm missing something, the .ino won't compile for the ATmega328P, ATmega1280 or ATmega2560 as the Arduino "Keyboard" library isn't supported on chips that don't have native USB interfaces. The ATmega32U4 has a USB interface built on the chip itself and compiles fine.
I set the thresholds on my laptop and then connect the arduino to a different system to play stepmania. But the thresholds don't stick, I have to either load up the API on the SM machine or hardcode them.
Can we use EEPROM to store the 4 values?
Tested on macOS Big Sur 11.4
When the serial port is configured incorrectly or the device is not plugged in, I see an error like the following.
~/Documents/teejusb/fsr/webui $ yarn start-api
yarn run v1.22.17
$ cd server && venv/bin/python server.py
* WebUI can be found at: http://192.168.1.67:5000
======== Running on http://0.0.0.0:5000 ========
(Press CTRL+C to quit)
Client connected
Found Profiles: ['']
Starting Read thread
Starting Write thread
Error opening serial: [Errno 2] could not open port /dev/ttyACM0: [Errno 2] No such file or directory: '/dev/ttyACM0'
Traceback (most recent call last):
File "/Users/jheadapohl/Documents/teejusb/fsr/webui/server/venv/lib/python3.9/site-packages/serial/serialposix.py", line 265, in open
self.fd = os.open(self.portstr, os.O_RDWR | os.O_NOCTTY | os.O_NONBLOCK)
FileNotFoundError: [Errno 2] No such file or directory: '/dev/ttyACM0'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/jheadapohl/Documents/teejusb/fsr/webui/server/server.py", line 179, in Open
self.ser = serial.Serial(self.port, 115200, timeout=self.timeout)
File "/Users/jheadapohl/Documents/teejusb/fsr/webui/server/venv/lib/python3.9/site-packages/serial/serialutil.py", line 240, in __init__
self.open()
File "/Users/jheadapohl/Documents/teejusb/fsr/webui/server/venv/lib/python3.9/site-packages/serial/serialposix.py", line 268, in open
raise SerialException(msg.errno, "could not open port {}: {}".format(self._port, msg))
serial.serialutil.SerialException: [Errno 2] could not open port /dev/ttyACM0: [Errno 2] No such file or directory: '/dev/ttyACM0'
Error opening serial: [Errno 2] could not open port /dev/ttyACM0: [Errno 2] No such file or directory: '/dev/ttyACM0'
Traceback (most recent call last):
File "/Users/jheadapohl/Documents/teejusb/fsr/webui/server/venv/lib/python3.9/site-packages/serial/serialposix.py", line 265, in open
self.fd = os.open(self.portstr, os.O_RDWR | os.O_NOCTTY | os.O_NONBLOCK)
FileNotFoundError: [Errno 2] No such file or directory: '/dev/ttyACM0'
...
This is fine and expected; it tells me the file for the serial port is missing. There are two problems though. First, the error is printed repeatedly as fast as the server process can go. Second, quitting the server with Ctrl+C does not stop the thread that is printing the errors, which makes the open terminal difficult to use and also makes my computer warmer (and noisier, as the fan ramps up). I can kill the leftover processes manually or close the terminal they are running in.
Ideally Ctrl+C should stop all the server processes, and separately it might be useful to add a delay when retrying the connection to the serial port.
I had the fsr working previously, but since my arduino collapsed, I had to reinstall it.
The UI works visually, you can visually set thresholds and the colors change when the pressure exceeds the thresholds. However, I cannot use the UI to change the interface. I have to open Arduino IDE and manually set the thresholds using the serial monitor there.
Any help or further questions would be appreciated. Thanks!
Newest version of node breaks the installation process.
I mentioned this on Discord a couple of months ago, but have only just gotten back into hacking on the FSR code. This issue manifests as a TypeError in aiohttp
when you hit ctrl-C to interrupt the script, like so:
yarn run v1.22.18
$ cd server && venv/bin/python server.py
/home/maybe/dev/fsr/fsr/webui/server/server.py:327: DeprecationWarning: There is no current event loop
main_thread_loop = asyncio.get_event_loop()
* WebUI can be found at: http://10.10.9.144:5000
Found Profiles: ['']
/home/maybe/dev/fsr/fsr/webui/server/server.py:208: DeprecationWarning: isSet() is deprecated, use is_set() instead
while not thread_stop_event.isSet():
/home/maybe/dev/fsr/fsr/webui/server/server.py:252: DeprecationWarning: isSet() is deprecated, use is_set() instead
while not thread_stop_event.isSet():
======== Running on http://0.0.0.0:5000 ========
(Press CTRL+C to quit)
Client connected
^CTraceback (most recent call last):
File "/home/maybe/dev/fsr/fsr/webui/server/server.py", line 460, in <module>
web.run_app(app, port=HTTP_PORT)
File "/home/maybe/dev/fsr/fsr/webui/server/venv/lib64/python3.10/site-packages/aiohttp/web.py", line 512, in run_app
_cancel_tasks({main_task}, loop)
File "/home/maybe/dev/fsr/fsr/webui/server/venv/lib64/python3.10/site-packages/aiohttp/web.py", line 444, in _cancel_tasks
asyncio.gather(*to_cancel, loop=loop, return_exceptions=True)
TypeError: gather() got an unexpected keyword argument 'loop'
Per aio-libs/aiohttp#5905, this just looks like the dependency in requirements.txt
needs to be bumped. Installing the newer releases of aiohttp
and async-timeout
(>= 4.0 seems necessary) fixes the ^C issue, but causes something else to break silently so that sensor values don't get reported to the UI. The value bars and the time plot both sit at 0, even though I apply pressure to my test sensor.
No sure what the breakage with the value reporting is, if I work it out I'll follow up here or make another issue.
I see there's a note at the top of the write up pointing to a discord group. I don't see a link to get there and clicking on it simply shows the graphic for number of people online. Could a link to the group be added here?
I will make a PR as i am testing this on my own branch.
Related link
https://forum.arduino.cc/t/faster-analog-read/6604/6
fix is probably as simple as:
#define FASTADC 1
// defines for setting and clearing register bits
#ifndef cbi
#define cbi(sfr, bit) (_SFR_BYTE(sfr) &= ~_BV(bit))
#endif
#ifndef sbi
#define sbi(sfr, bit) (_SFR_BYTE(sfr) |= _BV(bit))
#endif
#if FASTADC
// set prescale to 16. s == 1, x ==0 from prescale table.
// 16 == 78000 hz, default is 128 which is 9600hz
sbi(ADCSRA,ADPS2) ;
cbi(ADCSRA,ADPS1) ;
cbi(ADCSRA,ADPS0) ;
#endif
| Prescale | ADPS2 ADPS1 ADPS0 | Clock freq (MHz) | Sampling rate (KHz) |
|----------|-------------------|------------------|---------------------|
| 2 | 0 0 1 | 8 | 615 |
| 4 | 0 1 0 | 4 | 307 |
| 8 | 0 1 1 | 2 | 153 |
| 16 | 1 0 0 | 1 | 76.8 |
| 32 | 1 0 1 | 0.5 | 38.4 |
| 64 | 1 1 0 | 0.25 | 19.2 |
| 128 | 1 1 1 | 0.125 | 9.6 (default) |
is there a way you can add a 5th input for pump it up?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.