Loading...
  Show Posts
Pages: [1] 2 3 ... 17
1  International / Software / Re: 3 puertos seriales on: May 20, 2013, 07:53:46 am
Hola EJTR,
Desconozco la naturaleza de tu aplicacion, o si tienes restricciones de espacio pero en algunos casos el uso de un multiplexor puede ayudar.
En el pasado he utilizado el multiplexor analogo 4052 con exito para el puerto serie. Saludos y suerte!
2  Products / Arduino Due / Re: [ now published on github ] Building a CAN API for Arduino DUE on: May 19, 2013, 11:11:00 am
Do you think it is feasible to integrate the canfestival into the Arduino IDE for Arduino Due and possibly also in Arduino Uno with the seeedstudio or sparkfun can shield?

Hello maxwest,

As an integrator I could say Yes. Integrate canfestival (or any other third-party CANopen protocol like CanOpenNode, etc.) to Due or UNO should be feasible. The problem lies that between CAN bus and CANopen there is an in-construction bridge of missing layers to be built. So far, I'm not aware of any software (code) implementation that fills the gap. Again, it can be done and collin (reply #152) and me have made comments about this matter but let me explain in a dossier this thing.

CAN bus and CANopen (an other CANs) are OSI bus standards to communicate embedded control systems like MCUs between them without an intermediate host.

CAN bus is the lowest level link in the chain and it comprehends basically three layers or profiles.

1. Physical layer. Implemented with a transceiver (SN65HVD234 in my design)
2. Data Link layer. Implemented with a controller (inside SAM3X8E)
3. Application Layer. Implemented with software (our CAN library)

Layers 1 and 2 are known as CAN itself.

CAN open is a higher level protocol. It comprehends the first two layers of CAN bus plus other layers above, as follows:

3. Application Layer (non existent for DUE) - communication - I/O - drives -motion control - programmable devices
4. Transport Layer (software-reliability, segmentation/desegmentation, error control).

Thus, it all about to generate the layers 3 and 4.     

Having said this, now you know, broadly speaking, what it is required to complete the bridge and let the train goes.

There is another thing: Time. How much time can you afford to reconcile canfestival and Due? Right now I am trying to make our new Arduino CAN and EMAC libraries to run in a third-party board based on a SAM3X8C. This MCU has only 100 pins unlike the MCU of the Due SAM3X8E with 144 pins and even though they belong to the same family "X", I have to so some tweak on the current variant files (.cpp and .h) and pin_arduino.h. See that my case is your opposite case, I am integrating a third-party board with CAN library (you want integrate a third-party library with DUE or UNO). My integration is not a big deal given that the differences between both MCUs is minimal. In your case, I would recommend to visit the canfestival community and ask questions. I would recommend also that you start with UNO (AVR) and a CAN shield. I hope this helps you. Good luck!
3  Products / Arduino Due / Re: CAN interface on: May 17, 2013, 09:56:10 am
Nice job Rob!
May be this is a silly question but could you tell me how the 120 ohm terminal resistors are set up?

Thank you,
Wilfredo
4  Products / Arduino Due / Re: [Finally a working EMAC library] Connecting an Ethernet PHY to Arduino Due on: May 09, 2013, 10:02:10 am
Hello komby,

Wow, I am amazed with what you have pulled off. Nice work!

This is getting really good. So far, you are the fourth developer with a Due DIY board-oriented that includes the Ethernet phy interface (floating or embedded).

Here the list (with no order of preference but chronological for me):

1- as-kit.ru new AS-SAM3X board (also includes the CAN bus embedded interface)

2- elechouse.com new Taijiuino R2 version.

3- Graynomad's Black Diamond (also includes CAN bus and other communication interfaces).

4- komby (web site?)

I am happy that this initiative has already gained a great deal of software/hardware support.

Thank you,
Wilfredo
5  Using Arduino / Programming Questions / Re: Needed a more reliable method of measuring frequency on: April 26, 2013, 08:04:44 pm
There is a library:
http://interface.khm.de/index.php/lab/experiments/frequency-measurement-library/
I was wander, looking at your code you are newby, how you get over 200 posts and still don't know about playground?

Hello Magician. Thank you very much for the link.

In reference to your comment, I must say that having such a wonderful forum, sometimes we can save a bit of time asking questions that surely will be correctly answered and why not, make a new friend of the 130,000 souls of this gang. Must of the codes I post here are an excerpt of the original code. I do this way to approach better the ussue in question. I must say also that for several reasons, not all of us have time to engage with all the fields. I built the EMAC and CANbus libraries for Arduino Due (this last one with 14 pages!). I purchased a month ago my new GSM shield and I haven't unboxed it yet. Without wishing to cause offence, I believe that, even the Brattain members here are newbies in some Arduino fields. Thank you again Magician for your time and link. Regards, Palliser
6  Using Arduino / Programming Questions / Needed a more reliable method of measuring frequency on: April 26, 2013, 06:52:48 pm
Hello.
The following code measures the frequency of a pulse train input in Arduino Uno. It is very accurate but sometimes (around 5%) it reads wrong pulseIn values, either in the high or low pulses. I don't know why.

Code:
int D13 = 13;
float Frequency13 = 0;

unsigned long HighTime13;
unsigned long LowTime13;
unsigned long Period13;

void setup() {
    Serial.begin(9600);
    pinMode(D13, INPUT);
}

void loop() {
 
  HighTime13 = pulseIn(D13, HIGH);
  LowTime13 = pulseIn(D13, LOW);
  Period13 = HighTime13 + LowTime13;
  Frequency13 = 1/(Period13 * 0.000001015);
 
  Serial.print("Freq13=");
  Serial.println(isfinite(Frequency13)?Frequency13:0);
}

I tried it removing the print function and using a real pullup resistor on the input pin but with the same result. I was reviewing here in the forum but it looks like a method should be consolidated, may be using directly millis or micros?
I am much more interested in a reliable method that accurate, i.e. reducing the wrong values to 1 or 2%, thus, I would appreciate it if someone could enlighten me with a better approach. Thank you.
7  Using Arduino / Programming Questions / [ SOLVED] Re: Renaming Infinite on: April 26, 2013, 11:37:05 am
eg. Serial.print(isfinite(f)?f:0);

It worked! Thank you stimmer. By chance, you know how to solve this in case of overflow (ovf)?

8  Using Arduino / Programming Questions / Renaming Infinite on: April 26, 2013, 11:08:37 am
Hello. I have a silly question.

I am printing a float variable F but sometimes its value is infinite (division by zero). In other words, my 'float' value turns it into a string ("inf").
Thus, I need a simple way to print a zero (0) when that happens.

How can I do that?

Thank you.
9  Products / Arduino Due / Re: [ now published on github ] Building a CAN API for Arduino DUE on: April 25, 2013, 11:49:10 am
Sounds like it's covered. You didn't use a resistor on RS in the post #33 schems, I think I'll add one, value TBD.

______
Rob

Hello Rob,

At this time, this is a very good point. Thanks for mention it because it allows me to clarify something:

Knowing that the most important thing in the first stages of this project was to establish a good communication between nodes, I forced a 'direct mode' in the transceivers connecting pins 5(EN) to 3V3 and pins 8(Rs) to GND but now that some users out there have achieved this, their next step should be to deal with the connection/control of those pins if they are interested to exploit the low power mode an other features of these transceivers, thus, a 10K pullup resistor must be connected on EN and a 10K pulldown resistor on Rs according to Atmel's original design (doc11156).
10  Products / Arduino Due / Re: [ now published on github ] Building a CAN API for Arduino DUE on: April 24, 2013, 04:39:40 pm
In the github CAN samples 1 & 2, I used four pins to control the two transceivers as follows:

CAN0 Transceiver
- pin A7 (D61) to enable/disable the lowpower mode.
- pin A8 (D62) to enable/disable the transceiver.

CAN1 Transceiver
- pin A9 (D63) to enable/disable the lowpower mode.
- pin A10 (D64) to enable/disable the transceiver.

But you can choose the pins that best suits your needs. For example, let's say you want to use pin 46 (D46) to enable the lowpower mode in the CAN1 transceiver, you have to use the following code:

Code:
SN65HVD234_SetRs(&can1_transceiver, 46);
SN65HVD234_EnableLowPower(&can1_transceiver);

Or, if you want to use pin A4 (D58) to restore normal lowpower mode (disable) in the CAN0 transceiver, you have to use the following code:
 
Code:
SN65HVD234_SetRs(&can0_transceiver, 58);
SN65HVD234_DisableLowPower(&can0_transceiver);

Similar case to enable or disable the transceivers. For example, you want to use pin 14 (D14) to disable the CAN0 transceiver, you have to use the following code:

Code:
SN65HVD234_SetEN(&can0_transceiver, 14);
SN65HVD234_Disable(&can0_transceiver);

I hope that the foregoing clarify a bit more the use of the control pins for the CAN transceivers.

EDIT: Of course, the four pins you choose and add to your sketch shall be connected to the transceivers pins EN ans Rs accordingly.
11  Using Arduino / Programming Questions / Help Needed changing PID constants using a DIP-Switch on: April 23, 2013, 04:48:20 pm
Hello.

I have an Arduino Uno with the following sample sketch taken from
http://playground.arduino.cc//Code/PIDLibaryBasicExample:

Code:
/********************************************************
 * PID Basic Example
 * Reading analog input 0 to control analog PWM output 3
 ********************************************************/

#include <PID_v1.h>

//Define Variables we'll be connecting to
double Setpoint, Input, Output;

//Specify the links and initial tuning parameters
PID myPID(&Input, &Output, &Setpoint,2,5,1, DIRECT);

void setup()
{
  //initialize the variables we're linked to
  Input = analogRead(0);
  Setpoint = 100;

  //turn the PID on
  myPID.SetMode(AUTOMATIC);
}

void loop()
{
  Input = analogRead(0);
  myPID.Compute();
  analogWrite(3,Output);
}

