Tagged: Arduino Toggle Comment Threads | Keyboard Shortcuts

  • jschoolie 8:30 am on July 3, 2013 Permalink | Reply
    Tags: Arduino, DL4, Dotted Eighths, Line 6, Mod, Tap Tempo   

    Line 6 DL4 Dotted Eighth Tap Tempo Mod 

    Hey guys,

    So almost a year ago now, my brother Brian and I decided to make a dotted eighth tap tempo feature available on a Line 6 DL4 that I use on my guitar rig. We used an Arduino platform to prototype the project. I have been successfully using the mod for about 8 months now. Check out these videos for more info:

    Here’s the full source code for a standard Arduino or a standalone ATMega328 chip:

    [EDIT]
    I noticed there was a bug in the original code I posted. I went through and parsed a lot of stuff down in my original source code but I apparently made some errors. This code is the original source code and it is fully functional! 🙂
    (Read the rest of this post…)

     
    • Troy 9:57 pm on September 21, 2013 Permalink | Reply

      awesome mod. Do you have diy kits yet? If not would you be willing to hook me up with a schematic or possibly just some more details on this?

      • jschoolie 10:19 pm on September 26, 2013 Permalink | Reply

        Thanks! I’m working on finalizing everything right now. I’m very close to having a kit put together. I finished revising the pcb layout/schematic for the mod last night. The revised version uses an ATtiny85 and everything fits on a 1×1 pcb that fastens to the original screw holes on the DL4. Sorry for things moving so slowly, I’m currently enrolled in engineering at Purdue which eats up most of my free time 😉

        • Troy 10:46 pm on September 26, 2013 Permalink | Reply

          No prob. Thanks a lot for posting the code. I was missing the transistor part of the circuit and it gave me fits, but I was finally able to figure it out with an arduino uno and a transistor. I’m just a civil engineer (EIT)… It takes us a little longer to catch on. I think you would have a huge market if you started offering this mod. Thanks again for posting your code!

          • jschoolie 11:36 pm on September 26, 2013 Permalink | Reply

            You’re Welcome! I’m glad you got it working. Lol, you haven’t seen me try to build a bridge! And thanks, I hope so!

    • Troy 9:34 pm on September 30, 2013 Permalink | Reply

      After playing with it for a few days I think i have noticed a weakness in the code at least as it functions for me. On slow songs sometimes I will depress the tap on the beat and let it back up on the and of the beat to help me tap in time. I find that subdividing the rhythm helps me lock it in better (I have been accused of not having rhythm). I’m not sure why this is happening but I’m thinking the HOLD_DELAY 750 is timing out and resetting the tapstate variable. Is there any reason in the way you coded it that the HOLD_DELAY can’t equal 2002 to match the RESET_TIME? Was the selection of 750 arbitrary or did you have a reason?

      • jschoolie 12:26 am on October 1, 2013 Permalink | Reply

        Ah, you’re running into the double preset part of the mod. On the full mod, I have an extra MOSFET switch hooked up that receives either 5V or ground from the arduino. When hooked up properly to the DL4 it will act like an expression pedal. Holding the switch down for 750ms (which is what appears to be happening on the slow songs) flip flops the 5V/ground output from digital pin 8 I think, and it does reset the tap counts thus messing up the tempo. That feature should be pretty easy to remove in the debounce function as it is only necessary if you want the double preset thing to work. I’ll take a look at it tomorrow or Wednesday and try and post a version without that feature in it and that should fix it! Sorry about that!

        • Troy 12:07 pm on October 1, 2013 Permalink | Reply

          Thanks. I appreciate it. I use the double preset wheel instead of the switch. Thanks again for posting the code. It has made my dl4 infinitely more useable.

          • jschoolie 11:12 am on October 3, 2013 Permalink | Reply

            No problem, I’m glad it’s helping you out!

    • Marius 9:35 am on October 3, 2013 Permalink | Reply

      Hello jschoolie, I’m interested in your mod on DL4. Can you send me the list of parts i need and some info so I can make one for mine?

      • jschoolie 11:14 am on October 3, 2013 Permalink | Reply

        Hey Marius, I’m actually fairly close to having a PDF with the instructions and parts list etc. put together and I will post it on here when I have it done in a few days.

    • Bobby Meeks 12:59 am on October 5, 2013 Permalink | Reply

      This is great… Have you heard of anyone trying this on the HD300/400 that sadly has no .8th feature? I may be your first Guinea pig…

      • jschoolie 6:01 pm on October 5, 2013 Permalink | Reply

        Thanks Bobby, and I haven’t heard of any one doing that but I’d be willing to give it a shot! There may be some modifications to the code/process in general but I’m sure it could be done.

    • Ulises 12:45 pm on February 1, 2014 Permalink | Reply

      Hey man!! I play in a worship group and i love the dl4 except for the part that there is no 1/8!! You’re video inspired me!!! I am 17 and i just bout the Arduino mega!! I spent so much money so i can copy that code into a micro-controller but i would like to know if u have finished your pdf file showing what kind of switch i need and what parts (resistors, capacitors,regulators) i need and where to put them in the pref-board! Please man!! God Bless You!

      • jschoolie 4:02 pm on February 6, 2014 Permalink | Reply

        Hey dude! Glad to hear you like the mod and I’m also glad to hear you are using your talents to serve the Lord. I’ll have the PDF done and posted within a couple of weeks. I’m waiting on parts to get in and get my directions tested out before I post anything official. Thanks for your interest!

    • Ulises 9:02 pm on February 21, 2014 Permalink | Reply

      Thank you soo much man!!! Please let me know asap when you get everything done!! I dont need a kit i just need a pdf with all the intructions and i can get the stuff my self! You will help me use my dl4 in a better way!! God bless man!!

      • jschoolie 8:41 pm on March 5, 2014 Permalink | Reply

        Hey dude, I just got everything up and running on our shiny new site: http://www.schoolcraftspecialties.com/SmartSwitch. It’ll have everything you need to get you going. The sites pretty new (i.e. we just learned how to write html a few weeks ago) so we are still working out a few kinks. If you see anything horrendous, please let me know lol 😉

    • jschoolie 1:21 am on March 7, 2014 Permalink | Reply

      Hey Everyone!
      I’m to the point where I feel like I’m ready to sell this mod to a few brave beta testers! The kit will include all of the components required to do the mod (custom PCB, programmed microcontroller, footswitch, resistors, etc.). You’ll need to be able to solder and connect wires to the DL4 PCB, as well as assemble the Smart Switch PCB.

      Check out our shiny new website for more details:

      http://www.schoolcraftspecialties.com/SmartSwitch

    • Ulises 8:35 pm on March 22, 2014 Permalink | Reply

      Hey man! did u receive my email?

    • Austin 5:15 am on June 10, 2015 Permalink | Reply

      Very cool! I am very new to avr programming, but this project really caught my attention. How easy would it be to add to the code allowing you to choose between a few different tap multipliers that are controlled via spdt switch of some kind? like choosing between 1/4, dotted 1/8 and 1/8.

  • schoolie 12:43 am on June 17, 2013 Permalink | Reply
    Tags: Arduino, , ,   

    Hacking the Heath/Zenith SL-5408 to run on DC 

    I’ve used the Zenith SL-5408 motion activated security light as a motion detector for my Bird Blaster. In version 1.0, I couldn’t get the detector to work off battery power, even though the whole circuit runs at 5V levels. Now that I’ve acquired a little more electronics equipment and knowledge, I thought I’d take another crack at powering the detector from a low voltage source.

    I started this round of reverse engineering by drawing out the power supply circuit in Eagle, adding components until I had reached the point where regulated 5V was present in the circuit. At this point, I didn’t notice anything that I hadn’t noticed the last time around. It was fairly obvious where the 5V supply originated, and that the PIR and timing circuit only used the 5V supply. The schematic is shown below. The 22 pin connection shown on the right is the point where the chip on board processor (the brains of the motion detector) is soldered in at a right angle to the main circuit board.

    SL-5408 Motion Detector Power Supply Circuit

    (Read the rest of this post…)

     
    • Kenney 1:07 pm on July 30, 2013 Permalink | Reply

      Great hack ! I have done a similar one to turn the output into a switch and delete the 120v . Good to know these can be hacked to use DC . How can I reduce the test function to 1second?

      • schoolie 2:51 pm on July 30, 2013 Permalink | Reply

        You’re wanting the output to remain active for one second instead of the stock five seconds right?

        If you’re using the arduino like I have in this post, you could just read in the output from the detector, then output a 1 sec signal through a separate relay or transistor controlled by the arduino. The only catch is that the detector will still reset on it’s normal schedule.

        I’ve also wondered if sending a faster clock signal to the detector would work. For example, sending a 300Hz square wave instead of a 60Hz square wave may reduce the test time from 5 sec to 1 sec. This would only work an the detector I used, and may not work at all :).

        What motion detector are you using?

    • Kenney 3:36 pm on July 30, 2013 Permalink | Reply

      Pretty sure its the same home depot Heath, I’ll have to double check. My setup is to scare deer out of the yard with stored rainwater (city water to expensive) and compressed air. I get a lot of false detections during the day with clouds causing cooler and hotter spots.
      OK with using 110v in and hack for switched out. But with the 5 second on and continual false starts would like to cut it back using less air/water. Looking at a time delay so it will cycle maybe 30 seconds before it would restart. Think Arduino is the only answer?

      • schoolie 3:55 pm on July 30, 2013 Permalink | Reply

        Something like the 555 circuit I used for the bird blaster should be adequate. The circuit in that post has 2 second ON time with control pulses at the beginning and end. I don’t think it would be too hard to incorporate a 30 second reset delay.

        What are you using to control the water flow or compressed air? That will determine what the control singals need to look like. Are you currently just using the motion detector’s relay?

        • Kenney 4:41 pm on July 30, 2013 Permalink | Reply

          Yes, just using the relay in the motion detector. Looks like I need to incorporate your 555 controlling circuit. Now all I need is to learn to read the schematic.

          • schoolie 5:00 pm on July 30, 2013 Permalink | Reply

            Honestly, using the Arduino may require less investment of time and materials if you’re new to electronics.

            If you’re looking to learn how this stuff works, starting with the 555 is definitely the way to go. If you just want a result, Arduino may result in less frustration 🙂

    • Kenney 8:02 pm on July 30, 2013 Permalink | Reply

      Knowing what I need, which arduino kit would you recommend? I have two motion sensors hooked to one 25vac ( blind spot) sprinkler valve. Pretty sure 12vdc would operate it if need be.

      • schoolie 11:10 pm on July 30, 2013 Permalink | Reply

        The standard Arduino Uno R3 is the simplest choice for getting started. You can get it at RadioShack or sparkfun.com. You’ll also need some resistors, an NPN transistor, a diode, and a relay with a 5v coil to actuate the valves. A 12v adapter that fits the Arduino’s power jack would be handy as well. Add a breadboard to build the circuit on (or proto board if you want to solder, maybe just skip the board entirely and solder the components directly together) and you’re good to go :-).

        Your motion detector will need to have the relay modded too if you haven’t already done so.

    • Kenney 7:56 am on July 31, 2013 Permalink | Reply

      Lots of good info, has me headed in the right direction to tweek this thing the way I want it.
      Many Thanks

      • schoolie 3:48 pm on July 31, 2013 Permalink | Reply

        Great. I’d love to hear how things go if/when you work on it.

        Brian

  • schoolie 8:03 pm on May 22, 2013 Permalink | Reply
    Tags: Arduino, Arduino Compatible MC-2100 Controller, , DIY Arduino, , Lathe Tachometer, ,   

    Arduino Compatible MC-2100 Controller and Lathe Tachometer 

    The completed circuit in operation

    After getting the simple 555 based MC-2100 driver circuit working, we moved on to a controller with more features. I’d been looking for an excuse to make an arduino-compatible board (here’s a description if you’re not familiar), and this seemed like the ticket.

    The initial spec for the controller included the following functions:

    • Read user input from potentiometer
    • Send the 50ms period PWM signal to the MC-2100
    • Sense the lathe’s spindle speed using a magnetic reed switch or equivalent
    • Display the spindle speed on a 7 segment LED display

    At this point, the controller meets the requirements laid out above. I’ll discuss the implementation of each feature into the controller in the order listed above.

    (Read the rest of this post…)

     
    • Grant Brown 8:44 am on May 28, 2013 Permalink | Reply

      Hey, thanks for this. I had a broken treadmill in my basement with one of these controllers in it, and your blog was the only info I could find on the pinout of the MC2100.

    • richard caput 4:05 pm on September 2, 2014 Permalink | Reply

      Excellent job on all this man, ive been hunting alot of similar topics to you as i have seen your digital “breadcrumbs” all over the web from you hunting down a burnt out resistor to your footpedal mod and now this work of art up there, looks awesome man but i suck at electronics and all i want to do is get my effn atlas 10″ spinning on this 2.5hp, i ran it on an mc60 for awhile, fried after a month, ran another mc60 burnt in 2 weeks, stumbled across an mc2100, circuit board got cracked in my backpack leaving the dump B^D , ordered arduino and as soon as it got here hooked it up to the mc2100 (arduino to wall wart, uploaded all your code to arduino and jujst deleted multiplexing call the kept halting compile, hooked both to common ground, red wire to 100k pot, wiper to A0, .47ceramic wiper to G, and like magic the arduino temporarily dissapeared in a puff of smoke. threw it in corner and ordered another. so here i sit with another arduino a whole lot of parts and im hoping you will tell me a very simple way i can hook a pot to this arduino andthe mc2100 and fill my atlas with no more than 120vDC Brush burning Fury! seriously though real paranoid to screw this up again, just need my damn lathe running so i can start hammering out my todo list.

      • schoolie 1:37 pm on September 8, 2014 Permalink | Reply

        I think this circuit should work with the code you’ve already used. You should be able to run it by simply commenting out the multiplex7seg library as you have before. You’ll notice the arduino is getting its power and ground from the MC2100 directly, it shouldn’t be plugged in to the wall or the USB port any time the MC2100 is plugged in.

        Simple Arduino Circuit
        Bigger Version…

        The on/off switch on pin 13 should be optional, I’m pretty sure it defaults to ON if nothing is connected.

        In an attempt to diagnose your earlier problem, when you say you hooked the red wire to the pot, do you mean the red wire from the MC2100? If so, depending on the position of your potentiometer, you may have applied 12v to the analog pin of the arduino, which could cause the smoke you mentioned :). The pot needs to be hooked up between a 5v source and ground, as shown in my schematic.

        Let me know if you have any more questions. Good luck!

        • Richard Caput 7:09 pm on September 10, 2014 Permalink | Reply

          Wow, thanks man this actually worked without me frying anything, i think it also goes down as my first time being truly thankful to anyone whos schooled me over the internet. My best regards to you and if you ever need a part run thats too big for your RF i work for a machinist who gives me time on his jet bridgeport clone shoot me an email and ill try to repay the favor.
          btw, i did hook the red from mc2100 to the arduino, i think the chip is fine but the board is shot, got a cheap chinese knockoff for $4.00 on ebay and other than the $26 still in my wallet it seems to me identical… Cheers!

          • Richard Caput 7:25 pm on September 10, 2014 Permalink | Reply

            Also! i have a few real pretty SKF AC (reversible) gearmotors from an invacare hospital bed identical to this http://tinypic.com/r/dxflup/8 do you see any reason why i couldnty drive this motor with the incline circuit from the mc2100 and can you think of a way i could control the speed? i would like to use it to drive my leadscrew instead of this prehistoric rubics cube of a gearbox with the atlas? I use two of these motors for powerfeed on my RF clone at home with the hospital bed controller 🙂 so they are more than powerful enough i just dont want to fry the MC by putting too much (current)? through it. thanks again!

            • schoolie 11:25 am on September 11, 2014 Permalink | Reply

              I’m glad that worked for you! Happy to help.

              I’d guess you could simply connect your motor to the incline motor terminals. The incline motor on the treadmill is a small reversible AC motor (I think). Current rating… no idea. If it does fry something, that part of the circuit is independent of the main motor circuit, so you should be OK. Never tried it though, so do so at your own risk 🙂

              To control the motor direction, I’m pretty sure applying 5v to pin 5 or 6 of the MC2100 connector (orange and yellow wires) one at a time will select fwd or rev. You can see the incline motor circuit in the MC2100 schematic (left-center) at the bottom of this post.

        • Patrick Nolan 4:18 pm on May 29, 2016 Permalink | Reply

          This circuit worked great with my 2100E board, i used a very chopped down code, variable pot, works perfectly to control on off state of relay in my emi device, and speed, thanks very much for this post, i was a bit frustrated with trying to get the board to operate. hope this helps somebody else.

          #include

          /*
          MC-2100 Treadmill Motor Controller Interface
          Lathe Motor Controller via PWM
          Seven Segment Tachometer
          ON/OFF Toggle

          Joe Schoolcraft
          Brian Schoolcraft
          May 2013
          https://sonsofinvention.wordpress.com*/

          #define POT_READ A0 //Wiper of pot connected as voltage divider (Speed Command)
          #define PWM_OUT 9 //Connected to blue wire of MC2100 (50ms period PWM out)
          #define ON_OFF 13 //On/Off Switch Input

          #define PWM_CYCLE 50.0 //Output Signal PWM Period (50ms)

          #define POT_DIF 4 //Change detection threshold on pot
          #define MAX_DUTY 869 //Max Duty Cycle expected by MC-2100 (85% of 1023)
          #define MIN_DUTY 0 //Min Duty Cycle expected by MC-2100 (0% of 1023)

          int potTemp;
          int potValue;
          int lastPotValue;
          int potCheck;
          int speedLevel;

          byte onOffState = 0;

          void setup()
          {
          pinMode(POT_READ, INPUT);
          pinMode(PWM_OUT, OUTPUT);

          Timer1.initialize(PWM_CYCLE*1000); //Set pin 9 and 10 period to 50 ms
          Timer1.pwm(PWM_OUT,25); //Start PWM at 0% duty cycle
          }

          void loop()
          {
          //Read and condition pot value
          potTemp = analogRead(POT_READ);
          potCheck = abs(potTemp – potValue);
          if(potCheck >= POT_DIF) { //Only accept new value if it’s far enough from the current accepted value
          potValue = potTemp;
          }

          speedLevel = map(potValue,0,1023,0,MAX_DUTY); //Convert Pot input to pwm level to send to MC-2100

          if (onOffState == LOW){ //Off
          Timer1.setPwmDuty(PWM_OUT, speedLevel); //Shut down MC-2100
          }

          if (onOffState == HIGH){ //ON
          Timer1.setPwmDuty(PWM_OUT,speedLevel); //Send speed command to MC-2100
          }
          }

          • FaMan 7:52 pm on January 22, 2017 Permalink | Reply

            I tried the above with an Uno board and the simplified circuit farther above, except I moved the switch connection from pin 13 to pin 12, and used a 0.22uF cap on the speed control pot (because that’s what I had). As written, the switch doesn’t work; it needs onOffState from the debounce function and both on and off are running the motor. I was pretty happy, it was my first ever Arduino project but it certainly won’t be the last. The working code is below:

            /////////////////////////////////////////////////////////////////////////////////////////////////
            #include

            /*
            MC-2100 Treadmill Motor Controller Interface
            Lathe Motor Controller via PWM
            ON/OFF Toggle

            Original from
            Joe Schoolcraft
            Brian Schoolcraft
            May 2013
            https://sonsofinvention.wordpress.com/2013/05/22/arduino-compatible-mc-2100-controller-and-lathe-tachometer/#more-389

            Updates to make it work and add debounce FanMan 170122
            */

            #define POT_READ A0 //Wiper of pot connected as voltage divider (Speed Command)
            #define PWM_OUT 9 //Connected to blue wire of MC2100 (50ms period PWM out)
            #define ON_OFF 12 //On/Off Switch Input
            #define TO_LOW_DELAY 50 //Debounce time for HI to LO switch transition
            #define TO_HIGH_DELAY 50 //Debounce time for LO to HI switch transition

            #define PWM_CYCLE 50.0 //Output Signal PWM Period (50ms)

            #define POT_DIF 4 //Change detection threshold on pot
            #define MAX_DUTY 869 //Max Duty Cycle expected by MC-2100 (85% of 1023)
            #define MIN_DUTY 0 //Min Duty Cycle expected by MC-2100 (0% of 1023)

            int potTemp;
            int potValue;
            int lastPotValue;
            int potCheck;
            int speedLevel;

            byte onOffState = 0;
            byte lastonOffState = 0;
            unsigned long lastOnOffTime = 0;

            void setup()
            {
            pinMode(POT_READ, INPUT);
            pinMode(PWM_OUT, OUTPUT);
            pinMode(ON_OFF, INPUT_PULLUP); //Enable internal pullup resistor to simplify external circuit

            Timer1.initialize(PWM_CYCLE * 1000); //Set pin 9 and 10 period to 50 ms
            Timer1.pwm(PWM_OUT, 25); //Start PWM at 0% duty cycle
            }

            void loop()
            {
            //Read and condition pot value
            potTemp = analogRead(POT_READ);
            potCheck = abs(potTemp – potValue);
            if (potCheck >= POT_DIF) { //Only accept new value if it’s far enough from the current accepted value
            potValue = potTemp;
            }

            speedLevel = map(potValue, 0, 1023, 0, MAX_DUTY); //Convert Pot input to pwm level to send to MC-2100

            onOffState = debounce(ON_OFF, &lastonOffState, &lastOnOffTime, TO_LOW_DELAY, TO_HIGH_DELAY);

            if (onOffState == LOW) { //Off switch to ground is closed
            Timer1.setPwmDuty(PWM_OUT, 0); //Shut down MC-2100
            }

            if (onOffState == HIGH) { //ON switch to ground is open
            Timer1.setPwmDuty(PWM_OUT, speedLevel); //Send speed command to MC-2100
            }

            }

            ////////////////////////////////////////////////////////////////////////////////////////////
            /* Function for debouncing digital inputs

            Arguments:
            _debouncePin – ID of pin to be read/debounced
            lastReading – pointer to variable storing the previous reading (HIGH/LOW) of the input pin
            lastDebounceTime – pointer to variable storing the last time (ms) the input changed (not debounced)
            _toLowDelay – debounce time for HIGH to LOW transition
            _toHighDelay – debounce time for LOW to HIGH transition

            Returns:
            _state – debounced state (HIGH/LOW) of _debouncePin
            */
            ////////////////////////////////////////////////////////////////////////////////////////////

            byte debounce(byte _debouncePin, byte * lastReading, unsigned long * lastDebounceTime, int _toLowDelay, int _toHighDelay)
            {
            byte _reading = digitalRead(_debouncePin);
            byte _state = *lastReading;

            if (_reading != *lastReading) { // pin state just changed
            *lastDebounceTime = millis(); // reset the debouncing timer
            }

            if ((millis() – *lastDebounceTime) >= _toLowDelay && _reading == LOW) {
            // whatever the reading is at, it’s been there for longer
            // than the hold delay, so take it as the actual current state for use in the rest of the script
            _state = _reading;
            *lastReading = _reading;
            return _state;
            }

            if ((millis() – *lastDebounceTime) >= _toHighDelay && _reading == HIGH) {
            // whatever the reading is at, it’s been there for longer
            // than the hold delay, so take it as the actual current state for use in the rest of the script
            _state = _reading;
            *lastReading = _reading;
            return _state;
            }
            *lastReading = _reading;
            return _state;
            }
            ///////////////////////////////////////////////////////////////

            • twmaster 8:37 pm on February 2, 2017 Permalink | Reply

              When I try to compile this I get an error about missing includes. I’m assuming the Timer1 library is needed? What else?

              • FaMan 8:53 pm on February 2, 2017 Permalink | Reply

                Yes, you need the timerone library. Looks like wordpress stripped out anything with angle brackets in my code above thinking it’s html? The line should be (replace the parentheses with angle brackets:

                #include (TimerOne.h)

                You can download it from https://code.google.com/archive/p/arduino-timerone/downloads then you have to install it into your development environment.

                • twmaster 2:22 pm on February 3, 2017 Permalink | Reply

                  Any chance you could repost the code with code tags? Seems the HTML has loaded the code when copied with formatting stuff and breaks the compile. (sorry to be a pain)

    • Raff 11:57 am on October 9, 2014 Permalink | Reply

      Hi schoolie,

      been using these MC2100 posts as a guide for building a belt sander/grinder using a 2.5hp 90VDC motor and i snagged an MC2100-LS board to go with it, as the Livestrong board the motor had on the treadmill doesn’t seem to easy to reverse-engineer.. Seems to run beautifully using the bit-banging code from a previous post, but I am wondering about the reed-switch setup.

      You see…. the motor I have is an amazing little Johnson DC unit that actually has a reluctor wheel and sensor on the unit itself- the tone ring is mounted to the rear threaded hole on the motor spindle, and the sensor unit is attached to the side of the motor casing. It’s a 5vdc sensor- I believe it’s optical, and I can get more information on it, but how would you go about modifying your code or what can I do to use that instead of having to resort to a magnetic reed switch setup for finding motor speed?

      The MC2100 does have a “tach” pin header for the spindle speed sensor as far as I remember (it’s not with me at the moment, but I can verify soon).

      It would be awesome to have a similar setup, and in the future I would like to utilize a similar motor for something that requires reverse/dynamic braking as well. I have a metal fabrication business that I can find a ton of uses for these cheap (used) motors. Heck, the one I got was new and I picked it up for 50 bucks. Can’t beat that! Heck, I’d buy them new if I could get them to all work similarily. It’d be great to have a bunch of uses for the same motor on a bunch of tools and keep some backups/spares incase anything goes wrong.

      Thanks for all your open-source help on this great controller/motor combo.

      • schoolie 5:32 pm on October 10, 2014 Permalink | Reply

        That sounds like a nice little motor!

        If you can get the output of the speed sensor to pull a pin of the Arduino either LOW for each tooth passing by, you’re good to go. There are a few ways to do this, depending on how the sensor’s set up. If you can tell me a bit more about the sensor, I might be able to help.

        Once you’ve got the pulse train going into pin 2 of the Arduino, all it takes is modifying the following line of code with the number of teeth on the tone wheel:

        rawSpindleSpeed = 60000/(avgInterval*NUMBER_OF_TEETH)//convert to RPM

        On another note, the tach header on the MC-2100 doesn’t necessarily have to be hooked up, but if you can get a sensor that shorts to ground (like a reed switch) once for every ~2 motor revs (mount a single magnet on a step down pulley, etc.), the MC-2100 will perform closed loop control on the motor speed, maintaining a fairly constant RPM regardless of how hard you load it. Again, it will work without this, but it’s nice if you can swing it.

        • Raff 11:31 pm on October 30, 2015 Permalink | Reply

          Wow, almost a year since getting around to actually utilizing this thing now. I have some SSR’s on the way to configure an H-Bridge for reverse rotation and dynamic braking. I will update you on that in the near future. I didn’t want to use the arduino I had been using for another project, so I just got around to buying another Arduino that fits into the case.

          The speed sensor doohicky I spoke of earlier is an 80 tooth wheel rotating through an optical sensor (opto interrupter) that uses on 5v power. It has what looks to be two ground connections (which are pinned out individually, but have continuity and are right next to one another), a 5V connection, and an “OUT” connection on the board. Looking at most of the similar breakout board solutions available for arduino, they look identical, except those have 3 pins. so I’m guessing only one GND is required to have arduino interface with it.

          I’m going to send it the proper signals and see if I can get arduino to give me back a serial output of on/off and then transpose the code into your motor control code to see if i can get spindle speed. Once I get that working, Is it possible to just take the rawSpindleSpeed reading and then divide it by 2, and have one of the arduino pins pulled to ground in relation to that number so that the MC2100 gets the signal it wants for RPM control?

        • Raff 1:04 am on November 1, 2015 Permalink | Reply

          Ok, so i got the speed sensor working. If i spin it by hand, I can get it up to about 30rpm and its fine. I can do it endlessly. If I attempt to do the same by turning the motor up to 7% duty cycle, it will read the RPM and output it (using Serial.write) about 0-10 times before it stops refreshing the serial console. It’s almost as if the buffer overflows.

          The speed control still works, but the readout does not adjust/change. Any ideas what would cause that?

          • Raff 1:06 am on November 1, 2015 Permalink | Reply

            Adding to that, I have to physically unplug the arduino unit from USB and plug it in again and re-upload the sketch to get it to reset the serial console. I am not feeding the arduino with 9Vin power from the MC2100 because I am using the serial console to view the speed for now, so I am using USB to power the arduino at the same time.

            • schoolie 10:08 am on November 2, 2015 Permalink | Reply

              Do you have anything connected to Digital Pin 2? The way my code is written, Pin 2 is set up with an interrupt to look for the reed switch closing (line 90). If you leave it floating, static charges will trigger the interrupt randomly and mess up your serial communication. That might not be it, but it’s definitely worth checking.

              Dividing the spindle speed reading by two and sending to the MC2100 should allow it to do it’s internal closed loop control. The MC2100 functioned without it for me as well, but it doesn’t control itself quite as well.

              Check out the MC2100 schematic for details on how it expects to receive the speed signal. You’re looking for HD7 pins 1&2 in the middle of the page. If I’m reading it correctly, the output from the arduino should pull the HD7 pin2 to ground through about 2kohms resistance. However, the ground that’s being referenced is the floating ground the microcontroller uses (open triangle in the schematic), not the earth ground that’s fed out through HD2. I think you’ll need to use an optoisolator or something like that to get that working correctly, but I’m really not 100% sure.

              Again, I don’t think having the speed feedback is 100% necessary, so you can just skip it for now if you have to.

              • Raff 6:53 am on November 15, 2015 Permalink | Reply

                Hey again.

                I understand what you’re saying about the speed control not being neccessary. I thought I would just say to hell with it as well… but I’d really like to get these sensors to work even for RPM display instead of rigging up a set of magnets/reed switches. It’s so elegantly integrated into the motor housing, it would be a shame not to use.

                So since I have two wheels and two sensors I tried the following:

                I removed the decoupling capacitors from the little circuit board for the optical sensor, as it is the same sensor I’ve seen on multiple schematics for arduino, and the resistors were the same values, but this one had decoupling caps. On one sensor, I removed them. And tried both- still same issue. I figured perhaps the caps were sending some sort of feedback to pin 2 via the sense line, but that doesn’t seem to be the issue.

                I made sure that the schematic for those other optoisolators reflected the schematic for the one on this little sensor board, and also checked with a DVOM to match the pinout and wire it up accordingly.

                Serial monitor still stops.

                I also tried an 8 tooth wheel (by bending and flattening 72 of the teeth on one of the encoder wheels since I had two wheels and two sensors) to see if resolution was an issue, but it doesn’t seem to make a difference.

                Right now all i’ve been doing is attempting to comment out a bunch of code to see if the issue lies within an area that has nothing to do with the sensor itself.

                I am going to detach the sensor and see if I can figure it out. but it only seems to stop the serial monitor once the motor receives a PWM signal from the MC2100. If I spin it by hand, the sensor seems endlessly ok with it! odd!

                I’ll report back soon. And my SSR’s should be here tomorrow as well! 😀

                Thanks for all your help.

                • Raff 7:37 am on November 15, 2015 Permalink | Reply

                  ok… small update:

                  I removed the DC motor case ground (which is shown on the motor label that it “must be grounded”), and the signal doesn’t cut out anymore.

                  however, even with the speed sensor wire disconnected, I am getting feedback somehow because i’m getting a speed of 60-75rpm with no speed sensor if i use pin 2.

                  I changed to pin 3 and used interrupt 1 accordingly, and i reduced the number of teeth on the encoder wheel to 4 and have gotten it to read about 1000RPM at 30% duty cycle.

                  For a 3250rpm motor, it sounds about right.

                  Just to make sure, while it was running i plugged the motor ground back into the MC2100 case ground terminal and it cut off the signal again.

                  Any ideas on what to do? should I put a filter of some sort on the ground pins that go from the header to the arduino grounds?

    • Raff 6:06 pm on October 28, 2014 Permalink | Reply

      schoolie,

      I can post pictures of the motor and setup once I tweak your code to run and display tach output onto the adafruit LCD shield, as well as PWM and whatnot. I’ll test with and without attaching the unit to the board. If I can’t get a tach output from the main header on the board with everything plugged in as is for treadmill use, I will feed the reluctor wheel sensor its power using the onboard pin header that’s there for it, and then draw the feedback signal by back probing the pin that feeds back into the board and send that to the arduino.

      One issue I’ve seen with the MC2100-LS (because that’s all I have to test with right now) is that if I ramp up the bit-banging duty cycle rapidly, it will go into overload protection and shut itself down until the controller POT is brought back down to 0% DC. Is this normal for all MC2100’s?, or part of the -LS series boards?

      I’ll be tackling this set up soon, perhaps next weekend- and I’ll post here for others to see as well. Then I’ll be creating the grinder base.

      These motors are going cheaaaaaaaap everywhere, as long as you take the treadmills away from the owners who can’t repair them. Sometimes for free!

      Thanks for all your documentation on this amazing combination of useable goodies.

      • Raff 6:06 pm on October 28, 2014 Permalink | Reply

        i meant for that to be a reply to your previous message. sorry!

    • Roy 12:14 am on November 26, 2014 Permalink | Reply

      First of all awesome build. I am looking to do the same thing but I am putting mine on a Harbor Freight knee mill (hopefully my lathe some day too).
      I am hoping you have a complete parts list for this. I already have the major parts- motor, 2100, arduino, display- but I need to know what caps and resistors you used. Such as the voltages…etc of c4, c5, c6…
      Also it looks like you used 2 reed switches- did you mount them in the same place on the spindle? (I was not sure if the double magnet would wreak havoc on the 2100 reed sensor- I am guessing not since I believe that is simply a movement sensor).
      Once I get it setup to the point of writing software I know I will have to mod yours since I have a single 4 digit 7 segment display and mine is 12 pin common anode, as well as wire my display a accordingly.
      On your arduino mc2100 schematic- it looks like all the items to the left of the ATmega box is all the items that would be built “into” an premade arduino.
      This is my first arduino build so it has been quite the learning experience. Thank for all the information so far!

      • schoolie 4:31 pm on December 1, 2014 Permalink | Reply

        The schematic I described in this comment should be all you need to get the MC2100 to operate. The parts required for this are simply a 220 ohm resistor, a potentiometer (any value will do, I used a 10k), and a capacitor for smoothing the reading from the pot (I used a 0.47 uF).

        Only one reed switch goes to the arduino for sensing speed. I put 2 magnets directly on the spindle of the lathe, so the speed sensor pulses twice per spindle revolution. The second reed switch is used to give the MC2100 the signal it needs for closed loop control of the motor speed. It’s not necessary for operation, but it’s nice if you can find a good place to put it. I’ve found through trial and error that the MC2100 is expecting 1 pulse for approximately every 2 revolutions of the motor, so find a place in your drivetrain where you can get close to that and stick a magnet (or more if it’s slower) and a sensor.

        From there, just figure out how to hookup your 7 segment display, and change the pin definitions at the top of the file accordingly. 4 of the pins on your display should be “digit select” and 8 should be “segment select”. Because your display is common anode, you should be able to use this library to drive it, just follow the instructions for hooking it up. Edit: got the anode/cathode thing wrong… you’ll have to use my modified version of that library to get your common anode display working

    • Malcolm 2:38 pm on December 19, 2014 Permalink | Reply

      Holy COW! You guys saved me so much time! I was thinking I was going to have to figure this all out on my own and here it all is! I quick and dirtied the LED RPM free version of this and it worked on the first try! Now I just need to figure how to set the magnets, and wire the display to get the RPM working. I believe I have a 4 digit common anode display in my stuff, but I’ve never wired it up.

      One question. Why power the 7 segment LED from the 12V with a regulator instead of using the 5V from the controller? Anyway, thanks soooo much!!!

      • schoolie 1:30 pm on December 20, 2014 Permalink | Reply

        Awesome, glad it’s working for you!

        The 5v reg in the schematic is the power supply for the entire circuit, not just the 7 seg display. The schematic inlcudes the arduino compatible circuit built “from scratch.” If you’re using an off the shelf Arduino and the current requirements of the display are within the Arduino’s limits, you’ll be fine just using the onboard regulator. Good luck!

    • Roy 11:50 pm on December 21, 2014 Permalink | Reply

      Thanks for the update, I do have a few more questions. I think I wasn’t completely clear. I am using an off the shelf arduino and not building it from scratch. So I am trying to figure out what parts I will still need from your schematic. I am using recycled parts from my crap bin and think I have gathered all the needed parts. Above you said you used a .47uf capacitor for the pot, but in the “gut shot” pic I see a black 4.7uf cap but do not see that on the schematic- I just want to make sure it was not a typo.

      Also I noticed something in the body that was confusing- talking about common anode/cathode displays:

      “Display Spindle Speed on LED Display

      For the display portion of the build, I used a couple two digit 7 segment displays from a treadmill’s dash panel. A brief overview of interfacing 7 segment displays with Arduino can be found here. Like most microcontroller topics, this one has two parts: the hardware and the software. For the hardware, I built a fairly standard 7 segment display circuit, with one exception. “”””””My displays were common ANODE (all the LED’s in the display share their positive pin), while most are common ANODE””””””.”

      I read that part to be a typo and that yours really were common cathode since you had to modify code and most are common cathode. I now understand that yours are actually common anode like mine. Thanks for the info so far, I will update as I progress.

      • Malcolm 12:26 pm on December 22, 2014 Permalink | Reply

        Hi Roy. I’m exactly where you are at the moment, mocking it up with a stock Arduino Uno and seeing what extra parts I need. My plan is to use a Pro Mini when once I’ve got it working. I also have a common anode display. Depending on your display, you may be able to use the 5V output from the Uno to power it with only a single resistor on each of the segment’s cathode legs. Do you have the data sheet for your display? Failing that, you could do some quick experiments lighting just a single segment from your Uno’s 5V. You can get a ballpark idea for the resistor if you know what color the display is. I’m actually going to use the transistor set up as shown in the project’s schematic as I don’t want to tax the Uno’s output. I just began wiring it all up last night, so I’ll let you know how it goes today.

        • Roy 12:42 pm on December 22, 2014 Permalink | Reply

          According to what I had read trying to power the display off the Arduino would be too much for it to handle, we need to make the power circuit. I have a ton of transistors but not the ones listed above, so I will be at a stand still until I can get those.

          • schoolie 1:07 am on January 2, 2015 Permalink | Reply

            There’s nothing special about the transistors I chose to use, at least not that I know of. My knowledge of transistor selection is minimal, but most PNP transistors should work. The right kind of JFET or MOSFET would work as well, you just need something that can handle switching the current of the leds.

            Making the power circuit is definitely not a bad idea 🙂

      • schoolie 1:05 am on January 2, 2015 Permalink | Reply

        Yes, Roy, you’re correct. My display is common anode. I’ve edited the post to fix that mistake. Sorry I keep messing that up…

    • tumoheat 6:30 pm on May 21, 2015 Permalink | Reply

      Great information. I was stuck till I saw your post about the missing 240 ohm resistor coming from the control panel. Now I can run the motor via PWM from my Arduino! Quick question, can I run two DC motors off of the MC-2100 controller? I’m building a pitching machine for my nephew and probably won’t crank it any where near the maximum voltage. Or do you think I’ll overload the board?

      • schoolie 10:29 pm on May 21, 2015 Permalink | Reply

        I can’t say for sure, but I’d guess running two motors in parallel would be OK. The board has a current sense resistor, so it self limits when overloaded. At least it does to some extent… I’d be interested to see how it works out!

    • Junior 9:39 am on August 12, 2015 Permalink | Reply

      Has anyone come up with code for using the LCD keypad shield + MC2100 / Reed switch for simeple lathe operation and tach? Ive been trying to do it but it might be a bit too much for me, ive been trying to hack together Schoolies code with the lcd keypad code but i havent gotten anytihing but the lcd printing “Lathe RPM” hehe, so please if anyone reading this out there can help please do or email me at keyser1soze6@gmail.com . Not to hijack your project schoolie but this site seems to be a repository of MC2100 info

      • Junior 9:12 am on August 14, 2015 Permalink | Reply

        Can anyone help me figure out what im doing wrong? ive been just trying to modify (hack) schoolies code to work with this 16,2 Sainsmart LCD Keypad to have up + pwm and down button – but im getting nowhere.

        /*

        Modified from

        MC-2100 Treadmill Motor Controller Interface
        Lathe Motor Controller via PWM
        Seven Segment Tachometer
        ON/OFF Toggle

        Joe Schoolcraft
        Brian Schoolcraft
        May 2013
        https://sonsofinvention.wordpress.com/

        And Sainsmart LCD Shield

        This program demonstrates button detection, LCD text/number printing,
        and LCD backlight control on the Freetronics LCD & Keypad Shield, connected to an Arduino board.

        After powerup, the screen looks like this:

        ——————
        |Freetronics 16×2|
        |Btn: 0 | <- This time value counts up the number of seconds since reset (overflows at 99)
        ——————

        When a button is pressed, a label appears for it:

        ——————
        |Freetronics 16×2|
        |Btn:RIGHT 0 |
        ——————
        Labels are LEFT, UP, DOWN, RIGHT and SELECT-FLASH.
        SELECT-FLASH makes the LCD backlight flash off and on when held down.

        Pins used by LCD & Keypad Shield:

        A0: Buttons, analog input from voltage ladder
        D4: LCD bit 4
        D5: LCD bit 5
        D6: LCD bit 6
        D7: LCD bit 7
        D8: LCD RS
        D9: LCD E
        D3: LCD Backlight (high = on, also has pullup high so default is on)

        ADC voltages for the 5 buttons on analog input pin A0:

        RIGHT: 0.00V : 0 @ 8bit ; 0 @ 10 bit
        UP: 0.71V : 36 @ 8bit ; 145 @ 10 bit
        DOWN: 1.61V : 82 @ 8bit ; 329 @ 10 bit
        LEFT: 2.47V : 126 @ 8bit ; 505 @ 10 bit
        SELECT: 3.62V : 185 @ 8bit ; 741 @ 10 bit

        /*————————————————————————————–
        Includes
        ————————————————————————————–*/
        #include
        #include
        #include // include LCD library
        /*————————————————————————————–
        Defines
        ————————————————————————————–*/
        // Pins in use

        #define ON_OFF 13 //On/Off Switch Input

        #define PWM_CYCLE 50.0 //Output Signal PWM Period (50ms)
        #define MAX_DUTY 869 //Max Duty Cycle expected by MC-2100 (85% of 1023)
        #define MIN_DUTY 0
        #define PWM_OUT 11
        #define BUTTON_ADC_PIN A0 // A0 is the button ADC input
        #define LCD_BACKLIGHT_PIN 3 // D3 controls LCD backlight
        // ADC readings expected for the 5 buttons on the ADC input
        #define RIGHT_10BIT_ADC 0 // right
        #define UP_10BIT_ADC 145 // up
        #define DOWN_10BIT_ADC 329 // down
        #define LEFT_10BIT_ADC 505 // left
        #define SELECT_10BIT_ADC 741 // right
        #define BUTTONHYSTERESIS 10 // hysteresis for valid button sensing window
        //return values for ReadButtons()
        #define BUTTON_NONE 0 //
        #define BUTTON_RIGHT 1 //
        #define BUTTON_UP 2 //
        #define BUTTON_DOWN 3 //
        #define BUTTON_LEFT 4 //
        #define BUTTON_SELECT 5 //
        //some example macros with friendly labels for LCD backlight/pin control, tested and can be swapped into the example code as you like
        #define LCD_BACKLIGHT_OFF() digitalWrite( LCD_BACKLIGHT_PIN, LOW )
        #define LCD_BACKLIGHT_ON() digitalWrite( LCD_BACKLIGHT_PIN, HIGH )
        #define LCD_BACKLIGHT(state) { if( state ){digitalWrite( LCD_BACKLIGHT_PIN, HIGH );}else{digitalWrite( LCD_BACKLIGHT_PIN, LOW );} }

        int speed1(0);

        /*————————————————————————————–
        Variables
        ————————————————————————————–*/
        byte buttonJustPressed = false; //this will be true after a ReadButtons() call if triggered
        byte buttonJustReleased = false; //this will be true after a ReadButtons() call if triggered
        byte buttonWas = BUTTON_NONE; //used by ReadButtons() for detection of button events
        /*————————————————————————————–
        Init the LCD library with the LCD pins to be used
        ————————————————————————————–*/
        LiquidCrystal lcd( 8, 9, 4, 5, 6, 7 ); //Pins for the freetronics 16×2 LCD shield. LCD: ( RS, E, LCD-D4, LCD-D5, LCD-D6, LCD-D7 )
        /*————————————————————————————–
        setup()
        Called by the Arduino framework once, before the main loop begins
        ————————————————————————————–*/
        void setup()
        {
        Timer1.initialize(PWM_OUT*1000); //Set pin 9 and 10 period to 50 ms
        Timer1.pwm(11,0,1000); //Start PWM at 0% duty cycle
        //button adc input
        pinMode( BUTTON_ADC_PIN, INPUT ); //ensure A0 is an input
        digitalWrite( BUTTON_ADC_PIN, LOW ); //ensure pullup is off on A0
        //lcd backlight control
        digitalWrite( LCD_BACKLIGHT_PIN, HIGH ); //backlight control pin D3 is high (on)
        pinMode( LCD_BACKLIGHT_PIN, OUTPUT ); //D3 is an output
        //set up the LCD number of columns and rows:
        lcd.begin( 16, 2 );
        //Print some initial text to the LCD.
        lcd.setCursor( 0, 0 ); //top left
        // 1234567890123456
        lcd.print( “Lathe Speed” );
        //
        lcd.setCursor( 0, 1 ); //bottom left
        // 1234567890123456
        lcd.print( “Speed = (speed1) “);
        }
        /*————————————————————————————–
        loop()
        Arduino main loop
        ————————————————————————————–*/
        void loop()
        {
        byte button;

        //get the latest button pressed, also the buttonJustPressed, buttonJustReleased flags
        button = ReadButtons();
        //blank the demo text line if a new button is pressed or released, ready for a new label to be written
        if( buttonJustPressed || buttonJustReleased )
        {
        lcd.setCursor( 0, 0 );
        lcd.print( “Lathe Speed”);
        lcd.setCursor(8 , 1 );
        lcd.print(“Press Up/Dwn”);
        }
        //show text label for the button pressed
        switch( button )
        {
        case BUTTON_NONE:
        {
        break;
        }
        case BUTTON_RIGHT:
        {
        lcd.setCursor( 0, 0 );
        lcd.print( “RIGHT” );
        break;
        }
        case BUTTON_UP:
        {
        lcd.setCursor( 0 , 0 );
        lcd.print( “Increasing” );
        speed1 = (speed1 + 3);
        Timer1.setPwmDuty(PWM_OUT,speed1);
        Timer1.pwm(PWM_OUT, 0);
        lcd.setCursor( 0 , 1 );
        lcd.print(speed1);

        break;
        }
        case BUTTON_DOWN:
        {
        lcd.setCursor( 0 , 0 );
        lcd.print( “Decreasing” );
        speed1 = (speed1 – 100);
        Timer1.setPwmDuty(PWM_OUT,speed1);
        lcd.setCursor( 0 , 1 );
        lcd.print(speed1);
        }
        case BUTTON_LEFT:
        {
        lcd.setCursor( 0 , 0 );
        lcd.print( “STOP” );
        Timer1.setPwmDuty(PWM_OUT , 0);
        speed1 = (0);
        lcd.setCursor( 0 , 1 );
        lcd.print(speed1);
        }
        case BUTTON_SELECT:
        {
        lcd.setCursor( 0, 0 );
        lcd.print(PWM_OUT);

        /* an example of LCD backlight control via macros with nice labels
        LCD_BACKLIGHT_OFF();
        delay( 150 );
        LCD_BACKLIGHT_ON(); //leave the backlight on at exit
        delay( 150 );
        */

        /*
        // an example of LCD backlight control via a macro with nice label, called with a value
        LCD_BACKLIGHT(false);
        delay( 150 );
        LCD_BACKLIGHT(true); //leave the backlight on at exit
        delay( 150 );
        */

        break;
        }
        default:
        {
        break;
        }
        }
        // print the number of seconds since reset (two digits only)

        /*
        //debug/test display of the adc reading for the button input voltage pin.
        lcd.setCursor(12, 0);
        lcd.print( ” ” ); //quick hack to blank over default left-justification from lcd.print()
        lcd.setCursor(12, 0); //note the value will be flickering/faint on the LCD
        lcd.print( analogRead( BUTTON_ADC_PIN ) );
        */
        //clear the buttonJustPressed or buttonJustReleased flags, they’ve already done their job now.
        if( buttonJustPressed )
        buttonJustPressed = false;
        if( buttonJustReleased )
        buttonJustReleased = false;
        }
        /*————————————————————————————–
        ReadButtons()
        Detect the button pressed and return the value
        Uses global values buttonWas, buttonJustPressed, buttonJustReleased.
        ————————————————————————————–*/
        byte ReadButtons()
        {
        unsigned int buttonVoltage;
        byte button = BUTTON_NONE; // return no button pressed if the below checks don’t write to btn

        //read the button ADC pin voltage
        buttonVoltage = analogRead( BUTTON_ADC_PIN );
        //sense if the voltage falls within valid voltage windows
        if( buttonVoltage = ( UP_10BIT_ADC – BUTTONHYSTERESIS )
        && buttonVoltage = ( DOWN_10BIT_ADC – BUTTONHYSTERESIS )
        && buttonVoltage = ( LEFT_10BIT_ADC – BUTTONHYSTERESIS )
        && buttonVoltage = ( SELECT_10BIT_ADC – BUTTONHYSTERESIS )
        && buttonVoltage <= ( SELECT_10BIT_ADC + BUTTONHYSTERESIS ) )
        {
        button = BUTTON_SELECT;
        }
        //handle button flags for just pressed and just released events
        if( ( buttonWas == BUTTON_NONE ) && ( button != BUTTON_NONE ) )
        {
        //the button was just pressed, set buttonJustPressed, this can optionally be used to trigger a once-off action for a button press event
        //it's the duty of the receiver to clear these flags if it wants to detect a new button change event
        buttonJustPressed = true;
        buttonJustReleased = false;
        }
        if( ( buttonWas != BUTTON_NONE ) && ( button == BUTTON_NONE ) )
        {
        buttonJustPressed = false;
        buttonJustReleased = true;
        }

        //save the latest button value, for change event detection next time round
        buttonWas = button;

        return( button );
        }

    • Mark 1:08 am on December 28, 2015 Permalink | Reply

      Thanks so much for sharing this project and documenting it so well. This was extremely helpful in my upgrade to my Harbor Freight mill. I have shared a link to this post on my blog about the build. You can see it at http://www.mendingthings.com/?page_id=783

    • Paul Tinguely 6:19 pm on June 14, 2016 Permalink | Reply

      Excellent blog! wondering if you have found a schematic diagram for the MC-2100? I’m a retired digital engineer and would like to get involved in some similar projects.
      Any help would be greatly appreciated!
      Paul

    • Chris 9:30 am on July 4, 2016 Permalink | Reply

      What is the type of fuse on the mc2100e board please? Have 2 of these boards but no fuses! Have Looked everywhere but can’t find value, many thanks.

    • Jimmy 11:37 am on August 2, 2016 Permalink | Reply

      Thanks so much for sharing your work! I have a treadmill with the MC2100LT and this will be so helpful in repairing it and looking for others for future projects with the Arduino. Great job

    • twmaster 7:46 pm on October 8, 2016 Permalink | Reply

      Ok. This is just what I need. I picked up free treadmill today and it has an MC2100 inside. I used to toss those controllers as I could not figure out their signal needs. Thank you.

c
Compose new post
j
Next post/Next comment
k
Previous post/Previous comment
r
Reply
e
Edit
o
Show/Hide comments
t
Go to top
l
Go to login
h
Show/Hide help
shift + esc
Cancel