Best Update Ever

Best Update Ever

I have revisited the fucking machine and decided to improve my latest model as much as possible. I am surprised at how good it is now. All the annoying little bits of stutter and hesitation are gone. I decided to dump the three knob encoder and replace it with an old fashioned analog version. Much much better. The new version has simple potentiometers to set the speed stroke and offset values. This interfaces with the joystick encoder much better and allows both to operate much more smoothly. Of course the code to run the new version is totally different. Right now, I only have a version for my cable “unstoppable” machine but adapting it to other machines is just a matter of setting a few limit variables to work with different motor to motion ratios. I will be posting details if anyone is interested as well as the new code.

This entry was posted in Uncategorized. Bookmark the permalink.

25 Responses to Best Update Ever

  1. Austin says:

    Are you still looking for beta testers?
    I am a young man, former college athlete with a great mind for providing solutions or perspective. I would love to help you enhance what sounds like what is already an outstanding machine.

    • shagmatic says:

      Would love to have others experience this machine. It is too great to not share. Logistics may be a problem.

      • Austin says:

        I am just in awe at the thought and dedication put into this beautiful creation! I just got excited shortly after realizing this built may be out of scope for me, but then saw your last bit looking for help so I thought I would offer as I’m sure I’d enjoy using it as much as I would improving it. I’m in Atlanta, so if you so happen to cross paths, I’d love to provide input. Feel free to email me and keep in touch!

  2. Ken says:

    Having built the version with the 3 knob encoder, and having some issues with it, I have considered other easy of controlling it. In these iot times, making a wireless controller should be possible without too many problems. One thing that is a bit annoying though, is that there is no teensy with wifi, but I have considered using 2 esp8266’s and simply “relaying” the controller information to the teensy via wifi that way.

    Using standard potentiometers sounds interesting – I’ll def. test that when rebuilding my machine. Thanks for the Update!

    • shagmatic says:

      all sorts of control are of course possible. i did write some routines to use audio encoded data for remote control so the machine could be controlled over a phone or internet connection. I got the encoding and decoding to work but did not do a lot of testing of bandwidth etc so i don’t know how responsive the machine would be or if some sort of clever compression might be needed. i used a very basic encoding of individual data bits. if someone is better at this sort of thing i would be interested in collaborating.

      the three knob encoder was a bitch to get to perform smoothly. it was possible with certain motor driver combinations but the accelstepper and encoder libraries do not co-exist well competing for turning interrupts on and off. it would be possible to write my own stepper controller that did not use interrupts or to combine the two libraries (although that is more than i want to try to learn to do) the only difficult aspect of stepper control is acceleration which is necessary to achieve decent speeds especially on short fast strokes.

      the old three knob controller had to update four encoders total and try to run the stepper smoothly. this was very difficult to do especially with my cable machine which has a large diameter pulley and therefore coarse stepper motion. i got very choppy when moves were interrupted. the pots on the new controller are read once every 10000 loops as opposed to being incremented. without interrupts on the encoders the polling had to be every loop to not miss an encoder pulse. this took most of the loop time and really messed with smooth stepping. now the main loop spends most of its time running accelstepper with one look at the joystick encoder and an occasional update of the voltages on the three pots. interleaving of joystick controlled motion and accelstepper control is very smooth at most speeds. it is possible to have a fast vibration with simultaneous joystick control and even with the crude motor step it is acceptably smooth and relatively low noise. if there is any appreciable load on the ram, it is definitely acceptable. there is room for improvement of the mechanicals as well to make it even more quiet.

  3. Paul Y. says:

    I am in the process of making a 3 encoder remote control via radio not WIFI. I have worked out most of the issues and am working on a way to have wired and wireless at the same time. The advantage of this is all the encoder processing is being done on the remote and only sending the new values to the fuck machine. Also have been working on allowing addressable receivers and what to do if the remote is ‘lost’. I suspect converting the remote to pots would be fairly straight forward and receiver would remain the same as I would just be sending new values on each transmit. Thoughts?

    • shagmatic says:

      If you have processing in the remote, i would use encoders and just send updates either when values change or at a fixed interval. Pots are cheaper and have the advantage of position matching the value unlike encoders that do not let you know “where they are” The only downside to pots is that they need to be read as an analog voltage which needs to be converted which is slow. However, as I discovered, reading and updating does not have to be done very often. So pick the features you want in terms of choosing an encoder or pot. I plan to post the new code which works well with pots and the low res stepper motor but am waiting to know that it is really good. I can send it to you to try. It is simplified with a lot of the unused stuff removed. It uses lookup tables for the pot scaling. I make these with an excel i wrote that does logs and offsets etc.

  4. Paul Y. says:

    Them main reason I am sticking with encoders is I don’t care where they are set at any given time. To me the encoders just tell me “more” or “less” and I am okay with that. There is usually a trade off somewhere, you just have to decide what works best for you.

    More to come…

  5. Ken says:

    At some point i considered using pushbuttons instead of pots or encoders.

    6 buttons, an esp8266 that simply relays a predefined increase in value to the teensy sounds simple and Will not interfere with any other Electronics.

    But I might just stat with encoders and make it wireless. Not sure what to do right now

  6. shagmatic says:

    After spending a lot of time recently getting the pots to work really well and never quite getting it right with encoders, I would recommend pots or push buttons over encoders. I have also programmed buttons for other applications and it is fairly difficult to get it right. First, I would recommend using bounce or some other method to debounce the buttons. Use pullups at the switches and also use ferrites on any long lines and be sure to have ground wires in the cable. Then you need to decide how to increment on button presses. Using one for up and one for down makes the most sense but you also have to decide how many ticks per time period or per press. I usually distinguish between a short and long press and handle them differently. I always write this by hand using millis but there is probably a library for buttons that might do it all and better. I often have problems with buttons on all sorts of consumer devices so apparently it is not easy to get right for anyone.

    • shagmatic says:

      I just uploaded the newest version of the firmware to github. Find the link on the resources page. This version has potentiometers for three knob control, lookup tables with reasonable values and is simplified to make it easier to understand. I also uploaded the xlx which I use to make the log lookup tables. i fixed the bug in it so it should work as required.

  7. shagmatic says:

    I might have left some bugs in the code I posted because when I tried it on my cable machine it did all sorts of horrible things. I spent hours pouring over the code line by line and might have found one little problem but the problems persisted. I went through all connections and measured voltages etc etc but still could not fix the problem. Then I switched the digital input reference (the limit switches and encoders use this voltage from 3.3 to 5 volts (this is s teensy 3.2 with 5 volt inputs) and everything worked fine. I had tested with 3.3 volts on the 3.2 previously and never had problems. I left the jumper on the 3.3 position so as to not damage the 4.0 if I plugged it in for testing. I have 5 volts to a joystick encoder that works better with 5 volt input and have level shifters on the output. At this point I have no idea why the problem with using 3.3 volts on a 5 volt (digital thresholds should allow it since they are TTL compatible) controller appeared. I am posting the new code which definitely works and has more comments in it to help with understanding. But be aware that there can be problems using 3.3 volt inputs on a 5 volt controller and the problems may be intermittent and very elusive.

  8. shagmatic says:

    I just uploaded the new firmware. Github is so complicated that I can not figure out how to remove the previous one so I am just leaving it. I don’t think there is anything wrong with it but I would like to leave only the latest. I am not taking advantage of any of the amazing features of Github so there is no reason to keep old suspect versions. If anyone knows how to remove the old stuff, please let me know.

  9. Jaypi says:

    Did you ever think about porting your firmware to an esp32 microcontroller? It has bluetooth and wifi connection and it very cheap. This opens the door to a wide range of possibilities to control the device over wireless connections.

    • shagmatic says:

      I have heard of the esp32. i am somewhat old and not interested in learning a lot of new stuff 🙂 the current version relies on accelstepper and encoder. if these can be easily ported to the esp it could doable. if you are interested in collaborating i will test on my machines. i have a scheme for controlling over phones internet etc using audio but it would be a bitch to get working reliably. it would be great to find an easier solution.

  10. Ken says:

    I’m pretty sure the port would be easy’ish and i would switch to an esp32 the moment a port was Ready for betatest!

  11. shagmatic says:

    It looks like there are ways to program the esp32 using arduino. however certain things are not working yet like analog input. it might be fun to try to develop a version of shagmatic controlled over the internet. if anyone is interested who is better at this sort of thing than i am, i would like to collaborate.

    • Mike says:

      I built a machine based off your plans two years ago running on an esp32. The biggest hurdle I had was converting pin variables. Unfortunately i lost the final configured file. I say all this to confirm that an esp32 does work with minimal effort. I had plans of adding remote control via bluetooth but never got around to it. I think I might revisit the machine with your new code.

  12. Jaypi says:

    What kind of potentiometers do you use for your upgrade? Standard 270° or multi-turn pots?

  13. shagmatic says:

    i am using 10 turn because that is what i had on hand. i think that 5 or two turn would be better. 270 degree would probably be too “coarse”

  14. Bill M says:

    When you swapped the encoders for potentiometers, did the wiring change at all in hte RJ45 connector, or on the control board? I’ve been reading through the build manual and I’m wondering if the wiring diagram for for the Three Knob controller will still work if I were to simply swap out 3 pin encoders for 3 pin pots (and obviously update the firmware on the Teensy).

    • shagmatic says:

      you need to be sure that your microcontroller can handle the analog input voltage. if in doubt use a 3.5 or 3.2 not a 3.6 which is not 5 volt tolerant. be sure you are connecting to analog input pins. you can not just use the same three pins since each encoder has a common and an A and a B quad phase and no + voltage. so some rewiring is needed to get the + voltage to the three knob controller. each pot is a voltage divider with the wiper connected to an analog input.

      • Bill M says:

        Ah, that makes sense. It sounds like that would reduce the number of wires going to the three knob controller from 8 down to 5 (+V, GND, Pot1, Pot2, Pot3). If I’ve read the code correctly, it looks like you used pins 15, 17, and 20 for speed, stroke and offset respectively for the analog inputs (based on the Github document FM-cable_machine_pot_test_table_simplified-testing.ino)

  15. Waylander says:

    Just wondering if you are planning on releasing your new source code?
    I built a belt drive machine inspired by yours but wrote my code from scratch as I wanted to use potentiometers from the start. I’ve still got a few issues with it and would be keen to see how you solved them (if you had the same issues).
    I also made a pair of PCBs to tidy up the wiring. I have a PCB in the main enclosure which then connects to the controller, Pots and LCD display via a CAT5 cable (not Ethernet, just used CAT 5 as a tidy option)
    If anyone wants to see some pics – https://imgur.com/gallery/kctZzmr

    • shagmatic says:

      I actually found fewer problems using pots instead of encodes for the three knob control. I am sending you the code for this [personally. I can post it to github (if i remember how) if others want it. I am not going to share the recording version right now as I need to test it some more.

Leave a Reply

Your email address will not be published. Required fields are marked *