Show Posts
Pages: [1] 2 3
1  Using Arduino / Motors, Mechanics, and Power / Re: Simple sketch to drive a stepper motor with a RC transitter on: October 08, 2013, 03:39:59 pm
Thanks Robin. I will give that a go.  Cheers.
2  Using Arduino / Motors, Mechanics, and Power / Simple sketch to drive a stepper motor with a RC transitter on: October 06, 2013, 09:05:42 pm
Hello All,

I thought I would share this simple sketch that I have cobbled together to operate a Leadshine 57HS22-C stepper motor using a Leadshine M325 driver and a Arduino Mega 2560 via remote control.  The radio transmitter is a Turnigy 9x and  a Turnigy reciever.  The Arduino is recieving the signals from Ch1 of the reciever via pin 6.  Pin 5 of the Arduino is going to the DIR (direction) pin of the stepper driver and Pin 4 is going to the PUL (pulse) pin of the stepper driver and 5V from the Arduino is going to the OPTO pin of the stepper driver.

When operating the stepper moves up to 180 degrees in one direction for a left or right movement of the transmitter control stick (in this case the aileron control of the mode 1 Turnigy 9x).  It seems to work reasonably well although there is some "chatter" when stationary.

I hope someone finds this of use but please feel free to offer suggestions or improvements.

Code:
#include <AccelStepper.h>
// Define a stepper and the pins it will use
AccelStepper stepper(1, 4, 5);

int steps;
int ch1; // Here's where we'll keep our channel values
void setup()

  Serial.begin(9600);
  pinMode(6, INPUT); // Set our input pins as such
  stepper.setMaxSpeed(3000);
  stepper.setAcceleration(3000);
}
void loop()
{
  if (stepper.distanceToGo() == 0)
  ch1 = pulseIn(6, HIGH, 25000); // Read the pulse width of
  steps=(map(ch1, 1065,1915,-100,100)); // center at 0
  stepper.moveTo(steps);
  stepper.run();
  Serial.println(ch1);
}
3  Using Arduino / Motors, Mechanics, and Power / Re: Wiring arduino mega to high current stepper motor control on: September 16, 2013, 05:24:24 pm
Thanks Mark.  Yes I have wired it up as shown in Figure 2.  I haven't used any resistors as the voltage from the Arduino is 5 v.  But it seems to be working ok.

Cheers
4  Using Arduino / Motors, Mechanics, and Power / Re: Wiring arduino mega to high current stepper motor control on: September 16, 2013, 08:52:50 am
Thanks db,

I have tried it with 5v from the arduino going to opto, pin 4 going to pul and pin 5 going to dir.  I tried a simple sketch and it seems to be working fine.

Thanks for your thoughts, i will keep them in mind as I continue to to learn about steppers.

Cheers,

Steve
5  Using Arduino / Motors, Mechanics, and Power / Wiring arduino mega to high current stepper motor control on: September 16, 2013, 01:13:32 am
Hello,

