MechMate CNC Router Forum

Go Back   MechMate CNC Router Forum > Electrical & Electronic > 70. Control Systems
Register Options Profile Last 1 | 3 | 7 Days Search Today's Posts Mark Forums Read

Reply
 
Thread Tools
  #1  
Old Thu 03 November 2011, 16:32
Richards
Just call me: Mike
 
South Jordan, UT
United States of America
Using an Arduino to solve common interface problems

One of the problems that I've often had was justifying the expense of building a computer interface to solve some of the more simple problems that I've been asked to solve. To most people, it always seems like a simple problem when they ask, "How difficult could it be to connect some push-button switches to this controller?" or "How difficult could it be to add some indicator lights to that controller?" What looks like a simple problem to those who haven't had to deal with bouncing switch contacts or high current/high voltage lights, is that the real world and little computers don't get along very well.

Knowing that it will cost at least $200 to have a proto-type circuit board fabricated, after I've spent a week designing the schematics and another week writing and debugging code means that a simple project that only needs $10 worth of parts suddenly is a project costing hundreds and even thousands of dollars.

When I try to tactfully tell customers and friends that they can't afford to do what they want to do, unless they're planning on building a lot of those computers, many of them just think that I'm getting old and crotchety.

Yesterday, I finally found a practical solution for MANY of those types of problems. (A few of you have even mentioned that solution in some of your posts - but I never associated that solution as a general purpose solution for most I/O problems.) Someone emailed me and asked whether I thought that the Arduino Uno micro-controller board could be used to make hooking up switches and sensors easier on a CNC machine. The first thing I asked myself is, "What is an Arduino Uno?"

It turns out that an Italian company has been making simple computer boards using an inexpensive micro-processor - for years. They not only make the hardware, but they've designed some excellent software that makes it easy for non-programmers to do the kinds of things that a lot of you are trying to do.

Here in the United States, the Arduino Uno costs less than $30 from a variety of suppliers. The software is free. Tutorials, some even having videos, are available on the Internet.

The Arduino just plugs into the USB port on your Windows, Mac, or Linux computer (yes, it works with all three). It has connectors for a lot of inputs and outputs. It has two clock/timers. It does everything that you would expect a micro-controller to be able to do. As frosting on the cake, the Arduino Uno can also be used to program other Atmel AVR chips so that you can use a chip costing as little as $1.50 to solve fairly large problems.

Granted, the Arduino doesn't solve all interfacing problems (anything but a 5V device still has to have an opto-isolator or other interface chip to convert voltages and high-current/high-voltage devices still have to use an Opto-22 G4 module or other device), but the Arduino sure makes it easier to debounce switches, multiplex sensors, and turn on lights and alarms when something goes wrong.

It's something that is affordable and easy to use. It was designed to help everyone do things that only programmers and engineers have been able to do in the past.

So, the next time someone asks me if I could design a simple interface for them, my first response will be to ask, "Have you evaluated the Arduino Uno board yet?"
Reply With Quote
  #2  
Old Thu 03 November 2011, 17:38
Surfcnc
Just call me: Ross #74
 
Queensland
Australia
Hi Mike

I see you have discovered the Arduino, it seems to be a real internet phenomenon at the moment.
As an additional piece of information to your post, "shields" in Arduino parlance add extra functionality to the basic board.
Here is a very long list of shields for the Arduino http://shieldlist.org/.

Regards
Ross
Reply With Quote
  #3  
Old Thu 03 November 2011, 18:39
TechGladiator
Just call me: Miguel #94
 
Randolph, NJ
United States of America
We use them at work alllllllll the time. You are absolutelly right about being a great solution for one-off things or custom solutions. We also design our owm relay, IO, Rs232 boards at work but the arduino board sure solves a lot of problems.
Reply With Quote
  #4  
Old Thu 03 November 2011, 20:41
bradm
Just call me: Brad #10
 
Somerville(MA)
United States of America
Yep, Arduinos are great. Another great resource are the Microchip single chip microcontrollers. They are very supportive with samples for R&D, and the resulting boards can be even simpler and cheaper than the Arduinos. I love them both.
Reply With Quote
  #5  
Old Fri 04 November 2011, 09:07
normand blais
Just call me: Normand
 
montreal
Canada
Here are some link for firefly, witch is a plugin for grasshopper witch is again a plugin for rhino.
Firefly control stepper and other stuff .beyon my understanding for now. Might be usefull for you
http://www.fireflyexperiments.com/
http://www.liftarchitects.com/
http://vimeo.com/10259250
Reply With Quote
  #6  
Old Sat 05 November 2011, 21:44
Richards
Just call me: Mike
 
South Jordan, UT
United States of America
Sometimes we get so focused on solving the complex that we forget that most people only need to solve the simple.

For example, many people have posted questions about proximity sensors. They want to know how to wire a N/O set of sensors opposed to wiring a N/C set of sensors. With a micro-processor (arduino or other), it doesn't matter. N/O sensors can be mixed with N/C sensors and a simple program change (complement the bit) can accommodate either type.

An Arduino costs about $30, but an ATtiny85 chip that easily interfaces with a proximity sensor costs about $1.50. The Arduino can reprogram the ATtiny85 to work with either a N/O or a N/C proximity sensor. In a normal setting, it might take one ATtiny85 chip per sensor, but at $1.50 each, does that really matter?

Using technology properly can minimize the time it takes to solve problems. Sometimes that innovation requires an Arduino, and other times it only requires the USE of an Arduino to program other chips.

Don't overlook the FREE software, like AVR Studio 5, that allows you to program and debug programs.

The Internet has made it possible to do some great things at low or no cost. Thinking "small" is sometimes the best way to get into using micro-controllers.
Reply With Quote
  #7  
Old Sun 06 November 2011, 08:32
smreish
Just call me: Sean - #5, 28, 58 and others
 
Orlando, Florida
United States of America
Mike,
Back in early 2007 when working on the limit circuit for my MM, I actually used a Automation Direct D05 PLC to the simple (and a few other routines for me) 99.00 for all the IO I ever needed to add logic to my MM. I used the IO in the PLC to resolve the prox circuits and a few others duties related to machine interlock and vacuum system. Then just sent the resolved signal to the J block on the pmdx.

Great ideas making the machine a better place.
Reply With Quote
  #8  
Old Sun 06 November 2011, 10:44
TechGladiator
Just call me: Miguel #94
 
Randolph, NJ
United States of America
Mike, Sean;

Of you can build your own board . We actually build a Start/Stop circuit into a board that will activate a buzzer/horn for X amount of seconds before sending power to the starter. Over the years we found it incredible how many so called "control electricians" couldn't figure out how to wire a simple start/stop circuit
Attached Images
File Type: jpg StartStopBoard.jpg (116.3 KB, 512 views)
Reply With Quote
  #9  
Old Sun 06 November 2011, 15:11
Richards
Just call me: Mike
 
South Jordan, UT
United States of America
Some of you have modified the original design and added features and functions that best suit your needs. Sharing those ideas with everyone helps others to also extend the functionality of their machines.

That's what it's all about - making a CNC machine do what we want it to do.

Finding the Arduino was like getting a breath of fresh air. I'm used to using an old programmer that is out of production and writing code in a text program and then hand checking the code for logic errors. Because I have been doing it for so many years, it is simple for me; but when I tell others how to program a $2.00 Atmel 89C series part, they just throw up their hands saying that they can't buy an affordable programmer and they wouldn't know a logic error from anything.

The Arduino (and other similar inexpensive platforms for other brands of chips) make testing and implementation easy. Using a combination of programs, I can easily simulate the operation of a micro-controller and then "burn" that program into an Arduino or into a single chip. That's the beauty of it. If the problem warrants a $30 Arduino, I can use a dedicated Arduino. If the solution only requires a $1.36 ATtiny85 chip, I can use the Arduino to program that single chip. If the solution to the problem requires more than five I/O lines, then I can dig deeper into my pocket and us a $4.00 ATmega328 chip.

If the solution to the problem warrants the cost of a real circuit board, I can use free software from ExpressPCB to draw a schematic and layout a multi-layer circuit board. Their proto-type boards cost about $100 or $200 depending on the size and the number of layers.

If the solution to the problem allows a one-off wire-wrap board, I can use that same ExpressPCB to draw the schematic and then use it as a guide to wire-wrap the design.

Normally, I just use a little solderless breadboard to build and test the circuit. When I'm sure that I've got what I want, I layout a real circuit board and have some prototype boards made.

The point I'm trying to make is that almost anything is possible with readily available parts, parts that are available world-wide at reasonable prices.
Reply With Quote
  #10  
Old Mon 05 December 2011, 08:48
Richards
Just call me: Mike
 
South Jordan, UT
United States of America
The Arduino Uno R3 is available from Radio Shack in the United States for $35.00. Radio Shack also has a variety of prototyping boards specifically designed for the Arduino Uno. I bought two boards on Friday night. Within 15 minutes, I had prototyped and verified two designs. Normally, using the AT89Cxx microprocessors, which require assembly language instead of "C", programming those two projects would have taken several hours each.

A perfect use for an Arduino would be to interface the proximity sensors to your break-out-board. Using software, you could easily configure the Arduino to give the proper response no matter whether you use N/O or N/C sensors and it wouldn't matter whether the sensor goes active when it sees a hole or when it sees a target. Programming would compensate for all of those issues. Using a "shield" designed for quick prototyping would let you add the necessary opto-isolators without going to the expense of having boards fabricated.
Reply With Quote
  #11  
Old Mon 12 December 2011, 00:19
quadtech
Just call me: Prasad
 
Hyderabad
India
The starter pack from Adafruit is a pretty good deal too.

http://www.adafruit.com/products/68
Reply With Quote
  #12  
Old Tue 13 December 2011, 08:54
aniljangra
Just call me: Anil #44
 
Delhi
India
Send a message via Skype™ to aniljangra
I did use an AVR (atmel mega 8) to combine all proxy and buttons on my mechmate. Beware not to use weak pullups (internal pullups) if needed, when using micros, noise easily can get in and trigger EStop in Mach.
Reply With Quote
  #13  
Old Wed 14 December 2011, 13:25
Richards
Just call me: Mike
 
South Jordan, UT
United States of America
Anil makes a good point. The 20K built-in resistors allow the Atmel chip to sink/source about 0.25ma. Normally a 2.2K or a 4.5K pull-up resistor would be used giving 5X or 10X more current. I normally use 2.2K pull-up resistors in my own designs.

However, the whole design cycle needs to be explained so that no one assumes that an Arduino by itself is used.

On my test bench, I have two Arduino Uno devices. One is always set to ISP mode, meaning that it can be used to program other chips. The other one is used in its "native" mode. I start with the non-ISP device and test each part of the computer program for proper operation. When the program has been verified, then I burn an ATtiny chip which I use in the final design. The ATtiny chip is put into a wire-wrap or prototype board where I can closely examine each part of the circuit for proper electrical operation. I use a lot of opto-couplers in my designs to keep electrical noise outside, even when the outside circuits work with 5VDC. If I have a push-button switch that needs absolute error-free reading, I add a software switch debouncing routine in software or I use another ATtine85 chip that is dedicated to monitoring that single switch ($1.25 per ATtiny85). When the design checks out electrically, then I design a proper PCB board.

The Arduino makes prototyping quick and easy. It allows me to concentrate on the "what ifs" in a design rather than being bogged down in the "how tos" part of the design.

One additional piece of hardware is often required. I use an Atmel AVR Dragon ($75 with ZIF connector) when I really need to get down to the bare essentials of a microcomputer chip. The Dragon, along with AVR Studio 5 software (free), lets me do anything that the chip is capable of doing.

The Arduinos and the Dragon cost much less than the programmer that I used for the older AT89Cxxxx chips and the Arduino/Dragon design cycle is so much faster. Most of the time I can use C/C++ rather that writing in Assembler, so I don't have to worry about the intricacies of the microcomputer chip.

By working through a design systematically, I can separate the programming errors from the electrical errors, then I can test the electronics on the prototype or wire-wrap board before spending more than the cost of the chip and the other components.
Reply With Quote
  #14  
Old Wed 14 December 2011, 14:02
aniljangra
Just call me: Anil #44
 
Delhi
India
Send a message via Skype™ to aniljangra
For denouncing a single input I use even cheaper chip ($0.1) the 555 timer (CMOS version LMC 555) in mono-shot configuration , very useful when you are trying to attach input to interrupt pin.

Although not relevant here, you can't beat a small CPLD for denouncing and combining many inputs, the only downside is these little chips are available in surface mount packages.

I never felt a need for Audrino since I got my AVR dragon , along with free avrstudio it make a perfect development combo. By the way Mike you may want to try R8C tiny from Renesas, cheaper than AVRs and more immune to noise, I am using more of these now than AVRs.

Last edited by aniljangra; Wed 14 December 2011 at 14:09..
Reply With Quote
  #15  
Old Wed 14 December 2011, 21:08
Richards
Just call me: Mike
 
South Jordan, UT
United States of America
The beauty of microcomputers and discrete electronics is that there are endless ways to preform the same task. The "best solution" is the solution that works for you.
Reply With Quote
Reply

Register Options Profile Last 1 | 3 | 7 Days Search Today's Posts Mark Forums Read

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Techlf CPU4BU (France) - USB interface Gerald_D 70. Control Systems 5 Thu 04 March 2010 23:16
Would you mind to help me to solve the problem for Keling stepper Motor Driver? qangel1000 Motors & their mountings 6 Sat 08 August 2009 00:42
Touch Panels & Interface Design ozanblotter The Market Place 3 Fri 23 May 2008 01:23
The hardware interface between PC and motor drives - the future beyond parallel BOB? Gerald D 70. Control Systems 16 Mon 10 December 2007 12:09


All times are GMT -6. The time now is 07:38.


Powered by vBulletin® Version 3.8.3
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.