Notifications
Clear all

TB6612 motor driver

25 Posts
3 Users
0 Reactions
435 Views
TFMcCarthy
(@tfmccarthy)
Member
Joined: 2 years ago
Posts: 514
Topic starter  

Posted by: @noweare

he only way this can happen if for some reason 5 volts is getting to the vin

There is way. (I wasn't aware of it until now, so I learned something.)

The UNO voltage regulator can produce a back-feed voltage on the UNO Vin GPIO pin. The voltage is very close to 5v. Of course, the Vin pin is used by the SmartCar shield to connect the battery et al. So, there's a pathway that doesn't require a faulty connection to the UNO 5v GPIO pin.

I find this persuasive...and disappointing.

I also learned that CoPilot reads schematic images. This opens the all the doors in the door factory.


The one who has the most fun, wins!


   
ReplyQuote
noweare
(@noweare)
Member
Joined: 6 years ago
Posts: 219
 

There is way. (I wasn't aware of it until now, so I learned something.)

The UNO voltage regulator can produce a back-feed voltage on the UNO Vin GPIO pin. The voltage is very close to 5v. Of course, the Vin pin is used by the SmartCar shield to connect the battery et al. So, there's a pathway that doesn't require a faulty connection to the UNO 5v GPIO pin.

I did not know this was a thing. I guess now we know. 

 



   
ReplyQuote
robotBuilder
(@robotbuilder)
Member
Joined: 7 years ago
Posts: 2508
 

One useful thing has come out of this thread for me and that is reverse leakage in semiconductors. Being self taught many decades ago there are BIG gaps in what I know or understand.

"Real components are never perfectly one-way unless specifically engineered to be."

A chatGPT water analogy.

I asked can you give a water in pipes analogy of reverse leakage in electronic circuits
 
 

Think of an electronic circuit like a network of water pipes:

  • Voltage = water pressure
  • Current = water flow
  • Wires = pipes
  • Components = valves, pumps, filters, tanks, etc.

Now let’s map reverse leakage.


Normal operation

Imagine you have a one-way valve in a water pipe.

Water is supposed to flow:

  • from left → right
  • and the valve blocks flow in the opposite direction.

That’s like a diode or transistor junction in electronics:

  • current flows easily one way
  • and is blocked the other way.

Reverse leakage analogy

Now imagine the valve is closed in the reverse direction, but:

  • the seal is not mathematically perfect
  • a few drops of water still seep backward
  • maybe through tiny gaps in the rubber seal.

That tiny unwanted seepage is the water analogy for reverse leakage current.

In electronics:

  • when a diode is reverse-biased, it mostly blocks current
  • but a tiny current still sneaks through the semiconductor junction.

So:

Water system Electronic circuit
Closed check valve Reverse-biased diode
Tiny seepage through seal Reverse leakage current
Higher pressure increases seepage Higher reverse voltage increases leakage
Hot water softens seals, causing more seepage Higher temperature increases leakage

Why temperature matters

A really good analogy is heat.

If the water system gets hot:

  • rubber seals soften
  • tiny expansion gaps appear
  • leakage increases.

In semiconductors:

  • higher temperature gives electrons more energy
  • more carriers can cross the junction
  • leakage rises dramatically.

That’s why reverse leakage often doubles every ~10°C in some devices.


When leakage becomes dangerous

Suppose the water pressure gets too high.

At first:

  • only tiny droplets leak backward.

But eventually:

  • the valve seal fails completely
  • water blasts through.

That corresponds to breakdown voltage in electronics:

  • normal reverse leakage becomes avalanche/Zener breakdown
  • current suddenly increases massively.

Capacitor analogy version

For capacitors, reverse leakage is like:

  • a supposedly sealed water tank
  • that slowly loses water through microscopic pores.

An ideal capacitor would hold charge forever.
A real capacitor “leaks” charge slowly over time.


Short intuitive summary

Reverse leakage is:

“A component that is supposed to block flow almost completely, but in reality lets a tiny amount sneak through.”

Like:

  • a dripping one-way water valve
  • under reverse pressure.


   
ReplyQuote
TFMcCarthy
(@tfmccarthy)
Member
Joined: 2 years ago
Posts: 514
Topic starter  

Posted by: @robotbuilder

To use the machine I would suggest that checking pin A3 for battery power as shown by @tfmccarthy as part of turning the motors on/off. That is why I would ask if there is no commands to the Hbridge motor controller to power the motors would they still turn on thus the reason to turn them off in the setup()?

I think this is a possibility but there are some challanges that need to be overcome before doing this.

The TB6612 has inputs to enable the motors. However, the way the code is written, these inputs are constants (althought they look like variables).so changing this would require adding one or more variables. In addition, the setup code would need to check the battery voltage to determine the power source. More code.

"Not that much code", you say.

Well, at the end of the road here, the current complete sketch for the SmartCar has the footprint:

Sketch uses 31994 bytes (99%) of program storage space.
Maximum is 32256 bytes.
Global variables use 1246 bytes (60%) of dynamic memory,
leaving 802 bytes for local variables.
Maximum is 2048 bytes.

There's really no room to play with. That's embedded programming. That's one of the challenges I hope to address. So I need to be very methodical in my approach and get the thoroughly understand the program before making changes.


The one who has the most fun, wins!


   
ReplyQuote
TFMcCarthy
(@tfmccarthy)
Member
Joined: 2 years ago
Posts: 514
Topic starter  

Posted by: @noweare

I did not know this was a thing.

Neither did I. But I was unsatisfied with my conclusion of a wiring error. That just doesn't feel right. So, I kept digging. This is where Github CoPilot earned its keep. I posed the question and got what I think is the accurate answer. However, there's a test I want to perform to check the voltage on Vin GPIO when the UNO is powered by the USB. If that voltage matches the predicted value then I'm fully convinced.

I was surprised that my comment that CoPilot can read schematic drawings didn't get a rise out of you or anyone. For me, that discovery was more important than the feedback voltage behavior. I plan to try and use that in my deep dive review to get CoPilot to write unit tests.


The one who has the most fun, wins!


   
ReplyQuote
noweare
(@noweare)
Member
Joined: 6 years ago
Posts: 219
 

Posted by: @tfmccarthy

I was surprised that my comment that CoPilot can read schematic drawings didn't get a rise out of you or anyone. For me, that discovery was more important than the feedback voltage behavior. I plan to try and use that in my deep dive review to get CoPilot to write unit tests.

I remember that comment but I really didn't know what it meant. I am still not using AI much in my day to day so I don't know what that means as far as practical use. With a little more thought I guess you input a schematic then ask AI about how it works ? 

 

 



   
ReplyQuote
robotBuilder
(@robotbuilder)
Member
Joined: 7 years ago
Posts: 2508
 

@tfmccarthy

 

I was surprised that my comment that CoPilot can read schematic drawings didn't get a rise out of you or anyone.

 

Well it has now!

I have just being reading about CoPilot and what you can do with it!

 



   
ReplyQuote
TFMcCarthy
(@tfmccarthy)
Member
Joined: 2 years ago
Posts: 514
Topic starter  

Posted by: @noweare

I remember that comment but I really didn't know what it meant.

anus meus tego:

I generally subscribe to curating AI assistant responses as I don't think verbatim repetition is effective or productive. However, this is one case where the response is more accurate and concise than any summary I could provide.

CoPilot chat

Can CoPilot read a schematic drawing? 

Yes - I can read schematic drawings you upload (PNG, JPG, PDF) and help analyze them, but with some practical limits.

What I can do

  • Extract component symbols, net names, pin labels and resistor/capacitor values (OCR dependent).
  • Identify power rails, voltage dividers, diodes, regulators, jumpers and likely power paths.
  • Trace signal/power flow and point out probable causes for behavior (e.g., VIN back‑feed to A3).
  • Suggest hardware fixes, measurement points and software mitigations.
  • Point to specific components on the schematic (if the image resolution and clarity are sufficient).

Limitations

  • Low resolution, glare, skewed photos or handwriting reduce accuracy.
  • If nets/labels are tiny or overlapping, OCR may miss them - a native PDF/Eagle/KiCad file is better.
  • I can interpret the schematic but I cannot probe the physical board - measurements you provide improve diagnosis.
  • I won't identify people in images or reveal private info.

How to get the best result

  1. Upload a high‑resolution crop (300-600 DPI) that contains the area you care about.
  2. If available, also upload the original PDF/schematic (Eagle/KiCad/Altium export) or the BOM.
  3. Tell me the exact question (e.g., "Why is A3 ~4.77 V with USB connected?" or "Is VIN tied to 5V?").
  4. If you've taken measurements, paste those voltages and where they were measured.

If you want, upload the schematic (or a clear crop) now and say which nets/pins to inspect; I'll annotate the cause and recommend fixes.


I discovered this by chance because in a prior query while looking for a 5v pathway to Vin, CoPilot casually said,

I looked for a local schematic in your workspace but didn't find one. If you upload the SmartCar Shield v1.1 / SmartCat v4.0 schematic (or allow me to search a specific folder under I:\AppDev\Robotics\Elegoo\), I can point to the exact component that causes the backfeed and recommend the cleanest fix

That's what set me off. I was able to drag and drop the schematic on the chat input window and CoPilot took it in and understood it.

More than "not bad"; Fantastic! I have lots of schematics and I want to explore how far CoPilot can go to understand them. In combination with sample test code I write, i want to see if it can write unit tests.

As I said, I think this opens all the doors in the door factory.


The one who has the most fun, wins!


   
ReplyQuote
TFMcCarthy
(@tfmccarthy)
Member
Joined: 2 years ago
Posts: 514
Topic starter  

Posted by: @robotbuilder

Well it has now!

Like finding a wad of cash in a pants pocket.


The one who has the most fun, wins!


   
ReplyQuote
noweare
(@noweare)
Member
Joined: 6 years ago
Posts: 219
 

@tfmccarthy 

Very cool, didn't know AI could do circuits/schematics. That may come in handy for me because although I graduated with an EE degree I found out that I was terrible at hardware/circuit design. I took to software much more naturally.



   
ReplyQuote
Page 2 / 2