loading

Hello.

On this instruction i'll give some tricks how to use arduino (or other MK) in industry. What problems will appear and how I fix it.

I have order to fix broken PC on Wohlenberg cutting machine(on video you can see one of the first edition of my arduino). New original PC for this machine costs 3000+$.

What do my arduino do

1. Display size using internal high speed encoder (25imp/mm) and tft screen

2. Create 40 programs with 40 position for cutting

3. Fully control motors (in auto mode enable)

4. Next step position after cutting

5. Autocallibration in 15 steps (for machine in video, and operator controlled calibration call)

6. Fully configurable system for any cutting machine

7. Support 3 buttons and matrix keyboard (in new revision I added USB keyboard support)

8. Power filter

9. Debounce filters

10. And many other function

In the next steps i'll describe some problems and how i fix it.

Step 1: Casing. How to Create Custom Case for Any Project

When you build your project in the same step you'll need casing for mounting.

I create drawing in CAD software. 3D model with all holes. I use usually 3-4mm acryl. 3d model export to dxf drowing than to laser cutting. Cutted model i fold to finished case like in photo

Step 2: Power Supply

Ihere is a realy big problem with power supply in industrial machines.

What I have

1. 36 V, 24 V (usually),15 V (yes i saw this), 12 V, 9 V, 5 V.

2. All voltages have a bounce. If you'll needed i can attach data from oscilograph

3. Internal power supply of machine dislike when you connect something strange

4. when you add external power supply 110-220V to 5v to arduino - your arduino will work terrible. in some cases voltage will fall to 4V!!!

How i fix it

1. I install my own industrial pulse power supply 380-220-100V ACto 24VDC or to 12VDC (30$+)

2. To my power supply i add 3A DC-DC converter and configure it to 5VDC out.

3. DC-DC i connect directly to ARDUINO. It means, i connect DC-DC out-negative to arduino ground, DC-DC out-positive to arduino +5V to the pins directly on board. In this case i'll have stabilized 5V for all my components.

Step 3: Incoming Signals Filtering

Also is another big problem that incoming signals in machines can be 36-24-12VDC on logical 1 with bounce. Using resistors or optocouples can help only partial. When signal changes, its state thousand times per second and it become a real problem. Thats why i constructed a filter.

I connect a signal wire to input channel, Machine ground and Machine +24(36,12,etc.).

To output channel i connect arduino.

In this case MK ground and Machine ground will be separated.

Note! - inverted logic

Step 4: Keyboard

After 3 month of working matrix keyboard became broken. I added support of usb keyboad to arduino.

Connect USB port:

1. USB positive-to arduino +5

2. USB negative - arduino ground

3. USB data+ - Arduino port 21 (or any port with interrupt)

4. USB data- - Arduino port 20 (or any port with interrupt)

Connect Keyboard to new USB port

Now download PS2Keyboard library from github or my fixed library from included files

Add to your sketch

#include PS2Keyboard.h (download this library)

void setup()

{

...

keyboard.begin(DataPin, IRQpin, PS2Keymap_US);

...

}

call this code inside encoder IRQ function

void encoder_irq()

