Serial comm to PC.. Shut off pins 0 and 1 ?

I have a project that will monitor serial traffic (from the USB) and set internal parameters.

When requested by the user, the serial monitoring is turned off.

The program them performs some actions based on the parameters.

I currently have opto isolation outputs on pins DO and D1.

I think I may have botched this, and I am hoping I don't have to rework my project.

So any thoughts?

Thanks, Rich

This is the opto relay board type.
https://www.sunfounder.com/wiki/images/0/06/4_channel_relay_schematic.png

Qsilverrdc:
I think I may have botched this, and I am hoping I don't have to rework my project.

So any thoughts?

You show us no code and absolutely zero details about the project other than the opto and wonder if we have any thoughts about it...

I can't even figure out what you're trying to ask. Do you want to know if it is OK to put an opto on the serial line?

Delta_G:
You show us no code and absolutely zero details about the project other than the opto and wonder if we have any thoughts about it...

I can't even figure out what you're trying to ask. Do you want to know if it is OK to put an opto on the serial line?

Wow.. I thought I was clear enough.

The program (which is not yet written) will have two operating states.

Information gathering - continuously monitor the usb serial for parameters.

Information processing - when requested (by button input) stop monitoring usb serial and do something with those parameters. When done processing, go back to information gathering.

My problem is that in my design, D0,D1,D2,D3 and 5V are routed out to the Opto relay board, and the shield board with all of these connectors is completed. I can do a complete rework of the shield if I have to, but I really don't want to remake the shield board(s).

The opto board is supplied by a separate 5V for JD-VCC so as to not fry Arduino regulator.

Qsilverrdc:
Wow.. I thought I was clear enough.

I'm sure it is clear to you, since it is your project. You have to make me understand what you want from zero.

I'm still not seeing a question in there. I am not sure what you are looking for. A question would be a thing with a question mark (?) that states a request that can be fulfilled by giving information. Some examples of a question would be:

Can I put an opto on the Serial line?

Am I providing enough power for this opto?

Will this opto (that I haven't shown you anything about the wiring of) fry my arduino?

Where do babies come from?

Is there really a Santa Claus?

See, those are questions. They can be answered. All you've given is a vague description of a project and then you say that the problem is that all these things are hooked to the shield. Then you say you can do a whole rework, but you never say what the problem is with those things being connected. Well, how is that a problem? Are they not supposed to be connected? Are they doing something you don't want? What exactly is the question here?

I really thought that this project guidance forum was where "a vague description of a project" is where you start.

I apologize if the project should be fully complete before asking questions.

The given is:

Arduino Uno pins DO, D1, D2, D3 and 5V are connected to the relay board (schematic attached with first post) corresponding to pins IN1, IN2, IN3, IN4 and VCC.

The question is:

What will happen if you attempt serial I/O with the board connected as described?

I currently have opto isolation outputs on pins DO and D1.

Not even that statement is clear. PortD, bit 0 (D0) is an INPUT (RX) to the serial port. PortD, bit 1 (D1) is an OUTPUT (TX) from the serial port.

What do you mean by "monitoring serial traffic (from the USB)"? Do you mean monitor the serial connection between a PC and the Arduino?

Are you collecting each input character and sending it to two different routines, one just to show to a curious viewer?

What do you do with each output character?

What does the title of your post mean: "shut off pins 0 and 1"? How do you maintain a serial connection if they are shut off?

jremington:
Not even that statement is clear. PortD, bit 0 (D0) is an INPUT (RX) to the serial port. PortD, bit 1 (D1) is an OUTPUT (TX) from the serial port.

My understanding is that D0, D1, etc are programmable as outputs and may be pulled up to 5V with internal pull ups. So when a 0 is written to the register the corresponding relay will activate. 1=off 0 = on…

jremington:
What do you mean by “monitoring serial traffic (from the USB)”? Do you mean monitor the serial connection between a PC and the Arduino?

Are you collecting each input character and sending it to two different routines, one just to show to a curious viewer?

What do you do with each output character?

What does the title of your post mean: “shut off pins 0 and 1”? How do you maintain a serial connection if they are shut off?

The project is a position controller for making something like a spring.

When I did the layouts for this project, I made the assumption that serial thru the USB port was not the same as serial on pins D0 and D1.
(This is what I am trying to resolve)

Inputs D0-D3 for output relays, D4-D9 are operator interface buttons, a 10K variable pot is on A0, I2C communication on A4,A5 going to 2, 14 bit DAC’s. SPI on D10,11,12,13 for a encoder counter. 0 to 5v for a linear servo element and 0-5v for 4-20ma speed controller. (see image) That leaves, A1,A2,A3 for in process sensors like stop limits.

Operation:
The system is normally in a stand by state, “monitoring” or waiting for process communication parameters.
There are about 10 required, but many others optional. Once the minimum required parameters are received the system may be actuated when the operator presses a “go” button.
As soon as the “request” to operate happens all USB serial is shut down.
The operating loop is basically in order, Read SPI (encoder) position, do some math, check parameters, set I2C DACs as required. Repeat till end parameter is reached.
When this cycle is completed, or interrupted, the processor goes back to monitoring USB.

I think that your problem will be that if there is serial communication, your relay on the TX pin will react on it. It will be too slow for you to notice, but I'm not sure if it's healthy for it.

I made the assumption that serial thru the USB port was not the same as serial on pins D0 and D1.

That would depend on which USB port, and which model Arduino you are talking about.

Good luck with your project!

"When I did the layouts for this project, I made the assumption that serial thru the USB port was not the same as serial on pins D0 and D1."
That's only valid for 32U4 based boards. For 328P/2560 the USB connects to TX0/RX0 which is D0/D1 (I do the same for the Bobuino pinouts on 1284P boards also).

">Information processing - when requested (by button input) stop monitoring usb serial and do something with those parameters. When done processing, go back to information gathering."
You can do that on 328/2560s, but anything coming on the RX will be transmitted to the PC, and if the PC responds to that it will appear on the Tx pin and then your attached device may do something.

CrossRoads:
You can do that on 328/2560s, but anything coming on the RX will be transmitted to the PC, and if the PC responds to that it will appear on the Tx pin and then your attached device may do something.

Yes unfortunately I understand the issue.
I was thinking of just changing the I/O points, and using D0/D1 as general inputs.
Because of the serial usb hand shaking I can not guarantee that the PC would not try to send a bit down the pipe, so to speak.

Thanks for your thoughts.

I guess I will get out the drill, and jumpers and manually rev my shield board. I will look for I/O changes that might work in line with the D0/D1 and the serial. I will also look at multiplexing my operator input buttons to make up for the 2 lost I/O points.

Thanks again!

Just need to remove 2 resistors to break the D0/D1 connection to the USB/Serial chip (Atmega16U2). 8-pin part resistor network RN4. Jumper a resistor back across pins 4-5 to keep the Power LED working.

Arduino_Uno_Rev3-schematic.pdf (81.4 KB)