Author Topic: Arduino programming, Mega 2560 ADK  (Read 17401 times)

Offline Dawai

  • Full Member
  • ***
  • Posts: 124
  • Country: us
Arduino programming, Mega 2560 ADK
« on: December 25, 2013, 01:05:32 PM »
Beginning tips, (wish I had this to start with)

TIPS IF you buy one, Load the "free" arduino IDE software, get it working, when you get your arduino in Hand, (plastic push pin it to a wood board so it don't short on something) connect it to your USB port, WINDOWS will see it as a new device, (do a "SPECIFY driver to install", go to the arduino directory on your machine (mine is in c:\program files\arduino\drivers), select drivers DIR there in the arduino directory, WINDOWS should see the proper driver and select it) once configured in windows, then go to your "control panel", SYSTEM, hardware, Device manager and look at your com ports, see in the com/LPT ports listing "new device" (mine was seen as a arduino on com port 4) and take note of the com port since yours maybe different, you can then set up-configure  the arduino software with the proper com port, select the model arduino you have connected, and "UPLOAD" the example LED blink program..

IF YOUR Arduino blinks the onboard (pin 13??) LED.. you have just programmed your first code into it.. ANYTHING that can turn on a LED can turn on a TTL-AC module, or a SSR going to your 15 gallon beer boiler, or a Discharge SSR in a spark welder, spot welder, or????  You just have to make the logic-code do what you desire, cut and paste from other code projects freely available on the net.   

NOTE, this model 2560 Mega ADK can source 40ma of power on a pin (according to their site).. THE TTL opto-22 PB4 racks-modules I use draw 12Ma, The SSR (solid state relays) I use on the beer cooker draw about 12-15ma.  SO.. turning things on and off are no problem.

THE newest gecko drives, 203's have opto isolation that draw a tiny 3ma of current to turn on and off the step and directional signals.. you could connect directly to them without a breakout board, pc or micro controller.
<end beginning tips>

So. I bought myself a arduino.. it says right there on the website you have multiple ports.. after three days moving data around and getting garbage out of it.. it occurred to me, these lower level ports probably do not have much "buffer storage" and what it is doing is stripping the amount more than it can send out in a byte.  Serial.write() function is a direct byte write, Serial.print() supposedly can send "strings", thou out the additional ports is garbage.. (how I figured that out? connecting a usb-232 to the secondary port and running a terminal written in vb)

I am getting crazy characters at the lcd, or..  same crazy items at the PC term program.. but the NORMAL USB port to the pc reads things a lil bit differently.. you print a "A", ascii 65 out.. it shows up on the pc arduino monitor as a A.. on the others as a underscore-space.. Had me scratching my head for a few days.

So. I have to go to a "bit by bit" and not "WORD"  moves out the other 3 ports?? I guess that explains why there is very little information about RS232 equipped LCD's on Arduino site.. mostly they use a binary LCD, tied to several pins in half byte or full byte mode..  (parallel pin LCD)  Bit logic will work great that way..  I'll find a old C serial port program on a bit by bit move and upload the code here later.  I plan on using the extra com ports are "chinese scale readers" and to communicate with a remote serial control board..   


I Hung a 24 foot Ibeam this morning in the ceiling by myself, programmed a Arduino this afternoon for a solar project, Helped a buddy out with a electrical motor connection issue on the phone, then cut up a chicken for Hotwings. I'd say it has been a "blessed day" for myself and all those around me.

Offline Dawai

  • Full Member
  • ***
  • Posts: 124
  • Country: us
Re: Arduino programming, Mega 2560 ADK
« Reply #1 on: December 25, 2013, 08:57:52 PM »
CODE snippet, making PWM pin control a futaba servo follow a rotary encoder position, hacked together in about twenty minutes from examples online..

You can cut and paste it directly into your arduino program, just wire the devices like the description there in the comments at top..

What's it good for?? well a air throttle control on a wood boiler? or a smelter throttle?? steering on a rc?? or??


Quote
/* 12-25-2013 (someone got a arduino for Christmas) THIS is a way to PWM the servo control line, apply 5 volts to the red and black lines on the RC servo
and use the yellow "signal" line as the control on a PWM pin, set a frequency out on the pin and it runs to
that position, the servo has a pot inside it that gives positional feedback.. when it reaches a equal to the
frequency in, it stops there, lower frequency and it tracks till pot-position is satisfied.
  THE encoder is a clarostat two channel optical encoder with one phase waveform 90 degees out of synch
 with the other phase, phase a, phase B.. by reading the current state, the past state, you can determine by
ginary tranfer the direction and amount of travel of the knob of the encoder..
  Hacked together by COFER in Gawgia from examples provided with arduino software.. I do not take credit
 THE encoder subroutine is not really reliable,   but it serves a purpose to test instruments. THE other examples on the arduino site use interupts Those would be much better.
  Components used, a futaba S3004 rc servo from previous project, a Clarostat 601-128-E66-140-8813 encoder
  5vdc wall supply, common tied to 2560 ground & servo gnd, positive to the servo red, yellow to pin2 for  pwm output, encoder pin1 5volts to positive, Pin3 common to ground, Pin2 is  A phase to ard_pin28,  Pin4 is Bphase to ard_pin30. This is a 5 volt ttl encoder.
*/

#include <Servo.h>    // include the data file to operate  the servo
Servo myservo;  // create servo software driver object to control a servo
 int val;
 int encoder0PinA = 28; //  to reflect the pins I used for encoder phase A
 int encoder0PinB = 30;  // to reflect the pin I used for encoder phase B
 int encoder0Pos = 0;     // to zero for positional on the encoder
 int encoder0PinALast = LOW;  // set the positon variable
 int n = LOW;         

 void setup() {
   myservo.attach(2);  // servo on pin 2 to the servo object in my connections
   pinMode (encoder0PinA,INPUT);      // configure the pins as inputs
   pinMode (encoder0PinB,INPUT);      // set the pin as a input
   Serial.begin (19200);    // open the port to display the positon via terminal
 }

 void loop() {
   myservo.attach(2);  //  servo on pin 2 to the servo object // servo pin
   n = digitalRead(encoder0PinA);
   
   if ((encoder0PinALast == LOW) && (n == HIGH)) {
     if (digitalRead(encoder0PinB) == LOW) {
       encoder0Pos--;
     } else {
       encoder0Pos++;
     }
     //***************************************************************
        if (encoder0Pos > 180) encoder0Pos = 180; /// if more than 180,
        if (encoder0Pos < 1) encoder0Pos = 1; // if less than 1, reset to 1
   
     //**************************************************************
     Serial.println(encoder0Pos);  // print position to the term, w linefeed
     Serial.println("/");
   }
   encoder0PinALast = n;  // reset following flag
   //*********************************************** servo function **************************
  myservo.write(encoder0Pos);    // servo position according to the scaled value
  delay(5);                     // time delay waits for the servo to get there
 }
I Hung a 24 foot Ibeam this morning in the ceiling by myself, programmed a Arduino this afternoon for a solar project, Helped a buddy out with a electrical motor connection issue on the phone, then cut up a chicken for Hotwings. I'd say it has been a "blessed day" for myself and all those around me.

Offline AdeV

  • Madmodder Committee
  • Hero Member
  • *****
  • Posts: 2434
  • Country: gb
Re: Arduino programming, Mega 2560 ADK
« Reply #2 on: December 27, 2013, 06:43:38 AM »
I must admit, I'm a big fan of the Arduino - I never went for the Mega though, I have a Duemilanove, one of the newer ones (I forget its' name, haven't even used it yet) and a handful of Boarduino (Arduino clone on a miniature board, perfect for breadboarding).

So far... used mine to implement a digital combination lock (using keypad.h and servo.h); read various temperatures using either TMP36's or more recently K-type thermocouples using the MAX6675 decoder chip. I wrote most of a monitoring suite for a Lister CS - 3x TMP36s for coolant temp, 1x K-type for exhaust temp, an RPM sensor (hall effect). Even built it onto some stripboard & got it working.... all I need to do now is build the output side (so I'm not tied to a PC to view the data), and the start/stop controls....