{

....

char USB_key()
{key_filterred=NO_KEY; if (keyboard.available()) { int c = keyboard.read(); switch (c) { case 48: return '0'; break; case 46: return '#'; break; // . cancel case 13: return '*'; break;//enter case 49: return '1'; break; case 50: return '2'; break; case 51: return '3'; break; case 52: return '4'; break; case 53: return '5'; break; case 54: return '6'; break; case 55: return '7'; break; case 56: return '8'; break; case 57: return '9'; break; case 43: return '+'; break;//+ case 45: return '-'; break;//- case 127: return 'R'; break;//back space case 42: return 'e'; break;//** case 47: return 'd'; break;// / //- case 118: return 'B'; break;//Button1 cancel case 117: return 'A'; break; case 116: return 'D'; break; case 115: return 'C'; break; case 119: return 'n'; break;//num }

Step 5: Encoder

Power encoder from arduino (usually it will be 5V encoder).

Info lines from encoder connect to filter.

Call encoder using interupt!!! when youll use timer you'll miss steps.

Connecting encoder directly to arduino - you'll miss or get extrastep when motors working. Long wires and electrical noise... I spend many nights and test ideas but... only this is a good solution. Encoder-filter-microcontroller

If someone will ask about encoder code or its connection - i'll add this part

upd 30.08.2016 added encoder source

void setup ()

{

detachInterrupt(0);

pinMode(encoder0PinA, INPUT);

digitalWrite(encoder0PinA, HIGH); // turn on pullup resistor

pinMode(encoder0PinB, INPUT);

digitalWrite(encoder0PinB, HIGH); // turn on pullup resistor

attachInterrupt(0, doEncoder, RISING); // encoder pin on interrupt 0 - pin 2

}

void doEncoder()

{
unsigned long now = micros();

unsigned long interval = now - lastPulseTime;

if (interval > 5)
{

if (digitalRead(encoder0PinB) == HIGH) { // found a low-to-high on channel A

if (digitalRead(encoder0PinA) == LOW) { // check channel B to see which way // encoder is turning

encoder0Pos = encoder0Pos + 1; // CCW

} else {

encoder0Pos = encoder0Pos - 1; // CW

}

}

else // found a high-to-low on channel A

{

if (digitalRead(encoder0PinA) == LOW) { // check channel B to see which way // encoder is turning encoder0Pos = encoder0Pos - 1; // CW

} else {

encoder0Pos = encoder0Pos + 1; // CCW

}

}

}

Step 6: Finally

Out signals are the simplest task. You can use relay module....

Finally using this tricks i build more than 10 machines for different tasks

Thanks for reading

<p>Hello.</p><p>I used a XCC1406pr01k type encoder, the system not miss much, so I used the library &lt;digitalWriteFast.h&gt;. it works very well even with two interruptions.</p><p>I need more detail on the filter (Step 3: Incoming signals filtering)</p><p>and position control for the automatic mode</p>
<p>Attached image of filter.</p><p>algorythm of machine start.</p><p>1. power on</p><p>2. press button on screen like &quot;calibrate&quot;</p><p>on machine side</p><p>1. move backgauge from user to end of table</p><p>1.1 on the end of table are 2 buttons(stopbuttons)</p><p>1.1.1 first button change speed of backgauge from high to low</p><p>1.1.2 second button stop moove</p><p>1.2. both buttons connected directly to machine circuit. you can not control it, but you can get impulse from it(probably)</p><p>1.2.1 i have no pulse from this buttons. i checked time and pulse from encoder</p><p>2. if move-from-user is on AND no pulse from encoder =&gt; max point. move from max point to user slow</p><p>3. when you'll get pulse from checkpoint - calibrate ok</p><p>3.1 on moment when you'll get checkpoint pulse - start to calculate pulses(or mm or inch) </p>
<p>I work almost on the same project.</p><p>I am about to connect the encoder to Arduino, the comtage are conducted in very well.</p><p>As soon as the engine start Arduino begins calculated anyhow</p><p>so I need more detail on step 5.</p><p>thank you in advance</p>
<p>upd. added encoder source code</p><p>Hello.</p><p>Probably problem that you not using the filter.<br>Simplest way:<br>1. Change interrupt occure (rasing, falling, etc)<br>2. Add to info lines small capacitor<br>3. Interrupt without timers<br>4. Read only one interrupt from channel a/b not both<br>5. 1imp/rotation channel use without interrupt...<br><br>I'll check all steps and add some source code for interrupt part</p>
<p>thank you very much</p><p>It was a great help. </p>
<p>..... But a buck type conversion would be more energy efficient as I am running off a solar charged battery?</p>
<p>Just remembered that one man last year patented dc-dc for 1.5V AAA battery.</p><p>His dc-dc will give stabilized 1.5Vout on 1.5-0.2V in. When battery fully discharge - just insert new battery.</p><p>UPD3. One science team in Lviv Polytechnical University contract for China solar panels with efficiency 40+%. Check on alibaba and ebay bags with solar panels</p>
<p>I'm thinking of using one of these:</p><p>TracoPower TEN 20-2411WIN 20W DC-DC Converter 9 - 36V DC In 5V DC 4000</p><p>but seems quite expensive at $60 ??</p>
110-220VAC to 12VDC and dc-dc = 20$
<p>I'm thinking of using one of these:</p><p>TracoPower TEN 20-2411WIN 20W DC-DC Converter 9 - 36V DC In 5V DC 4000</p><p>but seems quite expensive at $60 ??</p>
<p>Nice! DC to DC power conversion is a good tip. Need to use this in my current project.</p>
<p>Ttake 110VADC with 3-6A and than DC-DC. In that case all your add-in modules will have anought power.</p><p>I connected to one stepper 2 mega boards, 20Relay modules, LCD and TFT modules and I did not notice the loss of voltage.</p>
Good job!!

About This Instructable

4,590views

87favorites

License:

Bio: Steampunk artist, scientist, engineer
More by prototype_mechanic:Nixie Watch Prototype_C Universal Measure and Control System for SCIENCE Purposes Atmega 8\xx8 standalone (noquartz) like Arduino programing 
Add instructable to: