# A little help for a simple mosfet H-bridge problem

#### jayanthd

Joined Jul 4, 2015
904
I think the problem is shoot through. Likely, you enable the right FETs of the H Bridge, which you can do with 2 direction inputs. However, you also need an enable FET. This is because without waiting a bit before applying power to the the H Bridge FETs, the wrong FETs can be activated during the switch change. Look into the TLE 5205-2, a 5 amp H bridge that won't switch until it is safe to do so. It still has an enable, but you can continuously enable it without fear of destroying itself. I used one in a recent project, and it worked at quite high speed with no need to switch the enable pin. See datasheet:https://www.infineon.com/dgdl/Infin...n.pdf?fileId=db3a30431f848401011fc747c7a0797f
Sorry, my mistake. The simulation file was corrupted. It shows correct voltages after I redrew the circuit. it was posted in my previous post and the post was updated.

Did you decide the RF Transreceiver ? XBee ?

Last edited:

#### Optipook1

Joined Jul 25, 2017
63
I have decided ref
Sorry, my mistake. The simulation file was corrupted. It shows correct voltages after I redrew the circuit. it was posted in my previous post and the post was updated.

Did you decide the RF Transreceiver ? XBee ?
I have decided to use RF transceiver, the late answer because nothing was coming in my inbox.

#### Optipook1

Joined Jul 25, 2017
63
Sorry, my mistake. The simulation file was corrupted. It shows correct voltages after I redrew the circuit. it was posted in my previous post and the post was updated.

Did you decide the RF Transreceiver ? XBee ?
Glad to hear it work!

#### jayanthd

Joined Jul 4, 2015
904
I have decided ref

I have decided to use RF transceiver, the late answer because nothing was coming in my inbox.
Ok. 433 MHz RF Modules. Right ?

If yes, I will complete the coding today.

Remote Control coding is 95% complete. I will try to complete the coding of the remaining part of remote control and robot driver after your reply.

The remote control is working fine. I will post Proteus Simulation video in a few minutes.

One more thing I want to know. Do you want just transmitter and a receiver or you want 2x transreceivers ?

Last edited:

#### jayanthd

Joined Jul 4, 2015
904
Robot almost working in Proteus. Just a small bug. Will post the simulation soon.

Edit:

The Robot project is ready and I have tested it in Proteus and it is working fine. I will post the project in a few minutes.

Here is the project. Due to PWM the simulation will give GMIN stepping error. So, try it on hardware.

PIC18LF46K22 needs 3.3V power supply (well filtered) and PIC18F46K22 needs 5V power supply.

Test and reply. Tonight I will implement checksum check. If checksum of data doesn't match then it will discrad the data. This will help in Robot from not picking data from other devices other than remote control.

Edit:

I have implemented checksum feature and it is working fine in Proteus. Now your Robot will only respond to data from your remote control.

Additionally I can use a DIP switch 8-Way to set the address of the RC and Robot. It will be better. You can just set address in RC and robot same with DPI switch and the RC will work for that Robot.

Edit:

DIP switch implemented. 4-Bit DIP switch. You will get 2^4 = 16 device addresses. If you want more then I can add 6-Bit DIP Switch. or even 7-Bit DIP Switch.

Check the simulation. I have tested it and it is working fine. RC and Robot's DIP switches should be set to same value.

In the Proteus simulation using PWM was giving GMIN stepping error and hence I have disconnected the PWM pin from L298N's ENx pins and connected ENx pins to 5V. In real hardware you have to disconnect ENx pins from 5V and connect them to PWM pin.

You can however see the PWM duty (3rd byte in UART transmission) in Virtual Terminal. It varies according to POT value. After hardware is built we have to check at what PWM duty the motor stalls and we should make changes code so that that PWM duty value will be taken as 0 speed value.

#### Attachments

• 70.6 KB Views: 1
• 46.9 KB Views: 0
Last edited:

#### Optipook1

