Several years ago I built a fucking machine that used an SD card to hold motion programs. I also wrote a number of programs to create and edit these programs. I have one program that allows you to record a program that follows mouse or gamepad joystick motion. You can save the files as either tabbed text which can then be edited in excel or as a very dense simple proprietary format. I found the Arduino code that I wrote 8 years ago for decoding the proprietary format. It is very simple, I am actually surprised I thought of something so simple. I guess I had a working brain 8 years ago. Only the proprietary code was interpreted by the Arduuino but I could write an interpreter for the tabbed text as well.
Then there is the editor program which allows you to string together previously recorded sessions. You can add both tabbes text and other files and save as a proprietary formatted file that will play on the machine. You can change speed and so all sort of other things as well as preview the motion graphically.
I am amazed that I wrote all this stuff and never used it, but that is largely because I really like joystick control with a partner and concentrated on making that work really well. There has been some interest expressed about having programs which is why I checked this old code out. Also the new control board has an SD card on it so why not use it for this?
I can post the programs for people to play with but currently the later machines will not play the files. I can easily add the code to interpret them but the difficult part is deciding how to choose and run the files with a minimal user interface. I do not want to make it WIFI dependent but might have no other choice? Ideas?
I’d play around with the program if you post it.
I will post the programs but it makes sense for me to write some documentation first because it is unlikely anyone could figure the programs out without it.
i posted the programs and a quickly written doc to the following url
http://www.spencerserolls.com\f-machine-tools.zip
I did a project for a cooling vest, it circulates water through hoses sewed into a tight vest. I wanted to be able to control the flow rate, but didn’t want to screw with an interface cause KISS. So I just added a pizo and one button. With combinations of long and short presses I had a couple different modes setup. It’s dead simple as long as you know what the sequences.
Or just generate wave files of the file name and one button to cycle through them.
I am not crazy about long and short presses but might use some if i need more options. What I have now is three buttons which work on a single wire because there are only 8 in the cable from the control to the micro board. i use different voltage dividers and analog input to create these three buttons. one button advances to the next program one starts the program and the other does an e-stop which resets the ram. you can select a different program while is running and it stops it and loads the next. the selected or if playing file header name is displayed. the recorder program lets you add a 40 character header name so you are not limited to 8.3 names of the file name.
I’d love to see how you implemented the SD card on the ESP32. I gave it a brief go but ran into nothing but trouble. The webserver (esp-async-webserver) would quickly use up all the file handles leaving the user interface kind of broken. I also was unable to update the program on the ESP while the sd card was connected – no errors, it thought it uploaded successfully, via serial or wifi, but the new program never made it into the actual chip. weird stuff
the ESP is a real piece of work. it amazes me that they get so much to work when some really basic stuff is so fucked up. the A to D converter is total crap that is almost impossible to fix with filtering etc so i gave up. the SD card and SFIFFS are also unbelievably strange. you could download the esp32 data sheet and maybe find some secrets in there but good luck with that.
I am using MySD instead of the default SD that uses sdfat al this stuff is horribly antique and just barely works. i forget why i had to change to MySD. so we have the reading of fuck files and config files etc all working from the SD card but some times it just fucks up, not reliably so it could be diagnosed but totally hit or miss.
I am actually amazed that i stuck with it long enough to get almst everything working. the web gui was also a fun challenge with all sorts of randomness and undocumented behavior.
a “partner” is going to commercialize the new esp32 version with web gui etc. we have (i do most of the programming) a lot of work into this bases on over 7 years of making fucking machines so i am not going to share the complete source code but if there are specific things you are having trouble with i can send code snippets that i think might show you how we got it to work?
this ESP32 thing got me closer to smashing my computer with a hammer than anything i experienced prior. i just wrote a couple of programs for the teesny and they took almost no time and just worked so i am not stupid. here is the include section so you know which libraries i am using
//#include
//#include
#include
#include
#include
#include
#define SCREEN_WIDTH 128 // OLED display width, in pixels
//#define SCREEN_HEIGHT 64 // OLED display height, in pixels
#define SCREEN_HEIGHT 64 // OLED display height, in pixels
// Declaration for an SSD1306 display connected to I2C (SDA, SCL pins)
#define OLED_RESET -1 // Reset pin # (or -1 if sharing Arduino reset pin)
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
ESP32Encoder encoder;
i don’t know why the paste didn’t work here is what was left out, when i was using SFIFFS a lot of garbage accumulated on the esp’s memory. i found a tool to manage that and remove all the crap it is a simple sketch that reads the sfiffs folder and leets you delete any or all files on it. this could help straighten out your memory if that is the problem i can send it or find a link if you need it. also esp32 is very finicky about voltage at file load time. use a really good and short usb cable. also connect a 1 mf cap between enable and ground(i think) so you don’t have to press buttons to get program to load.
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
ESP32Encoder encoder;
still won’t past correctly i can send you the stuff by email if you send me an email using the contact form (if i didn’t disable it due to excess spam)