The only thing I am not entirely sure how to do is load sensing - i.e. if I were to flick on the kettle, how can I sense this & begin the engine start sequence? Similarly, how do I detect no load to begin my shutdown sequence...?
Cheers!
Ade.
--
Location: Wallasey, Merseyside. A long way from anywhere.
Occasionally: Zhengzhou, China. An even longer way from anywhere...

Offline Dawai

  • Full Member
  • ***
  • Posts: 124
  • Country: us
Re: Arduino programming, Mega 2560 ADK
« Reply #3 on: December 27, 2013, 08:51:24 AM »
Good Day to you, Happy NEW YEAR..

  Turn on-off? you mean like a manual flip type switch? I use opto22 ttl-transistor modules for the things around here, 5 volts in turns on a transistor or TRIAC type relay inside for 5 amps.. inputs are as simple, you plug a input module into the rack and when it see's voltage on the line side it sends a ttl logic voltage to your board.. one side logic, other side field wiring..

  Sensing a load, well more thought and more description needed.

Last night, while watching tele I did this..

     


Code snipped, I hope I commented it well enough to follow..
************************************************************
/*
 Modified to read a IRPD sensor, has a center detector, and a left and right LED transmitter, turn on
 both, read for center location, left, then right LED's to set road map ahead reflection.
 BUILD a binary truth table to direct the bot. 0,0,0 or 1,1,1 or??
 12-27-13, added the SERVO point subroutine to hunt when the sensor changes, like a steer mode.
 */
 
// Pin 13 has an LED connected on most Arduino boards.
// give it a name:
#include <Servo.h>
Servo myservo;  // create servo object to control a servo, maximum of eight ;
const int led = 13;
const int lftled = 36;  //'turn on the enable left;
const int rtled = 40;   // 'turn on the enable right;
const int Sens = 32;    //'this is the input from the sensor detect;
int Radar ;
int VARR;
int pos = 0;    // variable to store the servo position

// the setup routine runs once when you press reset:
void setup() {               
  // initialize the digital pin as an output.
  pinMode(led, OUTPUT);
  pinMode(lftled,OUTPUT);
  pinMode(rtled,OUTPUT);
  pinMode(Sens,INPUT); 
  Serial.begin(19200);
  myservo.attach(2);  // attaches the servo on pin 2 to the servo object
}

// the loop routine runs over and over again forever:
void loop() {
 Radar=0;
  digitalWrite(led,HIGH);   // turn the LED on HIGH is the voltage level
  digitalWrite(lftled,HIGH);
   delay(5);
     // look to the sensor valve only left.
     VARR = digitalRead(Sens);  // set the variable equal to the IRPD output
    if (VARR = HIGH)  {     
    // add left bit:   
    (Radar = Radar + 1); 
  }
  { 
  // turn on the right LED and add right Radar.
   digitalWrite(lftled,HIGH);
   digitalWrite(rtled,HIGH);
   delay(5);
     // look to the sensor valve only left.
     VARR = digitalRead(Sens);
  } 
   if (VARR == HIGH) {     
    // add middle bit:   
    (Radar = Radar + 2); 
    digitalWrite(lftled,LOW);
    digitalWrite(rtled,HIGH);
    delay(5);
   }
   
     // look to the sensor valve only left.
     VARR = digitalRead(Sens);
   if (VARR == HIGH) {     
    // add right bit   
    (Radar = Radar + 4); 
     // turn LED off
    digitalWrite(led,LOW);
    digitalWrite(lftled,LOW);
    digitalWrite(rtled,LOW);
    delay(5);
   }
   { 
    Serial.println(Radar);
    delay(10);               // wait for a second
    digitalWrite(led, LOW);    // turn the LED off by making the voltage LOW
    delay(10);               // wait for a second
    (Radar = Radar * 24);     // in steps of 1 degree
    myservo.write(Radar);   // tell servo to go to position in variable 'pos'
    delay(5);                // waits 15ms for the servo to reach the position
    }
  }
 
« Last Edit: December 28, 2013, 12:48:10 PM by dsquire »
I Hung a 24 foot Ibeam this morning in the ceiling by myself, programmed a Arduino this afternoon for a solar project, Helped a buddy out with a electrical motor connection issue on the phone, then cut up a chicken for Hotwings. I'd say it has been a "blessed day" for myself and all those around me.

Offline Dawai

  • Full Member
  • ***
  • Posts: 124
  • Country: us
Re: Arduino programming, Mega 2560 ADK
« Reply #4 on: December 27, 2013, 09:32:04 AM »
I take it, reread that you have a home-generator system?? running off batteries  and inverter till it "requires more" power?? like turning on a appliance?

That'd be a current sensing relay.. a "ct" or doughnut, pass load bearing conductors through it, it gives a 0-5 amp for the "coil rating" like a 200 amp CT will give 5 amps at 200 amps load.. but.. you do not have to just go through the coil once,  To get the resolution up you would make more passes and loop your main load bearing cable through it more than once, it a 20 amp passed through 10 times would give 5 amps thinking it was seeing 200..