Joined Jul 25, 2017
63
Ok. 433 MHz RF Modules. Right ?

If yes, I will complete the coding today.

Remote Control coding is 95% complete. I will try to complete the coding of the remaining part of remote control and robot driver after your reply.

The remote control is working fine. I will post Proteus Simulation video in a few minutes.

One more thing I want to know. Do you want just transmitter and a receiver or you want 2x transreceivers ?
Would a transmitter/receiver be easier, then choose that.
if transceivers, would I be able to send the status of the robot?

#### jayanthd

Joined Jul 4, 2015
904
Would a transmitter/receiver be easier, then choose that.
if transceivers, would I be able to send the status of the robot?
Would a transmitter/receiver be easier, then choose that.
if transceivers, would I be able to send the status of the robot?
Transmitter/Receiver will be easier to code which I have already done. Transreceivers will be better and they can send the status of the robot but here in your project there are no sense circuit in H-Bridge and hence no feedback about the status of the motors. So, even though INx pins of L298N be ON the motors might be off due to defective h-Bridge. So, transreceivers are of no use without sense circuits.

If you want to improve your Robot in future by adding stepper motor/Servo motor with Ultrasonic distance measurement with a buzzer then you might better use PIC32 or STM32 for the Driver. I can help you with improving the robot hardware and software.

#### Optipook1

Joined Jul 25, 2017
63
Transmitter/Receiver will be easier to code which I have already done. Transreceivers will be better and they can send the status of the robot but here in your project there are no sense circuit in H-Bridge and hence no feedback about the status of the motors. So, even though INx pins of L298N be ON the motors might be off due to defective h-Bridge. So, transreceivers are of no use without sense circuits.

If you want to improve your Robot in future by adding stepper motor/Servo motor with Ultrasonic distance measurement with a buzzer then you might better use PIC32 or STM32 for the Driver. I can help you with improving the robot hardware and software.
For now we'll keep it to the transmitter/receiver,

#### jayanthd

Joined Jul 4, 2015
904
For now we'll keep it to the transmitter/receiver,
Then the coding is complete. I will post the code after 2 hours from now. I will provide you final circuit after two hours. You have to build it on hardware.

If sensing is needed then two resistors has to be added to the H-Bridge circuit as shown in L298N internal diagram. I have to calculate the resistor values. Maybe adc have to be used for sensing. I have to check.

Here is the robot project. As PWM pin is connected to ENx pins of L298N you will get GMIN stepping error in Proteus (atleast on my system). If you want to simulate then disconnect PWM pin from ENx pins and connect ENx pins to 5V.

Tact switches are used for control. If you want joystick then I have to see if a little change is needed to the code.

Do you also need power supply circuits for Tx and Rx ?

#### Attachments

• 75.6 KB Views: 7
Last edited:

#### Optipook1

Joined Jul 25, 2017
63
Then the coding is complete. I will post the code after 2 hours from now. I will provide you final circuit after two hours. You have to build it on hardware.

If sensing is needed then two resistors has to be added to the H-Bridge circuit as shown in L298N internal diagram. I have to calculate the resistor values. Maybe adc have to be used for sensing. I have to check.

Here is the robot project. As PWM pin is connected to ENx pins of L298N you will get GMIN stepping error in Proteus (atleast on my system). If you want to simulate then disconnect PWM pin from ENx pins and connect ENx pins to 5V.

Tact switches are used for control. If you want joystick then I have to see if a little change is needed to the code.

Do you also need power supply circuits for Tx and Rx ?
For the receiver, I'll put a lm7805 with a 40-80 ohm resistor to reduce heat. 3 AA for the transmitter

#### jayanthd

Joined Jul 4, 2015
904
For the receiver, I'll put a lm7805 with a 40-80 ohm resistor to reduce heat. 3 AA for the transmitter
I will design the power supply circuit.