I would like to use an Arduino Mega to control a stepper motor via a Leadshine M325 or(or M422) stepper motor controller (http://oceancontrols.com.au/datasheet/lea/smc010_DM422Cm.pdf).  I have sorted out how to hook up the motor and 24v power supply to the M325 but I would like some clarification on how to wire the arduino into the opto, pul, dir and ena pins.

I think 5v from the arduino goes to the opto pin, any 2 digital pins go to the pul and dir pins and I don't necessarily need to use the enable pin?

Thankyou for your advice.
6  Using Arduino / Programming Questions / Re: Seeeduino NFC SPI library on: June 11, 2013, 08:34:13 am
Thanks for checking it out for me Paul.  I couldn't see the .h or .cpp files or examples folder when I was trying to download it earlier.  But when you confirmed that they were there I tried again and they turned up! Consequently I tried a couple of example sketches and have been able to read some NFC tags. 

Good result, many thanks!

Steve
7  Using Arduino / Programming Questions / Re: Seeeduino NFC SPI library on: June 11, 2013, 07:10:58 am
Good point Paul! From here:-

http://www.seeedstudio.com/wiki/File:PN532_SPI_V2.zip
8  Using Arduino / Programming Questions / Seeeduino NFC SPI library on: June 11, 2013, 05:59:03 am
Hello,

I have just received a Seeeduino NFC shield.  I have tried to download the Seeeduino NFC library however the library does not appear to be complete and despite unzipping the file to my arduino library file there are no examples appearing in the Arduino IDE.  Has anyone come across this problem and been able to use the library?  I am using an Arduino Mega 2560.

Kind regards.

9  Using Arduino / Motors, Mechanics, and Power / Re: What Arduino output signal is required for 12DC motor speed controller? on: May 06, 2013, 04:19:16 pm
Thanks for your time and advice Chargrin, I will keep looking.
10  Using Arduino / Motors, Mechanics, and Power / What Arduino output signal is required for 12DC motor speed controller? on: May 05, 2013, 10:21:30 pm

Hello,

I would like to control a 12V DC wheelchair motor using an Arduino Mega 2560.  I am considering obtaining the speed controller illustrated in the following link.

http://secure.oatleyelectronics.com/files/K275%20WEB%20NOTES.pdf

The input to this speed controller can either be a twist grip type "throttle" as used for electric bike etc or a potentiometer.  My question is can I use a PWM output signal from the Arduino as the input to the speed controller?  I would also like to be able to control the 12V motor via remote control, but I'll sort out the input required from the Arduino to the speed controller first.

Kind Regards.
11  Using Arduino / Networking, Protocols, and Devices / Re: Ethernet Shield with Mega 2560 data feed drop out problems on: April 23, 2013, 07:45:33 am
Thanks SurferTim I will check it out.
12  Using Arduino / Networking, Protocols, and Devices / Ethernet Shield with Mega 2560 data feed drop out problems on: April 23, 2013, 06:22:21 am
Hello,

I am using a Mega 2560 with an Ethernet shield to monitor temperature and humidity from a DHT11 sensor.  I have set up an account on Cosm and everything works well for 5 to 10 minutes and then the connection seems to drop out.  If I press the reset button on the Ethernet shield the feed starts again for another 5 to 10 minutes before dropping out again.  Is this a common problem and if so how can I fix it to recieve data continuously and reliably?

Thanks in advance.
13  Using Arduino / Storage / Re: GPS data logger with SD card and Mega on: October 21, 2012, 03:23:33 pm
Thanks liudr.  I do intend on adding an LCD screen so I will check it out.

Regards
14  Using Arduino / Storage / Re: GPS data logger with SD card and Mega on: October 20, 2012, 04:27:19 pm
Hello again,

Well I have successfully got my GPS data logger working using a hardware serial port (Serial 3) of my Mega 2560.  The data is written to the SD card of the Ethernet shield and the csv file is set up for the GPS Visualizer software. 

Thanks again for your suggestions and advice.

The code below is my latest version. 

Cheers 

Code:
#include "TinyGPS.h"
#include <SD.h>
TinyGPS gps;

void setup()
{

 Serial.begin(115200);
 Serial3.begin(4800);
 SD.begin(4);
 
 pinMode(53, OUTPUT);
 
  File myFile = SD.open("trip.csv", FILE_WRITE);
  myFile.print("type,latitude,longitude,alt");
  myFile.close();
  Serial.print("type,latitude,longitude,alt");
}
void loop()
{
 bool newdata = false; // check if data is coming in
    if (feedgps())
      newdata = true;
 
  if (newdata)
  {   
 
  unsigned long chars;
  unsigned short sentences, failed;
 
  // For one second we parse GPS data and report some key values
  for (unsigned long start = millis(); millis() - start < 1000;)
  {
 
      // process new gps info here
      long lat, lon;
unsigned long fix_age, time, date, speed, course;
unsigned long chars;
unsigned short sentences, failed_checksum;

// retrieves +/- lat/long in 100000ths of a degree
gps.get_position(&lat, &lon, &fix_age);

// time in hhmmsscc, date in ddmmyy
gps.get_datetime(&date, &time, &fix_age);

// returns speed in 100ths of a knot
speed = gps.speed();

// course in 100ths of a degree
course = gps.course();

float flat, flon;

// returns +/- latitude/longitude in degrees
gps.f_get_position(&flat, &flon, &fix_age);
float falt = gps.f_altitude(); // +/- altitude in meters
float fc = gps.f_course(); // course in degrees
float fk = gps.f_speed_knots(); // speed in knots
float fmph = gps.f_speed_mph(); // speed in miles/hr
float fmps = gps.f_speed_mps(); // speed in m/sec
float fkmph = gps.f_speed_kmph(); // speed in km/hr

File myFile = SD.open("trip.csv", FILE_WRITE);

  myFile.print("T");
  myFile.print(",");
  myFile.print(flat,7);
  myFile.print(",");
  myFile.print(flon,7);
  myFile.print(",");
   myFile.println(falt);
  myFile.close();
 
Serial.print("T");
Serial.print(",");
Serial.print(flat,7);
Serial.print(",");
Serial.print(flon,7);
Serial.print(",");
Serial.println(falt);

delay(500);

    }
 }
 
}
static bool feedgps()
{
  while (Serial3.available())
  {
    if (gps.encode(Serial3.read()))
      return true;
  }
  return false;
}

15  Using Arduino / Storage / Re: GPS data logger with SD card and Mega on: October 18, 2012, 01:26:12 am
Thanks cyclegadget and liudur, I will change my code and see how it goes, will update with results...
Pages: [1] 2 3