Show Posts
Pages: 1 [2] 3 4 ... 7
16  Using Arduino / Programming Questions / Re: Using Quadrature Encoder Library - Issue on: August 14, 2014, 11:18:14 am
Hello UKHeliBob

In software, I disabled some encoders and attempted to run each separately, but that was not the issue.

Using another (new) Arduino Due, doesn't solve the problem.

However, switching the connections (rather, switching the axes of the encoders to the Arduino) works. Telling me that the installation of the encoders and the developed controller itself is working no problem.

This comes down to the software and possibly the library.

Regarding switching the pins. I prefer to keep how it set up, since I have developed the PCB already. You may ask why I haven't tested it, well I have using my own code - but I would like to try and get this working with this library.

Also, thank you for noting the millis() concern. It was not problem, as I am debuging my code differently now - so that cannot be the issue.

If you are interested I am essentially now using the example linked previously.

Thank you again.

Code:
/*
Pin Definition

- Axial
  - MCHA --> 21
  - MCHB --> 20

- Radial
  - MCHA --> 19
  - MCHB --> 18
 
- Knob
  - MCHA --> 17
  - MCHB --> 16
*/

#define ENCODER_OPTIMIZE_INTERRUPTS

#include <Encoder.h>

#include <stdio.h>

// Master and Slave Encoder Signals

long mAxialPosition = 0;
long mRadialPosition = 0;
long mKnobPosition = 0;

Encoder mAxial(21, 20);
Encoder mRadial(19, 18);
Encoder mKnob(17, 16);

void setup()
{
  Serial.begin(9600); // PC
}

void loop() {
  long newAxial, newRadial, newKnob;
 
// Read Controller Encoders
  newAxial = mAxial.read();
  newRadial = mRadial.read();
  newKnob = mKnob.read();
 
  if (newAxial != mAxialPosition || newRadial != mRadialPosition || newKnob != mKnobPosition) {
  Serial.print("Axial = ");
  Serial.print(newAxial);
  Serial.print(", Radial = ");
  Serial.print(newRadial);
  Serial.print(", Knob = ");
  Serial.println(newKnob);
  mAxialPosition = newAxial;
  mRadialPosition = newRadial;
  mKnobPosition = newKnob;
  }

  if (Serial.available()) {
    Serial.read();
    Serial.println("Reset all counts to zero");
    mAxial.write(0);
    mRadial.write(0);
    mKnob.write(0);
  }


}
17  Using Arduino / Programming Questions / Using Quadrature Encoder Library - Issue on: August 14, 2014, 10:29:17 am
Hello,

I am using the following encoder library:

https://www.pjrc.com/teensy/td_libs_Encoder.html

I am using a 3-axis controller I developed, whereby I would like to use the library in order to find out the current positions of the axes.

The encoders were installed correctly, the signals are seen at the Arduino pins (by the way, I am using an Arduino Due) using an oscilloscope, but for some reason the output is only working correctly for 1 of the 3 axes. Not sure why I am not seeing all three working correctly. Thank you in advanced.

Code:
/*
Pin Definition

- Axial
  - MCHA --> 21
  - MCHB --> 20

- Radial
  - MCHA --> 19
  - MCHB --> 18
  
- Knob
  - MCHA --> 17
  - MCHB --> 16
*/

#define ENCODER_OPTIMIZE_INTERRUPTS

#include <Encoder.h>

#include <stdio.h>

// Master and Slave Encoder Signals

long mAxialPosition = 0;
long mRadialPosition = 0;
long mKnobPosition = 0;

Encoder mAxial(21, 20);
Encoder mRadial(19, 18);
Encoder mKnob(17, 16);

void setup()
{
  Serial.begin(9600);
}

void loop()
{
  if ((millis() % 100) == 0){
    Serial.print(mAxialPosition);
    Serial.print("||");
    Serial.print(mKnobPosition);
    Serial.print("||");
    Serial.println(mRadialPosition);
  }

// Read Controller Encoders
  mAxialPosition = mAxial.read();
  mRadialPosition = mRadial.read();
  mKnobPosition = mKnob.read();
}

Output Example

Code:
-1929||0||0
-1928||0||0
-1922||0||0
-1904||0||0
-1897||0||0
-1895||0||0
-1636||0||0
-818||0||0
422||0||0
1601||0||0
1768||0||0
984||0||0
-571||0||0
-2130||0||0
-2688||0||0
18  Using Arduino / Programming Questions / Re: Sending Strings using Arduino Console on: August 06, 2014, 04:24:59 pm
Oh my goodness..

For some reason the default mode on the Serial Monitor does not send a LF... All my original methods are working now.

Thank you for your guidance.
19  Using Arduino / Programming Questions / Re: Sending Strings using Arduino Console on: August 06, 2014, 03:28:14 pm
I tried making a boolean variable to make sure that it doesn't get printed before the concatenation is complete

