Arduino 'timers' and serial help

Hey,

I am quite stuck and becoming quite annoyed.
Anyway, I have a setup where I have an Arduino with a servo motor, TTL serial input from an external device (not through USB/pc), various components (buttons, leds etc).

My initial question is if it is possible for me to use my TTL signal on pins 0/1, I have tried and have not had any luck even after searching online for days.
Apart from this I am having a large amount of issues with the Arduino’s timers.
I do prefer to use a Arduino Uno but I also have a Mega which also has many more timers as explained here: http://letsmakerobots.com/node/28278
Is there any possible way to use the Servo library, NewSoftSerial/AltSoftSerial, millis/delay simultaneously? It is definitely not working as smooth as I want it.
I also have tried using the extra serial ports on the mega such as Serial1 with no prevail.
Is there a way to change the timer which millis/delay use on the mega?
Unfortunately I am unable to share all of my code due to many reasons.

Any help would be appreciated and would especially like to know how to utilize pins 0/1 even if it means disconnecting my device before uploading.
Thanks

My initial question is if it is possible for me to use my TTL signal on pins 0/1, I have tried and have not had any luck even after searching online for days.

The hardware serial pins have resistors incorporated. If the TTL signal is strong enough to overcome the resistors, then, yes.

Is there any possible way to use the Servo library, NewSoftSerial/AltSoftSerial, millis/delay simultaneously?

Without seeing your code, probably not. There are alternatives to some of the libraries that use different timers/methods.

Is there a way to change the timer which millis/delay use on the mega?

No.

Unfortunately I am unable to share all of my code due to many reasons.

Using open-source hardware and open-source software to develop a closed source project is probably in violation of the licensing agreements. You may need to be sure that you understand the terms of the license agreements for the hardware/software you are using.

The hardware serial pins have resistors incorporated. If the TTL signal is strong enough to overcome the resistors, then, yes.

Since I am unable to use them, my signal must not be strong enough. Is there any way to boost my signal or bypass the resistors?

Using open-source hardware and open-source software to develop a closed source project is probably in violation of the licensing agreements. You may need to be sure that you understand the terms of the license agreements for the hardware/software you are using.

I have just looked at the Arduino licensing/policy page: http://arduino.cc/en/Main/Policy and read Creative Commons Attribution-ShareAlike 3.0 which the Arduino boards licensing follows and states: You are free to make commercial use of the work, copy, distribute and transmit the work, adapt the work. I’m also pretty sure that the licensing is only for their boards and that these terms only apply if you are making your own Arduino compatible board.

Also from Arduino’s FAQ page is states: Physically embedding an Arduino board inside a commercial product does not require you to disclose or open-source any information about its design. http://arduino.cc/en/Main/FAQ

I can also confirm that the Servo library is not causing the issue with millis(), I tested this by removing the external TTL signal while the servo was still running and the timing was working perfectly.

There are alternatives to some of the libraries that use different timers/methods.

Do you mind sharing these alternate libraries?

Thankyou.

Arduino runtime libraries are under the LGPL:

The GNU Lesser General Public License or LGPL (formerly the GNU Library General Public License) is a free software license published by the Free Software Foundation (FSF). The LGPL allows developers and companies to use and integrate LGPL software into their own (even proprietary) software without being required (by the terms of a strong copyleft) to release the source code of their own software-parts. Merely the LGPL software-parts need to be modifiable by end-users (via source code availability): therefore, in the case of proprietary software, the LGPL-parts are usually used in the form of a shared library (e.g. DLL), so that there is a clear separation between the proprietary parts and open source LGPL parts.

Since I am unable to use them, my signal must not be strong enough.

Are you using HardwareSerial to read the pins? If not, why not?

Is there any way to boost my signal

Yes.

or bypass the resistors?

No.

Do you mind sharing these alternate libraries?

You could google as well as I can.

Are you using HardwareSerial to read the pins? If not, why not?

Well I initially tried to use HardwareSerial but that didn't work so I had to convert to software serial.

Also what components would I need for the to be a signal with sufficient strength to beat the resistors? I did come across this: http://www.billporter.info/2011/06/26/how-to-add-multiple-uart-connections/ and they said to add a 1k Ohm resistor to the rx/tx of the Arduino. I tried this and it did not work.

Also I have not found any information on what timer the Mega's Serial1, Serial2 and Serial3 run on. If they run on the same timer as the Serial(pins 0/1) would it not affect millis()?

Thankyou again.

Well I initially tried to use HardwareSerial but that didn't work so I had to convert to software serial.

"That didn't work" is just about the most overused, meaningless, phrase used in this part of the forum. You have some code that you haven't shared. It did something. You have some expectations for the code. "That didn't work" merely suggests that what the code actually did is not identical to what you expected, without revealing a thing about either one.

I did come across this: http://www.billporter.info/2011/06/26/how-to-add-multiple-uart-connections/ and they said to add a 1k Ohm resistor to the rx/tx of the Arduino. I tried this and it did not work.

"The wall I have around the moat is too high. I tried making it taller, but it was still too high!" Perhaps making the wall taller is not the right answer.

Also I have not found any information on what timer the Mega's Serial1, Serial2 and Serial3 run on.

Perhaps because serial I/O is interrupt driven, not timer driven.

Firstly what I want to achieve is to be able to use the Hardware serial pins. I know my device is constantly sending out a TTL signal approximately every 0.3 seconds. Even if I use such basic code as:

int led = 13;

void setup(){
  Serial.begin(9600);
  pinMode(led, OUTPUT); 
}

void loop(){
  if(Serial.available() > 0){
    digitalWrite(led, HIGH);
  } 
}

The led never comes on but if I open the serial monitor and send anything it works fine. Also if you know the necessary components to boost the TTL signal could you please share it?

rep8: My initial question is if it is possible for me to use my TTL signal on pins 0/1, I have tried and have not had any luck even after searching online for days.

These questions are very vague. What device? What TTL signal? Surely you can at least make up a test case that demonstrates this and post that code?

Apart from this I am having a large amount of issues with the Arduino's timers.

What issues?

I also have tried using the extra serial ports on the mega such as Serial1 with no prevail.

In what way? What happened? What was your code?

Unfortunately I am unable to share all of my code due to many reasons.

Would you like me to move this to Project Guidance? Asking for help with code, without sharing the code, is not helpful to either of us.

Any help would be appreciated and would especially like to know how to utilize pins 0/1 even if it means disconnecting my device before uploading.

Pins 0/1 should work for you, especially if you disconnect the device (what device?) before uploading.

The fact that no serial ports seem to work indicates the device itself is not doing what you think it is. Maybe the logic is inverted. Maybe it isn't putting out TTL signals. Maybe the baud rate is wrong. Maybe your code is wrong. Without more details this is all guesswork.

Fortunately I have solved the issue and weirdly enough it had nothing to do directly with Software/Hardware Serial or any of those libraries. My program uses the parseInt() function to read the input values and it turns out that the serial timeout is set to 1000ms (1 second), I turned it down to 5ms which allows my program to constantly update the current value and various functions.

Although I still cannot use the hardware serial (pins 0/1), software serial is working fine.

Thankyou all anyway.