NOW how to convert that 1x?? transformer to a signal you can read??  I'd want some kind of opto buffer in that circuit to protect the arduino analog input.

OLD opto22- analog modules, they had a 0-5 amp input module, but required several voltages to work.. 5, -15, +15. Outputed some kind of frequency to the "B2" brain board they were normally tied to.. you could hack one of them with a scope and frequency generator..
 http://www.ebay.com/itm/Opto-22-AD10T2-Relay-G1-100-Ohm-RTD-Isolated-Analog-Input-Module-/300931939960?pt=BI_Control_Systems_PLCs&hash=item4610f0fe78 

I don't know what kind of signal they supply the B2 brain board??  coming in "software" logic to the monitoring PC is a FFFF or 4096 decimal number.. so.. I suggest it is a frequecy coming off the module.  That module is a temperature, but they all send the same kind of ratio-voltage-frequency back to the brain, it never knows what it has in the rack, only ouputs a 0-4096 scaled representation of the input..

You might find a industrial type signal conditioner?? Like a relay with labeled outputs.. but those are normally out of a "normal modder's" price range.. in the thousands of dollars sometimes. 

We are too cheap to do that??  You could also "monitor the throttle" and governor on the generator.. if it low-throttles - idles too much it is not needed..
(like a gas engine powered welder, how it works, current monitoring)

Look on the side of your inverter, they sometimes have a rs232, or usb port..
I Hung a 24 foot Ibeam this morning in the ceiling by myself, programmed a Arduino this afternoon for a solar project, Helped a buddy out with a electrical motor connection issue on the phone, then cut up a chicken for Hotwings. I'd say it has been a "blessed day" for myself and all those around me.

Offline AdeV

  • Madmodder Committee
  • Hero Member
  • *****
  • Posts: 2434
  • Country: gb
Re: Arduino programming, Mega 2560 ADK
« Reply #5 on: December 27, 2013, 11:06:08 AM »
Ahh, sometimes I get confused over which forum I'm posting on.....

So, to explain: The Lister CS "Start-o-matic" is  self-contained generator unit powered by a single-cylinder 6hp diesel engine driving a single-phase alternator/motor head. Typically, they were used as lighting plants for isolated farms, in the days when network electricity was rare/non existant, especially deep in the countryside. They were most prevalent in the 1940s-1960s, and are now much prized by people who want to do veg-oil or motor-oil powered "self sufficiency", due to their resilient nature and hypnotic low-speed running.

The Start-o-matic is connected to the house wiring via a control box. When a light is switched on, the control box senses it, and connects the alternator in "motor" mode. At the same time, it deactivates the compression release/fuel rack lever via a solenoid. The increasing RPMs (from driving the engine via the motor) eventually cause the diesel to start. Again, the control box senses this, and switches the motor circuit out, connecting the alternator circuit instead. Once the revs build up a mechanical governer kicks in to keep the voltage stable. The engine runs until the control box senses a no load condition (i.e. all lights switched off), this causes the "run" solenoid to turn off, and a spring pulls in the compression release/fuel rack closer. Thus, the engine shuts down. All 100% analogue, using bi-metallic strips, resistors, etc. It even had a fail-safe shutdown in case the engine didn't start.

This is all very clever, but I want to be able to do it via modern day electronics. There is no inverter, and the battery is a 12v car battery running a separate (car) starter. I can actuate the starter via relay, and I can spot the rpms rising above the cranking speed which allow me to disengage the starter once the diesel has fired (or give up after a certain number of cranks). I haven't yet figured out the actual stopping mechanism but I think a servo + spring will suffice, to push the rack/decompression unit into engagement. It will also allow it to disengage when starting.

So, the question is, if someone attempts to draw a load from the "mains", how to I detect this & kick the generator up? And how do I subsequently tell when no load is on, and therefore shut the generator down? I only need binary signals... there rest I can handle.
Cheers!
Ade.
--
Location: Wallasey, Merseyside. A long way from anywhere.
Occasionally: Zhengzhou, China. An even longer way from anywhere...

Offline awemawson

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 8967
  • Country: gb
  • East Sussex, UK
Re: Arduino programming, Mega 2560 ADK
« Reply #6 on: December 27, 2013, 11:25:56 AM »
If I remember correctly, most Start-o-Matics used 24v. In the non running state the load circuit was biased with 24v DC, so when a load was switched on it causes a small current to flow which latches a relay on, which also drops the 24v dc bias. Relay then used to start machine.

The circuit is available on line somewhere as I wondered how they worked and 'googled' it a few years back

Andrew
Andrew Mawson
East Sussex

Offline Dawai

  • Full Member
  • ***
  • Posts: 124
  • Country: us
