Help a newbee please for a simple code

Hi Guys,

My project is just simple : When my arduino (uno) is alimented Vin and Gnd with 12V I want to send automaticaly a sentence on TX .
When I’m using USB port, the LED TX light up. But when I’m using Vin and Gnd Pins, to switch ON my Arduino the LED TX stay OFF !!!

This is my very simple code :
// La Boxduino est alimentée par le moteur. Quand le moteur est démarré, la trame d’état du moteur (allumée)
// est transmise dans une trame NMEA0183
void setup() {
Serial.begin(9600); // initialise la vitesse de commnication du port Serie
}

// the loop routine runs over and over again forever:
void loop(){
Serial.println("$ERRPM,E,1,1,0,A*40"); // Envoi l’information que le moteur est démarré
delay(1000); // wait for a second
}

Can you help me and say me how to be sure my sentence “$ERRPM,E,1,1,0,A*40” is sending out to TX every second when my Arduino is ON using Vin and Gnd ?
Thanks a lot

First of all, you should try to avoid using 12V on Vin. That is an absolute maximum because it causes the onboard regulator to heat up. If you can use 9V your regulator will run cooler.
2.
Use the CODE TAG BUTTON ! (button with "#" on it) CLICK THE MODIFY button to edit your post, Highlight your code, click "#"
CLICK SAVE.
3. USE GOOGLE TRANSLATE TO TRANSLATE YOUR CODE COMMENTS . IT LOOKS FRENCH TO ME . I DON'T SPEAK FRENCH. but I
helped someone in Italy using GOOGLE TRANSLATE. see this post:

Sorry for this forgeting

First off all I don't undertand why you said "avoid using 12V in Vin" If i'm looking the charactéristic of Arduino Uno i read : nput Voltage (recommended) : 7-12VI

// Arduino is powered by the engine. When the engine is started, the status of the motor (sentence NMEA0183) 
// is transmitted in a frame
void setup() {                
  Serial.begin(9600); // initializes the speed of the serial port commnication
}

// the loop routine runs over and over again forever:
void loop(){
Serial.println("$ERRPM,E,1,1,0,A*40"); // Sending Engine is ON
delay(1000); // wait for a second
}

Thank's a lot

How do you know its not working when it is powered through Vin? Have you still got the USB connected to the PC - presumably not.

Your code should work regardless of how it is powered. But if there is nowhere for the serial data to go why would you expect the Tx light to flash?

...R

Robin,
I think there is a misunderstanding about the 12V comment.
This is what the OP said:

When I'm using USB port, the LED TX light up. But when I'm using Vin and Gnd Pins, to switch ON my Arduino the LED TX stay OFF !!!

I did not answer this question (which,, as you can imagine will probably be explained when the OP posts a schematic)
I simply gave an opinion (mine), that using 12V will make the regulator run hotter. (not related to his problem AFAICT: "As Far As I Can Tell) The OP has probably ignored my suggestion because 12V is within the allowed spec, so why not , right ? (meaning , if it runs hot, so what, not my problem...)
My response to that is . Ok fine. If it overheats, not my problem.

When my arduino (uno) is alimented Vin and Gnd with 12V I want to send automaticaly a sentence on TX .

Your reply :

Your code should work regardless of how it is powered. But if there is nowhere for the serial data to go why would you expect the Tx light to flash?

Is pretty much what I was thinking... so we are on the same page there...

@raschemmel, sorry if there has been confusion.

I very carefully said nothing about the voltage as I don't consider myself competent in that area.

My comments were intended only to be about the code and the testing process.

...R

For years I would listen to people say " Well, technically the datasheet says you can do this but most people avoid it because it will lead to [something bad, like device failure] and I ignored it but then when the [something bad , like device failure ] happened to me I thought "why didn't I listen to what they have been telling me ?" Now bad things happen less...

If you want us to troubleshoot a hardware problem you should post a schematic of how you connected everything. If you don't have a scanner , take a photo of a hand drawn schematic with your cell phone and post that.

I'm back to have any response to my issue if you have any one.

my project is so simple : When my Arduino Uno is switch ON (with 9V alkaline battery) I want to send automaticaly a sentence on a serial port (TX)

When I switch on my Arduino Uno the led TX stay OFF (it doesn't light up). I don't understand why ! because I used serial.println in the loop()

void loop(){
Serial.println("[b]$ERRPM,E,1,1,0,A*40[/b]"); // Sending Engine is ON
delay(1000); // wait for a second
}

When i plug my USB cable it's ok, the led TX switch on every second as I asked it.
When my Arduino is in production, the usb cable is not pluged on it. There is only RX/TX pluged into a multiplexer.
But my multiplexer doesn't receveid anything.

So, how to do to send a sentence automaticaly on the TX chanel when Arduino card is switch on ?
Thanks a lot

When my Arduino Uno is switch ON (with 9V alkaline battery) I want to send automaticaly a sentence on a serial port (TX)

Send it to where? What is connected to the RX and TX pins (or the USB to serial converter that is connected to the same pins)?

TX is connected to a Multiplexer.

I have pluged only a cable into TX and this one go to my multiplexer.

i don't understand when you write :

or the USB to serial converter that is connected to the same pins

how to do that ?

how to do that ?

The Arduino team already did.

I have pluged only a cable into TX and this one go to my multiplexer.

Post a schematic.

Well, I do a schematic and post it in few minutes.

Thanks a lot for your help

This is the schema of my project :

What is that thing you are talking to? Is it really TTL level?

@pascal74,
Post a datasheet for the Multiplexer or a link to a vendor that sells it or a link to the manufacturer. We need to see the datasheet.
You obviously do not know enough about it or you would already know that we need to know if it is TTL level. If you knew that you would have stated it already, as it is necessary to know the interface protocol for a device before you start connecting other things to it. Please post the datasheet.

What do you mean about TTL level ?

Don't forget I'm a newbee :blush:

Ok, pascal74,
That’s why I asked.

Back when dinosaurs roamed the earth, there was a digital protocol called TTL, for Transistor-Transistor -Logic. It was the Grandfather of ALL 5Vdc digital logic. Hence devices that communicate with other devices sometimes still use this protocol because it is the language (or voltage level) of most computer circuitry , other than CMOS (don’t ask). VFDs (Vacuum Flouresent
Displays) often use TTL. Depending on what the device was designed to connect to it might use TTL, RS232, or any number of
communication protocols. Since you are not familiar with it, it would be simpler if you not worry about it and just get us the datasheet or a link to the manufacturer or a vendor of the multiplexer . You can start right now by taking a photo of it close up
with your cell phone and posting it right now. Then look for the datasheet online.

The documentation about Multiplexer is available here

Read my post. Take a photo of it and post it. Your link is useless without the model #.