Code:
 while (Serial.available()) {
    char myChar = Serial.read();
    Command.concat(myChar);
    commandReady = HIGH;
  }
  
  if (commandReady == HIGH) {
    Serial.println(Command);
    commandReady = LOW;
  }

I am still seeing the same output. How can I ensure that Serial is completely read before sending out the data?
20  Using Arduino / Programming Questions / Re: Sending Strings using Arduino Console on: August 06, 2014, 03:14:16 pm
AWOL,

Isn't that what I am doing by using a nested while() loop.

Also, just to edit, the output is actually being displayed after every 2 characters being concatenated.

Daniel
21  Using Arduino / Programming Questions / Re: Sending Strings using Arduino Console on: August 06, 2014, 03:09:39 pm
Hello BulldogLowell

My attempt at concat() ends up something like this:

Code:
  if (Serial.available()) {
    while (Serial.available()) {
      char myChar = Serial.read();
      Command.concat(myChar);
    }
    Serial.println(Command);
  }
 

But for some reason it is sending each concatenation rather than waiting for the full command to build up.

Anything you suggest I can do?

Daniel
22  Using Arduino / Programming Questions / Sending Strings using Arduino Console on: August 06, 2014, 01:01:19 pm
Hello,

I am having difficulty using my Arduino Due to communicate with another device via RS232. The devices response back to the arduino using chars but only accepts strings as inputs for commands.

I want to be able to use the console to tell a command to the Arduino, where the Arduino will then forward it to another Serial line to the device.

The response seems to be working correctly because during setup(), I am sending string commands to enable and configure the RS232 device. But to interact with it in real-time via console is giving me issues.

How do I correctly read the console serial data as a string and then Serial.print the command.

So far my code looks like this:

Code:
int ForceSensorPin = A8;
int LimitSwitchPin = 4;

volatile int LimitSwitchState = LOW;

void setup() {
  pinMode(LimitSwitchPin, INPUT);
  
  Serial.begin(9600);  // Computer
  Serial3.begin(9600); // RS232
 
  delay(1000);
  Serial3.println("EN");
  delay(100);
  Serial3.println("AC30000");
  delay(100);
  Serial3.println("DEC30000");
  delay(100);
  Serial3.println("SP10000");
}

char Command = 0;
char Response = 0;

void loop() {
  if (Serial.available()){
    Command = Serial.read();
    Serial3.print(Command);
  }
  if (Serial3.available()){
    Response = Serial3.read();
    Serial.print(Response);
  }
}
23  Using Arduino / Networking, Protocols, and Devices / Arduino UNO to DUE Communication via Serial on: July 21, 2014, 04:00:55 pm
Hello,

I am wondering if it is possible to using a USB-B to Micro USB cable to communicate between the UNO and DUE via the programming ports. I don't see how it is an issue (other than debugging of course). I haven't tried it yet, but I do want the community's opinion.

Thanks,
Daniel
24  Using Arduino / General Electronics / Re: LED Over Current Indication: Circuit on: December 05, 2013, 10:20:38 am
Hello LarryD,

Thanks for getting back to me, I was looking at comparators and high-side current sensing, but this seems like an easier implementation.

Rather, I would prefer once the fuse is blown there is no more current feeding through the load. 

I cannot think of how to modify your circuit to get what I want.  Are there types of fuses that will act like a switch when triggered?

Daniel
25  Using Arduino / General Electronics / LED Over Current Indication: Circuit on: December 04, 2013, 11:46:33 pm
Hello Community,

For my project's power supply circuit, I have as 12V  source going through a fuse before going into the regulator.

The fuse is set to trigger at 3A.  When this occurs, I want have an LED to indicate over current draw.

I was wondering what would be the best solution to do this?

Thanks,
Daniel
26  Using Arduino / General Electronics / Re: Arduino DUE: max current from Vin pin on: December 04, 2013, 12:16:54 am
Hello,

I have a similar inquiry.

I want to understand the small circuit before the regulator which includes diode D1 and the ferrite bead. 

Comparing the Due to the Uno, D1 is now parallel rather than in series, so current pull should not depend on the diode (correct me if I am wrong).  Rather, between VIN and the Power Jack is the ferrite bead rated at 3A.

Going back to D1, I see that if there is a reverse voltage VIN and GND become shorted which is scary to me, but I guess it saves the electronics - but may destroy your power supply.

Now to summarize, assuming that power is wired correctly. VIN pin should be able to source 3A.

I am developing my on motor driver board so I am trying to understand if developing external power is necessary or I can just use VIN.

If there is anything I said wrong, please correct me.

Thanks,
Daniel
27  Using Arduino / Motors, Mechanics, and Power / Re: L298P: Thermal Pad Connection on: October 25, 2013, 12:50:25 pm
When DC motors start from a standstill, they draw the stall current for a short period of time. If you suddenly reverse the direction of rotation, the short-term current draw is even higher than the stall current.

Hello jremington,