For transmitter you have to use 2 AA batteries. (1.5V type) PIC18LF devices can run from 1.8V. I have used 4 MHz clock and so 3.0V to PIC18LF will not be a problem.

But how do you power RF transmitter ? I guess it needs 5V. Maybe it works at 3.3V also. I have not checked. You have to do the testing.

#### Optipook1

Joined Jul 25, 2017
63
I will design the power supply circuit.

For transmitter you have to use 2 AA batteries. (1.5V type) PIC18LF devices can run from 1.8V. I have used 4 MHz clock and so 3.0V to PIC18LF will not be a problem.

But how do you power RF transmitter ? I guess it needs 5V. Maybe it works at 3.3V also. I have not checked. You have to do the testing.
It should work at 3.3v, just the range will be affected because of the power output.

#### jayanthd

Joined Jul 4, 2015
904
It should work at 3.3v, just the range will be affected because of the power output.
Ok. Try it. Data should not get corrupted.

I will send the power supply circuit in 2 hours. You get PCB layout designed and PCB manufactured. I can design PCB layout but I charge 100 USD for PCB layout designing using Proteus.

If you are interested then I can design the PCB layout for both RC and Robot.

#### Optipook1

Joined Jul 25, 2017
63
Ok. Try it. Data should not get corrupted.

I will send the power supply circuit in 2 hours. You get PCB layout designed and PCB manufactured. I can design PCB layout but I charge 100 USD for PCB layout designing using Proteus.

If you are interested then I can design the PCB layout for both RC and Robot.
I appreciate it, but I'll do the pcb layout for personalized boards and for space management for the body of the new robot.
Most of the time I use Fritzing, it is very easy to use and has lots of features but lacks the variety of some components(no TO-3, etc...).

#### jayanthd

Joined Jul 4, 2015
904
I appreciate it, but I'll do the pcb layout for personalized boards and for space management for the body of the new robot.
Most of the time I use Fritzing, it is very easy to use and has lots of features but lacks the variety of some components(no TO-3, etc...).
Ok. I design PCB layouts in Proteus and Eagle and I use Librray expert Pro for making the footprints.

#### Optipook1

Joined Jul 25, 2017
63
I appreciate it, but I'll do the pcb layout for personalized boards and for space management for the body of the new robot.
Most of the time I use Fritzing, it is very easy to use and has lots of features but lacks the variety of some components(no TO-3, etc...).
It is pretty expensive to get them manufactured at pro level and all the good work you put into it, so the 100$makes a lot sense. #### jayanthd Joined Jul 4, 2015 904 It is pretty expensive to get them manufactured at pro level and all the good work you put into it, so the 100$ makes a lot sense.
regarding the project.

When is the last date for Project submission ?

Did you test the simulation ?

Mods Edit:
Please don't post the email address on forum, it will bring the spam robotics to forum and your email account.

#### Optipook1

Joined Jul 25, 2017
63
You can email me at jayanthd2k12@gmail.com

regarding the project.

When is the last date for Project submission ?
That would be for September 3, I'll wait a little before building or modifying the robot because I spent quite a lot of $on the robot I'm currently working(basic fwd back right and left) on, then later I'll use your designs and either make a new robot or modify it to turn into a house rover to patrol or/and go where I can't in the backyard or even a small tank(probably a Tiger 2 or Jagpanther) I would like to have something done before going even further, this is truly my first time working with PWM, RF, and electromechanics and even the mosfet. So, the rover project is far from finished #### jayanthd Joined Jul 4, 2015 904 That would be for September 3, I'll wait a little before building or modifying the robot because I spent quite a lot of $ on the robot I'm currently working(basic fwd back right and left) on, then later I'll use your designs and either make a new robot or modify it to turn into a house rover to patrol or/and go where I can't in the backyard or even a small tank(probably a Tiger 2 or Jagpanther)
I would like to have something done before going even further, this is truly my first time working with PWM, RF, and electromechanics and even the mosfet.
So, the rover project is far from finished
Ok.