Help on which board to purchase.

Hey all! I have a few projects in mind, but the first is a stitch regulator for my sisters quilting machine. I need to make a unit that will read two rotary (optical I believe) sensors, one on an x-axis and one on a y-axis. I would also like to add a port for a remote engage/dis-engage switch (meaning the needle and motor will not run unless it is engaged) as well as a master on/off switch. Of course I will need a power chord attached as well as a chord to connect to the original foot switch plug that I am replacing with the stitch regulator. Can you recommend what arduino board will work for this project? Also any reading or books you recommend to help me get through this. If this goes well I will adding two motors and diving into the project of making the unit move on by a computer on the x and y axis. But first I want to control the speeds.

I have a stitch regulator I have been staring at, but the problems with the cheaper models in the stores is when the unit is engaged the needle moves at a slow constant speed until you start moving the x or y axis. This is not good. I do not want the needle moving unless there is movement in the x or y axis or a combination. No movement should mean no needle moving, that is the goal. Units that work this way are out of my price range.

I saw an older post of someone working on a similar concept, but the info was a bit vague and not written clearly. Some other questions.

Once the arduino board accepts the signals from the rotary encoders x and y, it will need to be setup to compute the speed of the needle which is the third side of the triangle (I’m assuming x^2 + y^2 = speed^2). Then the unit will have to send that speed signal (which is I’m assuming an amount of current similar to pushing the foot pedal down on a regular machine) to the motor. The motor on the machine I’m using is a 1 H.P. servo motor. I believe this is an AC/DC universal motor. Thanks in advance for anyone offering information.

Trevor

Make a list of the IO needed:
Rotary encoder 1: 2 pins
Rotary encoder 2: 2 pins
Engage switch: 1 pin
Master switch: 1 pin
Original footswitch (analog?): 1 pin
Motor control speed: 1 pin

total: 8 pins
Sounds like an Uno would fit the bill.
You will need some extra hardware for the arduino to control to supply the motor current, once you figure out what it is. This is too vague:
"The motor on the machine I’m using is a 1 H.P. servo motor. I believe this is an AC/DC universal motor."

Photo's of the existing motor, its nameplate, the controller etc can all help us get an idea of the setup...

Sorry for the delay guys! Thank you so much for getting involved. I took photos of the stitch regulator (the one that doesn’t work the way I want), the motor on the sewing machine, and the rotary encoders. Hope this helps.

I also noticed when I wrote down the description I was off on one pin.

2 pin : x-axis encoder
2 pin : y-axis encoder
1 pin : Remote engage switch (allows power to flow only when encoders read signals)
1 pin : Wire for plugging into sewing machine (where foot pedal and power cord were)
1 pin : Wire for power cord to oulet
1 pin : Main on/off switch
1 pin : Knob for controlling stitch length (This I assume is like a master signal for the signal received from the 2 encoders. see photo)

So I think I see 9 items. Thanks again for the help! I’ll add more photos on another post.
Trevor

More photos

more photos

Pictures of encoders. US Digital E4P’s

Any help on this? Recommendations on reading material to make this work?

T-Rockem:
Any help on this? Recommendations on reading material to make this work?

I would recommend that you start by reading reply #1.

Thanks. I did read the first comment and have been researching the Arduino Uno for the project. But that wasn’t the latest question. I will be more specific. I will use the Arduino Uno and two E4P Encoders made by US Digital, http://www.usdigital.com/assets/datasheets/E4P_datasheet.pdf?k=634918673811034547, in particular with this setup on option 3, Custom Solutions | US Digital. I will then connect these to the board X-axis encoder pin A to Pin 2 on board and pin B to pin 3, then, Y-axis Encoder pin A to Pin 4 and pin B to Pin 5. My first stumbling block is the code in this area. Which is why I asked for good reading resources. I am trying to learn.

My understanding is I need to state in the sketch which encoders are connected to which pins, ex. “const int XENCA = 2; // X encoder A connected to pin 2” and then do this for all 4 connections? By all means tell me when I go astray. (A side note the motor will be connected at pin 9 for using PWM output and for now we’ll ignore the other buttons.)

Next I need to set the variables to store, ex. “int val = 0; // variable to store” but I am confused as to why when I wrote the code and tried to store the variable from each of the 4 pins from the encoders I got an error? It only wanted val = 0? Why not val = 2, val = 3, etc. The reason I ask is I am aware I need to keep one variable from each encoder in order to calculate angular velocity. Maybe I am reading this incorrectly and this is only stating it will store the information in general?

Third I would setup my “voice setup()” and use “Serial.begin(9600);” to send and receive data, “pinMode(XENCA, INPUT); // XENCA is an INPUT
pinMode(XENCB, OUTPUT); // XENCB is an OUTPUT” etc. To state which pin is sending and receiving.

Fourth is my “void loop()”. A few more questions come up here. Do I use the digitalRead command? I thought digitalRead only answered yes and no and analogRead answered variables? I might be over thinking this.

Then “Serial.println(val);”.

Then I hit a stumbling block when I wanted to input a code for angular velocity. I need to do something like this, but arduino didn’t like it.
newPosition = POS;
newTime = ClockTime; // to save current values of position and time
vel = (sqrt((newPositionX - oldPositionX) * (newPositionX - oldPositionX)) + ((newPositionY - oldPositionY) * (newPositionY - oldPositionY))) / (newTime - oldTime); // calculates angular velocity in counts per second
oldPosition = newPosition; // saves current values of position and time for the next calculation of velocity
oldTime = newTime;
delay(1); // wait 1ms between each send

Any recommendation on how to rectify my coding? I’m probably missing something stupid.

Then from this code I will begin to scale the velocity to send to the PWM output on pin 9. As the machine speed will only speed up and stop (slowly not immediately - like a second or less) I believe I do not need to change the zero speed to 127. B/c the motor will only run in one direction when using this setup so zero speed will be 0 and high speed 256. So I believe the “AnalogOut = 256(Vel/MotorMaxVel)”

Then the “MotorMaxVel = (MotorMaxVelRPS)(4 x EncoderPPR)” I’m still picturing this part in my head. Does this sound like I’m on the right track?