Yes the inrush current will a concern since the driver will not be able to provide that current, ~3.75A at 9V.  Additionally, my power supply is not rated for the inrush current.  I will need to develop a current limiter or just add a resistor to enable a soft-start.

Daniel
28  Using Arduino / Motors, Mechanics, and Power / Re: L298P: Thermal Pad Connection on: October 25, 2013, 10:55:48 am
It's unusual to power motors from a regulated power supply.

Yes I agree with you. For my application, I am using a custom battery and it is important that I maintain a constant DC external motor supply.  Regulating the 12V to 9V with a low-dropout high-current voltage regulator should do the job.

However, the stall current is quite high, looks like it will be about 3.75A @ 9V. So I suggest you either use both channels of one chip in parallel per motor, or (if you do not require the full torque), connect a low-value resistor in series with each motor to limit the current. It's probably also a good idea to use soft-start.

I doubt I will ever get close to the stall toque, but just to be same I will nonetheless use one driver for one motor. More current capacity cant hurt anything.

Again dc42, thank you for your suggestions.

Daniel
29  Using Arduino / Motors, Mechanics, and Power / Re: L298P: Thermal Pad Connection on: October 25, 2013, 09:39:55 am
The L298 has a voltage drop of 2.55V typical, 3.2V max @ 1A. So at 800mA load, each L298P will have to dissipate around 2W, perhaps even 2.5W. You will need a lot of PCB area fanning out from the thermal slug to get rid of that heat. Even if you solve that problem, you will need to provide a higher battery voltage to allow for the voltage drop.
http://www.amazon.co.uk/Motor-Driver-1A-Dual-TB6612FNG/dp/B007XEVHLC.

dc42, I appreciate your suggestions and I believe I will be switching my driver based on what you have provided me.  I did not know that there such a significant voltage drop on the L298 that would contribute to heat production.  I am assuming you calculated that 2W from 2.55V (voltage drop) * 800 mA current draw = 2.04W dissipation.

If the VHN5019 has too many legs for you to solder easily, how about using the TB6612FNG dual motor driver, if your supply voltage is 13.5V or less? It can drive 2 motors at up to 1.2A continuous, with a typical voltage drop of 0.4V @ 800mA. So you will only have to get rid of 1/6 of as much heat compared to the L298. You could connect both channels in parallel for even better performance.
http://www.amazon.co.uk/Motor-Driver-1A-Dual-TB6612FNG/dp/B007XEVHLC.

I am powering my system through a 9V regulated from 12V battery supply, so the TB66 seems efficient enough to drive the motors.  The motors in particular is linked below:

http://www.pololu.com/catalog/product/1447/specs

As you see the current draw is low and with the torque provided, my application will not load much further than 2-3 times the free-running current.

btw if you have been hand-soldering the VHN5019, then I strongly recommend that you look into other SMD soldering techniques. The hotplate method is a good place to start.
http://www.amazon.co.uk/Motor-Driver-1A-Dual-TB6612FNG/dp/B007XEVHLC.

The pin count isnt the biggest trouble for me.  My first revision of the board, I really didn't think about how I will solder the thermal slugs located on the bottom of the chip.  I did not know about using vias to feed in solder from the bottom. I had to use a hot air gun with solder paste to attempt to get this to work.  It was a large mess and it kind of forced me away from the chip.  Our lab has no other tools, like a reflow oven to appropriately do this. I like this TB66 because it seems to be efficient without a thermal slug.

Additionally, I am using the Arduino Due, and the TB66 seems to allow CMOS level operation voltage (>2.7V).

Something is concerning me, the breakout board doesn't have fly-back protection diodes, and the datasheet doesn't specify that it is included.  I am sure they are necessary.

Thank you for your suggestions, I appreciate them.
Daniel

30  Using Arduino / Motors, Mechanics, and Power / Re: L298P: Thermal Pad Connection on: October 25, 2013, 08:02:25 am
I don't know the answer to your question, but if you are building your own board using SMD components, why on earth are you using an L298? There are lots of mosfet-based SMD motor driver chips available that are far superior to the L298. In particular, they have much lower voltage drop (and therefore they generate much less heat), and most of them have built-in current limiting.

The first revision of my board utilized the VNH5019, I found those to be extremely efficient but also pretty tedious in soldering them.  I hear a lot of horror stories with the L298 being a fat power dissipating radiator of heat.  Fortunately for my application, I hooked up the L298's H-Bridges in parallel boosting up my current capacity, hoping this will keep the driver and a decent level of heat. Essentially each motors is being driven by one L298.

For my application, I do not expect these motors to pull anywhere past 600 mA - 800 mA of current. With the L298 being use in parallel, it can output 4A, this is giving me the OKAY to use these chips.  Unless you have another reason in which I haven't looked into, I want to use the L298 for it's simplicity.

Any suggestions?

Daniel
Pages: 1 [2] 3 4 ... 7