This sketch works OK. If I change the PID constants (Kp, Ki, Kd) in the code, it also works OK (the output changes). Thus, I have decided to modify the previous sketch adding an external DIP-switch (8-position) to change the PID constants manually as follows:

Kp = positions 1, 2 and 3 where 1 is MSB and 3 LSB
Ki = positions 4, 5 and 6 where 4 is MSB and 6 LSB
Kd = positions 7 and 8 where 7 is MSB and 8 LSB

Here is the modified sample:

Code:
#include <PID_v1.h>

//Define Variables we'll be connecting to
double Setpoint, Input, Output;
double Kp=2;
double Ki=5;
double Kd=1;

//Specify the links and initial tuning parameters
PID myPID(&Input, &Output, &Setpoint,Kp,Ki,Kd, DIRECT);

void setup()
{

pinMode(2, INPUT);
pinMode(3, INPUT);
pinMode(4, INPUT);
pinMode(5, INPUT);
pinMode(6, INPUT);
pinMode(7, INPUT);
pinMode(8, INPUT);
pinMode(9, INPUT);

  //initialize the variables we're linked to
  Input = analogRead(0);
  Setpoint = 100;

  //turn the PID on
  myPID.SetMode(AUTOMATIC);
}

void loop()
{
  Kp = digitalRead(2) << 2 | digitalRead(3) << 1 | digitalRead(4);
  Ki = digitalRead(5) << 2 | digitalRead(6) << 1 | digitalRead(7);
  Kd = digitalRead(8) << 1 | digitalRead(9);
 
  Serial.println(Kp);
  Serial.println(Ki);
  Serial.println(Kd);
 
//Specify the links and initial tuning parameters
PID myPID(&Input, &Output, &Setpoint,Kp,Ki,Kd, DIRECT);

  Input = analogRead(0);
  myPID.Compute();
  analogWrite(3,Output);

}

The problem I am facing with this modified code is that, even though the sketch changes the constants values according to the dip-switches positions (I can see that in the serial monitor), the PID function do not recognize them. I infer this because the output doesn't change and keeps the same behavior as if the constants were 2,5,1.

I think I am calling the PID functions wrongly. May be I need to add a new PID function to make the selected constants be recognized and consequently change the output accordingly. Thank you for your help.
12  Products / Arduino Due / Re: [ now published on github ] Building a CAN API for Arduino DUE on: April 20, 2013, 11:22:29 am
Hello Cristian,

Above all, thank you very much for your words and interest to consolidate the Arduino Due CAN API library.
So far, I have been testing both sets of CAN files (AdderD's and mine) and since you have asked, I think it is time for an update. AdderD files should replace my files on Arduino github given that his files are compiling/running OK and they are more high leveled, more automotive-oriented and more user friendly, even though few people have been downloading/working with them. I want to mention that some updates need to be done in the new Arduino IDE 1.5.3 (AdderD and me could PM you about it) that will help making easier the installation of the files. Finally I would like to thank AdderD and you for all the time, effort and support here with the CAN library.

AdderD,
What do you think?

Regards!
13  Products / Arduino Due / Re: [Finally a working EMAC library] Connecting an Ethernet PHY to Arduino Due on: April 16, 2013, 09:22:05 am
Hello,

I want to clarify that the emac class files (emac.c, emac.h) ARE NOT contained in the current Arduino IDE version 1.5.2.
For those interested to get these files, please refer to the following link:

For the emac.h ----> https://github.com/cmaglie/Arduino/tree/ide-1.5.x/hardware/arduino/sam/system/libsam/include
For the emac.c ----> https://github.com/cmaglie/Arduino/tree/ide-1.5.x/hardware/arduino/sam/system/libsam/source

Regards,
Wilfredo 
14  Products / Arduino Due / Re: [Finally a working EMAC library] Connecting an Ethernet PHY to Arduino Due on: April 15, 2013, 10:03:48 am
Hello TonyT3P3,

Above all, I am admired of the progress you made in such a short period of time with the Micrel class files for your lwIP sample. Indeed, I have always considered as a part of my actions plans, that implementation of Atmel ASF examples including the basic HTTP web server and RFTP solutions with DHCP enabled through the lwIP TCP/IP stack; but prior to this, a solid EMAC library must be created. As you may have noticed, rockwallaby is now involved to achieve this. So far, we have a workable EMAC library but full of pointers, structures, and low-level stuff that must be replaced. In other words, it is in the alpha-stage and we are in the process to build a CPP Ethernet API that will provide an easy use to the people here in the forum. Having said that, it is only a matter of a short period of time. Regards!
15  Products / Arduino Due / Re: [ now published on github ] Building a CAN API for Arduino DUE on: April 13, 2013, 11:41:18 am
Hello Sherlock3112.

Thank you for posting pictures of your project! A kind of CAN/XBEE/Ethernet/PC system I assume.
About the PC software, it looks interesting. Formula Student 2013. Could you tell us a bit about your interface .NET?
Pages: [1] 2 3 ... 17