Re: Arduino programming, Mega 2560 ADK
« Reply #7 on: December 27, 2013, 12:10:24 PM »
Very cool.. Nothing i have ever saw or heard of before thou. (I really don't know everything, or claim to)..

I'd still pass the "house mains through a CT" and figure a way to read the current and "voltage present" for cases like we had a while back when the power went off, thou you'd want a switch to open it up so you didn't pump your electricity back into the power grid. (and burn it out)

make a post, post pictures.. I'm a old greybeard electrician, I will help if I can. I got boxes of obsolete junk laying about, but the import fees?? would kill ya.. I got this buddy in Ontario who thought I charged him for something, but it was Canadian import taxes.. and they price the industrial stuff like it is new.
I Hung a 24 foot Ibeam this morning in the ceiling by myself, programmed a Arduino this afternoon for a solar project, Helped a buddy out with a electrical motor connection issue on the phone, then cut up a chicken for Hotwings. I'd say it has been a "blessed day" for myself and all those around me.

Offline awemawson

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 8967
  • Country: gb
  • East Sussex, UK
Re: Arduino programming, Mega 2560 ADK
« Reply #8 on: December 27, 2013, 01:11:41 PM »
Many many years ago (over thirty) I was looking at an old derelict water mill and it's attached cottage just over the River Tamar in Cornwall. Hadn't been lived in for many years, and was structurally questionable. I flicked a light switch in the cottage and to my amazement a few seconds later there was the chug chug of as diesel start up round the back. Went to have a look see and a Start-o-Matic in a shed round the back had fired up. How could the batteries have held a charge I thought? Well it turned out they were ex War Department NiFe cells ! Thinking about it the place wasn't that far from the Plymouth Naval Dockyard ....   mmm....

Place is now a trendy restaurant  :bang:

Andrew
Andrew Mawson
East Sussex

Offline Bluechip

  • Madmodder Committee
  • Hero Member
  • *****
  • Posts: 1513
  • Country: england
  • Derbyshire UK
Re: Arduino programming, Mega 2560 ADK
« Reply #9 on: December 27, 2013, 01:31:49 PM »
Andrew

Didn't that geezer E H Jeynes (?) do the odd article in ME about domestic generator plants ?

That 'Start-O-Matic' seems vaguely familiar for some reason, and I can't think of anywhere else I got it.  .... if, indeed I did ...  :scratch:

Dave BC
I have a few modest talents. Knowing what I'm doing isn't one of them.

Offline Dawai

  • Full Member
  • ***
  • Posts: 124
  • Country: us
Re: Arduino programming, Mega 2560 ADK
« Reply #10 on: December 29, 2013, 05:06:03 AM »
Hi.

  thoughts?  I got a pair of $20 (UNO) micro controllers coming, three $12 lcd's displays with buttons made onto them, one for the one I have. Still need a Stepper drive and dc power supply, motor, gear train?? (sprockets and belts?)

  I have been doing the software for various things learning how to use them, write the programs. There are several people online running dividers, indexers with them. But most are "stingy" with the code. they want money for their work I guess?
  First two projects are definite, EDM is built, wires hanging out, capacitor bank, transformers SSR wired. I was modding it and missed out on a job recently with it.

/********************** project 1, division head, indexer ****************************
Variables in a divider head program..
Divisions of 360 degrees?
degrees to run per move,
steps per degree (for motor control, geckos have 10x micro-steps)
acceleration factor (for taking off smooth) (angle calc or add per step?)
Accel distance
deceleration factor (for stopping smooth) (angle or calc per step??)
Decel distance
Direction to run
Minimum speed
Maximum speed
Pulse width for drive (stepping)
Pulse width for direction

Button to move, or?? how to trigger a movement??
 
 MENUS on screen, move degrees? division? set up parameters, but it loses this each time it turns off.. so?? keep a battery in the system or?? I can add a SD camera card and read it??  more money , more complication.

NOW some of these things that have to be programmed must be done so according to the gear ratio of the motor to degrees turned.  Looking at one guy he used a laser pointing (bolted on) at a wall 20 feet away to get his "zero" and calculate the steps in a 360 degree movement.. "that figures out how I can calibrate my A axis here" too tied into my milling machine.

Components, $20 arduino, $12 LCD-keypad, box, Power supply, motor, gearbelt, pulleys, SD Card & reader?? opto22 PB4 card, modules.

//*********************************** project 2, control-timer for spot welder *****************************
MY SPOT welder Timer-control..
Wait on button-foot pedal.
TIME to solenoid clamp
SSR weld current on
time to weld current
time-out, turn off weld SSR
foot pedal up, release solenoid
repeat.
Transformer heat temperature?? display??

Components, $20 Arduino, $12 LCD-keypad, power supply, SSR, solenoid, air regulator, electrical box, PB4 opto22 card, foot switch, SJ cord, cord connectors, Thermistor?.

/****************************************************************************************
/********************* Project 3, EDM ******************************************************
Variables,

Distance to descend,
steps per inch
current to flow
Spark time
voltage bus read    (analog input)
voltage bus charge  (PWM output SSR)
voltage bus discharge (pwm output SSR)
coolant flow
Home switch
Capacitors heat.
transformers main switch (relay with safety)


//**************************** Spark welder, electrical discharge ********************************
Modded into edm previously..

//**************************** Carbide depositor *********************************************
reverse EDM polarity, CnC stipple requires multiple axis movements, co communication with Mach3 & Windows interface

//**************************** David Laser scanner drive ****************************************
Tilt laser servo,
rotary table
cnc table control w/Mach3 & Windows interface
Windows API call, camera interface w Mach3

//**************************** Laser pulse modulation, heat control ***********************************
I Hung a 24 foot Ibeam this morning in the ceiling by myself, programmed a Arduino this afternoon for a solar project, Helped a buddy out with a electrical motor connection issue on the phone, then cut up a chicken for Hotwings. I'd say it has been a "blessed day" for myself and all those around me.

Offline Dawai

  • Full Member
  • ***
  • Posts: 124
  • Country: us
Re: Arduino programming, Mega 2560 ADK
« Reply #11 on: December 29, 2013, 09:14:59 AM »
Code runs for the SPOT welder sequence control..
UNO microControllers will be here next week, LCD's not wrote software for.
THIS prints the operation as now to the laptop..
Using a SSR (solid state relay), a opto22 PB4 rack, ODC modules, 24vdc solenoid to operate the clamp cylinder to clamp metal in HF (chinese) spot welder.

PROBLEM, spot welder has a very low duty factor, using automation it gets hot fast. Need to blow air through it, and monitor temperature with a thermistor, in the future..

THE working arduino code, as of this morning. cut, paste, modify the pins to suit your arduino model and connections, flip logic if your ttl boards are positive sourcing based instead of sinking logic.





/* Written by Cofer, NORF Gawgia, USA on 12-29-13
  I Modified code for creating a sequence timer for a spot welder, this unit
first applies a solenoid output to clamp the spot welder tongs, then times to close fully
and apply pressure, then the SSR fires for a timed output, the SSR times out then
the unit loops on one line till you lift your footpedal switch, then it resets to
the beginning of the program to loop for next sequence. THIS unit uses a PB4 Opto22
ttl-relay module based board, it SINKS the TTL power to turn on the modules, so it
appears reversed, would be if your output device is different.

 * Note: because most Arduinos have a built-in LED attached
 to pin 13 on the board, the LED is optional.
 */
int ledPin = 13;      // select the pin for the onboard LED
//int ClampTime = 0;  // variable to store the value coming from the sensor
int button1 = 38;  // change to reflect pins on the UNO
int button2 = 39;
int Solenoid1 = 48;
int SSR1 =49;
int footpedal = 41;
int buttonstate1;
int buttonstate2;
int Clamp_flg;

// variables for Timer variables
int ClampTime = 1000; // setpoint for clamp timer
int WeldTime = 5000 ; // variable for weld timer


void setup() {
  // declare the ledPin as an OUTPUT:
  pinMode(ledPin, OUTPUT);
  pinMode(Solenoid1,OUTPUT);
  pinMode(SSR1,OUTPUT);
   pinMode(button1,INPUT);
   pinMode(button2,INPUT);
   pinMode(footpedal,INPUT);
  Serial.begin(19200);
  digitalWrite(Solenoid1,HIGH);
  digitalWrite(SSR1,HIGH);
 
}
void loop() {
     Clamp_flg = 1; // set the flag
 // alter setpoint in this menu
  if (digitalRead(button1) == HIGH and digitalRead(button2) == LOW ) {
    ClampTime = ClampTime + 10;
    Serial.println(ClampTime);
    delay(150);
  }
 
  if (digitalRead(button2) == HIGH and digitalRead(button1) == LOW ) {
    ClampTime = ClampTime - 10;
    Serial.println(ClampTime);
    delay(150);
  }
 
  if (ClampTime < 500){
   ClampTime = 500;
  }
 
   if (ClampTime > 5000 ){
   ClampTime = 5000;
  }
 
  // if foot switch then cycle turn the ledPin on
  while (digitalRead(footpedal) == LOW ) {
 
   
      Serial.print( " clamp solenoid on ");
      Serial.println(ClampTime);
      digitalWrite(ledPin, HIGH ); 
      // TURN ON SOLENOID to clamp
      digitalWrite(Solenoid1,LOW);
      delay(ClampTime);         
      // turn the ledPin off:       
      digitalWrite(ledPin, LOW);
      // TURN ON SSR 
      digitalWrite(SSR1,LOW);
      Serial.print(" Welding time ");
      Serial.println(WeldTime);
      delay(WeldTime);
      // OFF SSR
      digitalWrite(SSR1,HIGH);
      Serial.println(" Remove foot from pedal ");
     
      while (digitalRead(footpedal) == LOW );
      // stay here till footpedal up
      // OFF SOLENOID clamp
      digitalWrite(Solenoid1,HIGH);
     
  } 
}
I Hung a 24 foot Ibeam this morning in the ceiling by myself, programmed a Arduino this afternoon for a solar project, Helped a buddy out with a electrical motor connection issue on the phone, then cut up a chicken for Hotwings. I'd say it has been a "blessed day" for myself and all those around me.

Offline RodW

  • Full Member
  • ***
  • Posts: 120
  • Country: au
    • Vehicle Modifications Network
Re: Arduino programming, Mega 2560 ADK
« Reply #12 on: December 31, 2013, 08:00:13 AM »
Quote
MENUS on screen, move degrees? division? set up parameters, but it loses this each time it turns off.. so?? keep a battery in the system or?? I can add a SD camera card and read it??  more money , more complication.
Quote

I started with a rotary table Controller but got side tracked and never got back to It. I was able to add an SD card and a display to the ARDUINO.

The  ARDUINO, even the basic ones, have some flash RAM that you can use to permanently store system parameters.

There are some details on this forum about what I did. One day I will return to it...






RodW
Brisbane, Australia

Offline Dawai

  • Full Member
  • ***
  • Posts: 124
  • Country: us
Re: Arduino programming, Mega 2560 ADK
« Reply #13 on: December 31, 2013, 12:16:19 PM »
Hi.
  THE divider is not as complicated project as I made it, I am working on it.

THE sainsmart lcd keypad came in, Squirrels in the CHINGLISH translation.
Pins are not exactly what they should set up as, THE drivers for #include libraries had me puzzled, they have to be in exactly the right directory to not give a error.  Had me scratching my head for a bit. Working great, highly visible 16x2 display with 5 useable buttons, one reset.. (blind man could hardly see) They throw a analog signal by using resistors, different numbers come back and the driver chooses what input.

I got a pretty good grasp of the millisecond timer now thou, grab it as a millis() call..store it in a variable, then compare to actual-desired time instead of locking the program in a "STOP RIGHT HERE" delay(ms) loop.  This will come in handy throwing a 6ms pulse to the stepper drive step pin..

Spot welder code works good enough to put in, I am awaiting the uno's to implement it. I'll start fabbing a panel for it.

'*************** code rewritten this morning 12-31-13 *****
/* Written by Cofer, NORF Gawgia, USA on 12-29-13
  I Modified code for creating a sequence timer for a spot welder, this unit
first applies a solenoid output to clamp the spot welder tongs, then times to close fully
and apply pressure, then the SSR fires for a timed output, the SSR times out then
the unit loops on one line till you lift your footpedal switch, then it resets to
the beginning of the program to loop for next sequence. THIS unit uses a PB4 Opto22
ttl-relay module based board, it SINKS the TTL power to turn on the modules, so it
appears reversed, would be if your output device is different. 12/31/13 Modified to
use the sainsmart keypad LCD. It connects A0 analog to buttons divided by resistors
to differentiate the buttons in voltages into the analog input. DF Robot code, plus
SainSmart Code, plus mine added by cut and paste.
(millis()/1000)
 */
#include <LiquidCrystal.h> // include this library of lcd operations
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(8,13,9,4,5,6,7);// Set up for my MEga 2560 pins
//**************************************************
int button1 = 38;  // change to reflect pins on the UNO
int button2 = 39;  // change button
int Solenoid1 = 48; // air solenoid clamp for welder
int SSR1 =49;       // SSR welder output   
int footpedal = 41; // foot pedal input
int buttonstate1;   // variable to store state in.
int buttonstate2;
int Clamp_flg;
long startTime;
long endTime;
//******************************************
// variables for Timer variables
int ClampTime = 9000; // setpoint for clamp timer
int WeldTime = 3000 ; // variable for weld timer
// set up the analog input pin for keypad
//int sensorPin = A0;    //
//int sensorValue = 0;  // variable to store the value coming from the sensor
// define some values used by the panel and buttons
int lcd_key     = 0;
int adc_key_in  = 0;
#define btnRIGHT  0
#define btnUP     1
#define btnDOWN   2
#define btnLEFT   3
#define btnSELECT 4
#define btnNONE   5
// read the buttons ***************************
int read_LCD_buttons()
{
 adc_key_in = analogRead(0);      // read the value from the sensor
 // my buttons when read are centered at these valies: 0, 144, 329, 504, 741
 // we add approx 50 to those values and check to see if we are close
 if (adc_key_in > 1000) return btnNONE; // We make this the 1st option for speed reasons since it will be the most likely result
 // input for analog voltage divider, multiple inputs for one A-Input
 if (adc_key_in < 50)   return btnRIGHT;
 if (adc_key_in < 195)  return btnUP;
 if (adc_key_in < 380)  return btnDOWN;
 if (adc_key_in < 555)  return btnLEFT;
 if (adc_key_in < 790)  return btnSELECT; 
 return btnNONE;  // when all others fail, return this...
}
void setup() {
   // set up the LCD's number of columns and rows:
  lcd.begin(16,2);  // set up the display type
  // Print a message to the LCD.
  lcd.print(0x00); // display off
  //delay(50);
  lcd.print(0x04); // display on
  lcd.print(0x01); // clear the display
  lcd.print(0x02); // reset to home
  lcd.print(0x04);
 // set up pins, inputs outputs
  pinMode(Solenoid1,OUTPUT);
  pinMode(SSR1,OUTPUT);
   pinMode(button1,INPUT);
   pinMode(button2,INPUT);
   pinMode(footpedal,INPUT);
  //Serial.begin(19200);
  digitalWrite(Solenoid1,HIGH);
  digitalWrite(SSR1,HIGH);
  //SetupScreen;
     lcd.setCursor(0, 0);
     lcd.print("Clamp Time "+ String(ClampTime));
     lcd.setCursor(0,1);
     lcd.print("Weld time  " + String(WeldTime));
     
     }
void loop()
{
 lcd_key = read_LCD_buttons();  // read the buttons
 
 switch (lcd_key)               // depending on which button was pushed, we perform an action
 {
   case btnRIGHT:
     {
     lcd.setCursor(11, 0);
     lcd.print("     ");  //blank the space
     ClampTime = ClampTime + 10;
     lcd.setCursor(0, 0);
     lcd.print("Clamp Time " + String(ClampTime));
     delay(200);
     break;
     }
   case btnLEFT:
     {
     lcd.setCursor(11, 0);
     lcd.print("     ");  //blank the space
     ClampTime = ClampTime - 10;
     lcd.setCursor(0, 0);
     lcd.print("Clamp Time " + String(ClampTime));
     delay(200);
     break;
     }
   case btnUP:
     {
     lcd.setCursor(11, 1);
     lcd.print("     ");  //blank the space
     WeldTime = WeldTime + 10;
     lcd.setCursor(0,1);
     lcd.print("Weld time  " + String(WeldTime));
     delay(200);
     break;
     }
   case btnDOWN:
     {
     lcd.setCursor(11, 1);
     lcd.print("     ");  //blank the space
     WeldTime = WeldTime - 10;
     lcd.setCursor(0,1);
     lcd.print("Weld time  " + String(WeldTime));
     delay(200);
     break;
     }
   case btnSELECT:
     {
     //lcd.print("SELECT");
     Clamp_flg = 1; // set the flag
     break;
     }
     case btnNONE:
     {
     //lcd.print("NONE  ");
     break;
     }
 }
//******Confirm variables in tolerance
      if (WeldTime > 9999){
       WeldTime = 9999;
       }
       if (WeldTime < 500){
       WeldTime = 500;
       }
       if (ClampTime > 9999){
       ClampTime = 9999;
       }
       if (ClampTime < 500){
       ClampTime = 500;
       }
   
     
 
 
  // if foot switch then cycle turn the ledPin on
  while (Clamp_flg == 1){
  //while (digitalRead(footpedal) == LOW ) { // appears reversed logic
     // digitalWrite(ledPin, HIGH ); 
      // TURN ON SOLENOID to clamp
        startTime = millis(); 
        endTime = (ClampTime + millis());
        digitalWrite(Solenoid1,LOW);
     lcd.clear(); // clear the display
    while (millis() < endTime) {   
       lcd.setCursor(0, 0);
       lcd.print("Solenoid on " + String(endTime - millis()));
     delay(500); // slow down screen update
    }
      lcd.setCursor(0, 0);
      lcd.print("CLAMPED        ");
               
           
      // TURN ON SSR and count down 
      startTime = millis(); 
      digitalWrite(SSR1,LOW);  // turn the SSR module on
      endTime = (WeldTime + millis());
     
     while (millis() < endTime) {   
       lcd.setCursor(0, 1);
       lcd.print("SSR on " + String(endTime - millis()));
     delay(500); // slow down screen update
    }     
      // OFF SSR
      digitalWrite(SSR1,HIGH);
    // clean up display, status   
     lcd.clear(); // clear the display
     lcd.setCursor(0, 0);
     lcd.print("Solenoid on     ");
     lcd.setCursor(0, 1);
     lcd.print("SSR off         ");
    delay(5000);
      // stay looping here till pedal up
//while (digitalRead(footpedal) == LOW );
      // stay here till footpedal up
      // OFF SOLENOID clamp
      digitalWrite(Solenoid1,HIGH);
     //************ reset the screen *****
     lcd.clear();     
     lcd.print("Input Ready ");
     delay(5000);
     lcd.clear();     
     lcd.print("Clamp Time " + String(ClampTime));
     lcd.setCursor(0,1);
     lcd.print("Weld time  " + String(WeldTime));
     //************  reset the flag *********
      Clamp_flg = 0; // set the flag
     
  } 
}
I Hung a 24 foot Ibeam this morning in the ceiling by myself, programmed a Arduino this afternoon for a solar project, Helped a buddy out with a electrical motor connection issue on the phone, then cut up a chicken for Hotwings. I'd say it has been a "blessed day" for myself and all those around me.

Offline Dawai

  • Full Member
  • ***
  • Posts: 124
  • Country: us
Re: Arduino programming, Mega 2560 ADK
« Reply #14 on: January 01, 2014, 12:18:13 PM »
division head software, good enough to run.
Will do a electrical drawing in a day or so, have to go visit some folks today.
I'd sure like to learn how to address the non-violatile memory ram in a arduino.
Perhaps I will make that tonights puzzle.. to figure out.

CODE written this morning.. using drivers to drive the lcd-keypad and stepper motor.. configuration of stepper is inline with beginning of code in pins, accel, max speed.. etc..
currently 10k long, UNO I purchased has 32k ram??? (due next week) tested on a mega 2560 and lcd-keypad, no steppers tied to it.
'*********** code starts here, cut and paste into arduino ide *******
/* Written by Cofer, NORF Gawgia, USA on 1-1-13
  divider runs a stepper motor, Much simplified by drivers
 */
#include <LiquidCrystal.h> // include this library of lcd operations
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(8,13,9,4,5,6,7);// Set up for my MEga 2560 pins
#include <AccelStepper.h>  // library to simplify the stepper mtr, drive
int AstepPin = 3;     // pin to pulse stepper drive
int AdirPin = 4;       // pin to turn on direction on stepper drive
long maxSpeed = 200000;      // max speed to driver
long accel = 2000;           // accel to driver
long realTime;      // floating timem to calculate delay from 
int aDiv = 10;         // number of steps to travel
long aDist = 0;       // product of 360degrees x stepsPerdegree div divisions
long aLoc;           // location in array of steps
long stepsPerdegree = 200;  // mechanical steps per degree ratio
boolean forrev;       // forward, reverse pin on stepper
boolean runButton;
boolean runFlg;
long endTime;
long updateScreen = 100;
// Define, 2=1st pos denotes 2 wire step & pulse or 4=4 coil driver
// second varible denotes first arduino pin
// third varible denotes second arduino pin
// fourth varible denotes third arduino pin
// fith varible denotes fourth arduino pin
AccelStepper stepper(2,AdirPin,AstepPin,5);
/* accelStepper(2Wire,pin1,pin2,pin3,pin4)*/
//**************************************************
//******************************************
// set up the analog input pin for keypad
//int sensorPin = A0;    //
//int sensorValue = 0;  // variable to store the value coming from the sensor
// define some values used by the panel and buttons
int lcd_key     = 0;
int adc_key_in  = 0;
#define btnRIGHT  0
#define btnUP     1
#define btnDOWN   2
#define btnLEFT   3
#define btnSELECT 4
#define btnNONE   5
// read the buttons ***************************
int read_LCD_buttons()
{
 adc_key_in = analogRead(0);      // read the value from the sensor
 // my buttons when read are centered at these valies: 0, 144, 329, 504, 741
 // we add approx 50 to those values and check to see if we are close
 if (adc_key_in > 1000) return btnNONE; // We make this the 1st option for speed reasons since it will be the most likely result
 // input for analog voltage divider, multiple inputs for one A-Input
 if (adc_key_in < 50)   return btnRIGHT;
 if (adc_key_in < 195)  return btnUP;
 if (adc_key_in < 380)  return btnDOWN;
 if (adc_key_in < 555)  return btnLEFT;
 if (adc_key_in < 790)  return btnSELECT; 
 return btnNONE;  // when all others fail, return this...
}
void setup() {
   // set up the LCD's number of columns and rows:
  lcd.begin(16,2);  // set up the display type
  //SetupScreen;
  // steps per degree??  Used to calculate steps to travel
  // maxSpeed??   Used to set speed at stepper moves
  // 360 multiply "steps per degree"  div divisions is "distance to travel"
    stepper.setMaxSpeed(maxSpeed);
    stepper.setAcceleration(accel);
     lcd.clear(); // clear the display
     lcd.setCursor(0, 0);
     lcd.print("Max Speed "+ String(maxSpeed));
     lcd.setCursor(0,1);
     lcd.print("accel  " + String(accel));
     delay(3000);
     lcd.clear(); // clear the display
     lcd.setCursor(0, 0);
     lcd.print("Pulses per degree ");
     lcd.setCursor(0,1);
     lcd.print(stepsPerdegree);
     delay(3000);
     lcd.clear(); // clear the display
     lcd.setCursor(0, 0);
     lcd.print("Step pin "+ String(AstepPin));
     lcd.setCursor(0,1);
     lcd.print("DIR pin " + String(AdirPin));
     delay(3000);
         
     
     endTime = millis(); // set the first screen update
     }
     
     
// main program loop     
void loop()
{
 lcd_key = read_LCD_buttons();  // read the buttons
 
 switch (lcd_key)               // depending on which button was pushed, we perform an action
 {
  // ********************* Right button ******************
   case btnRIGHT:
     {
     lcd.setCursor(11, 0);
     lcd.print("     ");  //blank the space
     aDiv = aDiv + 1;
     lcd.setCursor(0, 0);
     lcd.print(" Divisions " + String(aDiv));
     delay(1000);
     break;
     }
   //*************** Left Button *********************** 
   case btnLEFT:
     {
     lcd.setCursor(11, 0);
     lcd.print("     ");  //blank the space
     aDiv = aDiv - 1;
     lcd.setCursor(0, 0);
     lcd.print("Divisions " + String(aDiv));
     delay(1000);
     break;
     }
   //******** up button *** 
   case btnUP:
     {
     lcd.setCursor(11, 1);
     lcd.print("     ");  //blank the space
     maxSpeed = maxSpeed + 10;
     lcd.setCursor(0,1);
     lcd.print("Max Speed  " + String(maxSpeed));
     delay(500);
     break;
     }
   //********************* down button ****** 
   case btnDOWN:
     {
     lcd.setCursor(11, 1);
     lcd.print("     ");  //blank the space
     maxSpeed = maxSpeed - 10;
     lcd.setCursor(0,1);
     lcd.print("Max Speed  " + String(maxSpeed));
     delay(500);
     break;
     }
  //******************** Select button *****   
   case btnSELECT:
     {
     //lcd.print("SELECT");
     //** move code here
      if (stepper.distanceToGo() == 0){
       // Make sure we dont get 0 speed or accelerations
   delay(5);
        // math 360 multiply stepsPerdegree div divisions
        aDist = (((360 * stepsPerdegree) / aDiv) + stepper.currentPosition());
   stepper.moveTo(aDist); // set the driver distance to go
        delay(200);  // pause to reflect only one button press.
      }
     
     //************************
     break;
     }
    //******************* no button ***************************
     case btnNONE:
     {
     //lcd.print("NONE  ");
     break;
     }
 }   
 
//******Confirm variables in tolerance
      if (aDiv > 3600){
       aDiv = 3600;
       }
       if (aDiv < 2){
       aDiv = 2;
       }
       if (maxSpeed > 200000){
       maxSpeed = 200000;
       }
       if (maxSpeed < 50){
       maxSpeed = 50;
       }
    //************ reset the screen *****
   
        //timed loop to only update the screen so often 
        stepper.run(); // turn it over to the driver, update it
       
    if (millis() > endTime ) {   
       lcd.clear(); // clear the display
        lcd.setCursor(0, 0);
        lcd.print("Divisions " + String(aDiv));
        lcd.setCursor(0, 1);
        lcd.print("Steps " + String(stepper.distanceToGo()));
        delay(10);
        endTime = (updateScreen + millis());
    }       
                 
     
 
}

I Hung a 24 foot Ibeam this morning in the ceiling by myself, programmed a Arduino this afternoon for a solar project, Helped a buddy out with a electrical motor connection issue on the phone, then cut up a chicken for Hotwings. I'd say it has been a "blessed day" for myself and all those around me.

Offline Dawai

  • Full Member
  • ***
  • Posts: 124
  • Country: us
Re: Arduino programming, Mega 2560 ADK
« Reply #15 on: January 02, 2014, 08:05:43 AM »
Gecko "Unkillable" vampire drive 203.. current adjustable from low to 7 amps by resistors in between the last two terminals.. I have two in my bridgeport now. The ancient 201's are now in the plastic 3d printer. THEY have excellent explanations of their drives, general principles and how to make it work in documentation on their website.
 This new style drive has "opto isolated" step and dir inputs, positive pulse, will work on a 2ms waveform.. so it will work direct connection to the arduino Uno's pins. (less current than a LED on a pin)
  I figured out the sainsmart-DF robot lcd-keypad terminals, posted a actual picture of the device and point to point terminations. HOW more simple can you get? ON the UNO arduino, pins are the same numbers on the mega I have here.

Posted is the terminal designation list on the 203 gecko drive.

Looking at Mike's divider, he may need at least a 400oz motor.. they are $65 on gecko's site.. or $35 off ebay.. beware.. the drive "power" on ebay are jokes.. they laugh, while you wonder why the motor won't pull the load.. (vacuum cleaners, air compressors, they lie about actual hp too)

'******************* cut and pasted drive information ***************
G203V TERMINAL WIRING

The G203V uses a 2-piece modular main connector. The connector is split in two pieces; terminals 1 through 6 (power supply and motor leads) and terminals 7 through 12 (control interface). Each can be removed separately by pulling the connector body upwards and off of the mating header pins on the G203V. The connectors must initially be removed to mount the G203V to a heatsink or chassis.

TERMINAL 1 Power Ground
Connect the negative (black) lead of your power supply to this terminal.

TERMINAL 2 Power (+)
Connect the positive (red) lead of your power supply to this terminal. It must be between +18VDC to +80VDC.

TERMINAL 3 Motor Phase A
Connect one end of your “Phase A” motor winding here.

TERMINAL 4 Motor Phase /A
Connect the other end of your “Phase A” motor winding here.

TERMINAL 5 Motor Phase B
Connect one end of your “Phase B” motor winding here.

TERMINAL 6 Motor Phase /B
Connect the other end of your “Phase B” motor winding here.

TERMINAL 7 Disable
This terminal will force the winding currents to zero when tied to the step and direction controller +5V.

 UNO Pin 3, LCD Shield = TERMINAL 8 Direction
Connect the DIRECTION signal to this terminal.

 UNO Pin 2, LCD shield = TERMINAL 9 Step
Connect the STEP signal to this terminal.

 UNO Pin next to 5vdc bottom LCD shield = TERMINAL 10 Common
Connect the controller’s GROUND to this terminal.

TERMINAL 11 Current Set
Connect one end of your current set resistor to this terminal.

TERMINAL 12 Current Set
Connect the other end of your current set resistor to this terminal.

POWER SUPPLY WIRING

TERMINAL 1 Power Ground
Connect the power supply ground to term.1

TERMINAL 2 Power (+)
Connect the power supply
I Hung a 24 foot Ibeam this morning in the ceiling by myself, programmed a Arduino this afternoon for a solar project, Helped a buddy out with a electrical motor connection issue on the phone, then cut up a chicken for Hotwings. I'd say it has been a "blessed day" for myself and all those around me.

Offline Dawai

  • Full Member
  • ***
  • Posts: 124
  • Country: us
Re: Arduino programming, Mega 2560 ADK
« Reply #16 on: January 03, 2014, 05:58:04 AM »
I connected this to my plastic-3d printer panel sitting here in the floor. (wired a female db25 plug to a terminal strip, plugged the cable in) I was amazed, I had ran the motors, panel through Mach3 cnc software and the PC.

With the 10x multi-step resolution on the gecko 201 drives you can hardly see the motors moving. (10 x 200steps per rev) POWER is such you can't hold the gear pulley, but.. painfully slow.  Looking online, most all the 3d plastic printers use a different processor. Use 1x single step, or 2x half step polu drivers.

So I cleaned the code up some.  THE lcd "timed screen update", the lcd driver running in the back ground, had a 1 second per update, it was enough to "change the pitch" and stutter the drive when it took the time to write to the parallel screen update.  I changed the screen print to "moving" while it is in motion and abandoned the update.  I also moved the "if" statements for variable "limits" inside the Button statements where it would only be ran when data is entered and not every loop.

Possibly the "keypad button subroutine" is slowing this way down, as the F-keys used to in GW BASIC, it searched for a "Fkey" in between each line-statement.???

The simple stepper driver has a 1000 steps per second limit it says on the site.

I have been programming these Arduino's for two weeks now, some learning from everyone in the process. I felt pretty whipped at bedtime last night. I stuck the "parallel" cable back on the pc, the motors spun like 2,000rpm in Mach3.

I would not say this is a total failure, it has been a learning experience, but is pretty poor final results in two days work.
I Hung a 24 foot Ibeam this morning in the ceiling by myself, programmed a Arduino this afternoon for a solar project, Helped a buddy out with a electrical motor connection issue on the phone, then cut up a chicken for Hotwings. I'd say it has been a "blessed day" for myself and all those around me.

Offline tom osselton

  • Hero Member
  • *****
  • Posts: 1256
  • Country: ca
Re: Arduino programming, Mega 2560 ADK
« Reply #17 on: January 03, 2014, 02:09:11 PM »
Don't worry about it I'd still be looking at it scratching my head!  I've never played with code or any diodes,  resistors,  or cap's but will eventualy make a little cnc machine.

Offline Dawai

  • Full Member
  • ***
  • Posts: 124
  • Country: us
Re: Arduino programming, Mega 2560 ADK
« Reply #18 on: January 03, 2014, 06:00:06 PM »
Yeah, I've hung my back up today, too much, started at 8am, it was 16F..had ice in my beard at 10:30 when I came in first time. (cleaning up the shop and yard)

CNC for newbies.. go to Mach3 download the mach3 support manual, read the description, HOW it works, it explains everything from "Cartesian" coordinates (square, up, down, left, right fore-back) movements.  Another good place is geckodrive.com and look at the literature there.. he also explains well.

These new cncs that make circular polar moves in all directions just confuse me. I tried to figure out how to code a gcode file.. was even more confused. While working for a local company on a welding robot program, you just take the pendant and "trace" your desired route, if you want to modify a point, just run the movements to that step, and add, subtract distance there on that point and it recalculated everything for me..  That was a tig welder that used some kind of copper looking powder as filler metal.???  I didn't get to slow down there long enough to learn much. Running through breaks and lunch. I wore out a pair of boots in a month.

I'll rewire a board to run 4 tip120 transistors, it'll be a full step  drive, do a pwm for current limiting. Been so long since I fabbed something I'll have to research all the data sheets again. 
I Hung a 24 foot Ibeam this morning in the ceiling by myself, programmed a Arduino this afternoon for a solar project, Helped a buddy out with a electrical motor connection issue on the phone, then cut up a chicken for Hotwings. I'd say it has been a "blessed day" for myself and all those around me.