Controlling two dc motors 12V with two relays and arduino

by that you mean my final schematics using relays at post 13 should work?

No, I just meant that if you had decided on relays then that is fine.

Your schematics for the MOSFET drivers look OK. Diodes D1 and D4 are not necessary unless there is a chance of connecting the power backwards. D2 and D3 are OK. The MOSFETs are logic level, will easily handle the motor stall current and have low on resistance so that is good.

I don't fully understand whats wrong with my relay schematic?
each motor have is own 12V PSU and the 5V phone charger is only for powering the arduino. the 5V output of the arduino will power the relay module (it is actually powering the opto-coupler that is on the board, right? what is wrong with that?

also in the article from that site it seems the relay module is powered from the arduino itself

Besides the opto-coupler and driver transistor the relay has a coil (electromagnet) that must be powered to actuate the relay.
Here is a data sheet for the typical relay found on relay modules. Refer to Figure 6 COIL DATA CHART and the coil current for a standard 5V relay coil. Each of the relays will draw 90mA the whole time that the relay coil is powered. That is 180mA for the 2. While the Arduino may handle that current it is not made to be a power supply. It is better to use an external supply for the relay coils if you can. Besides taking the load off the Arduino the external supply will isolate the Arduino from any switching noise from the relay that can effect the processor or peripherals.

EDIT: added the link for the relay data sheet.

Wrong, it is powering the relay coils AND the electronics

In this instance, (Vcc to each module) the Arduino is not powering the relays.
They are quite simply just on the same supply line.

Not according to the schematic in post 13

Indeed:

That's the trouble with these schematics that don't show any connections - just a load of labelled nodes. :rage:

There's really no excuse here not to show the connections:

I have tried this schematics but the moment I connected the load the code stop to work.

What do you mean by "the load" here?

And how do you determine that the code stops working?

Three or four people have told you it is NOT a good idea to connect the relays to the 5V out pin.
So why do you still do it?

ok, it did not worked because I used 5V relay with 12V psu. I changed for 12V relay and is working!

I did not understand how to power the relay input?
I need 1 power supply (phone charger for the arduino) another 5V for the relay input and another 12V for the relay load?

If you changed to a 12V then you don't need 5V for the relay anymore.
You better post a link to the new relays, so we can be sure you are not applying 12V to an arduino I/O

here is the board I'm using

and here is my updated schematics that worked with one motor (I don't have yet the other motor in order to try)

the phone charger is powering thr arduino via its usb port.

OK. So now you are using a 5V 4 channel relay.
The relay Vcc need to be connected to a 5V supply capable of providing at least 300mA.
You shoud not connect it to the arduino 5V output.

my phone charger can deliver up to 2A .
I was thinking the 5V pin is just the 5V presented at the usb port of the arduino (meaning - my phone charger)

is this better idea?
connecting the +5V of the phone charger to the Vin of the arduino and to the VCC of the relay module?

btw - almost all of the diagram I found online are connecting the arduino 5V pin to the relay module VCC