Download circuit - BAT85 alternative

amewsaj

Member
Hi,

I have tried getting some BAT85 diodes, but they (local shops) do not seem to have them at this time (they can order it for me, but well)

I was wondering if I can use something else?
I think he had BAT82 and BAT79.
What is the difference, and can I use these?
Maybe some other diode?

Thanks...
 

westaust55

Moderator
Have you checked the datasheets? :confused:

The BATxx series of diodes are Schottky Diodes which are faster acting than standard diodes.

BAT85: Vr = 30V, If = 200mA

BAT82: Vr = 50V, If = 30 mA

BAT79: ?????

Would suggest the BAT82 could still be used as an alternative.

BAT42 and BAT43 are both Vr = 30V and If = 200mA, so if you can source those instead would be ideal.
 

amewsaj

Member
I am not sure about BAT79 anyway...

What is the difference between 85, 42 and 43

Are you sure 82 could be used? - is 30 mA enough?
 

MartinM57

Moderator
Apply Ohm's law to find out!

Worse case is when the input voltage on RS232 is -12V, so the diode is conducting approximately 12/22000 Amps = 12/22 mA, which is a lot less than 30mA....

EDIT: ..and the other worse case is when the input voltage on RS232 is +12V, leading to a required Vr somewhat greater than 12 - so 30, 50 etc is fine
 
Last edited:

amewsaj

Member
But I do not know the resistans

U/R = I

??

And still, what is the difference between 85, 42 and 43
 
Last edited:

amewsaj

Member
Of course, then...

what is the difference between 85, 42 and 43

You said 42, 43 would be ideal, but if 30 mA is enough, why not use 82? Anything else I should know about it?
 

amewsaj

Member
From datasheet I don't see huge differences between 85, 42/43...
Actually it seems 42/43 is faster?

I don't know a lot about those diodes, so could you tell me why you might want to use one rather than the other?
 

westaust55

Moderator
For the download circuit, the BAT42/BAT43 are virually identical to the BAT85.
There are minor difference like repetative forward current 500mA vs 600mA but irrelevant to your requirement.

Any of those mentioned so far could be used for the download circuit.

The BAT85 is only an enhancement and the circuit will still work without it. Treat it a bit like an insurance policy.
 

hippy

Ex-Staff (retired)
The BAT85 is used to clamp negative voltages on Serial In to less than -0V3 ( or something like that ) which can otherwise affect READADC readings when the download cable is connected.

A BAT85 shouldn't be needed when using a USB-to-serial which uses 0V/5V output but it does no harm if it is fitted.

Worse case scenario on current would be with Serial In at 5V, -15V on PC's TX line; I = V/R, 20V/22000R = 1mA.

As the purpose is to prevent negative voltages on Serial In, I usually put a standard diode ( 1N4148 etc ) in series with the serial line which seems to work okay for me but may not be ideal if using a laptop or USB-to-serial because of the voltage drop across the diode.

Code:
RX <------------------------

        |\ |         ___
TX >----| >|----.---|___|---
        |/ |   .|.   22K
               | |
               |_| 10K
                |
0V >------------^-----------
 
Last edited:

amewsaj

Member
So I can use BAT85, 42/43 (and eventually BAT82 should do fine too?)

Yeah it works without, but I communicate with anotehr chip using pulses, and for instance when debugging one of the chips, the other receives random pulses. I have read that this could be solved with this enhanced download circuit ? Am I wrong?
 

amewsaj

Member
A BAT85 shouldn't be needed when using a USB-to-serial
I use the USB-Serial cable. The USB-Serial(COM) and the regular download cable (COM -> serin).

I have some wrong pulse readings on the other chip while doing this to the primary chip:

Downloading
Debugging
sertxd

What is causing this then?
 
Last edited:

MartinM57

Moderator
Worse case scenario on current would be with Serial In at 5V, -15V on PC's TX line; I = V/R, 20V/22000R = 9mA.
Now I am confused - where's the 20v potential difference from?

If PC TX is -15v, why would Serin be 5v? ...and if Serin is 5v, the the Schottky is reverse biased anyway
 
Last edited:

BeanieBots

Moderator
As pointed out above, the 22k resistor limits the current to around 1/2mA so no issues there.
However, don't lose sight of the purpose of this diode.
It is to prevent a negative voltage from causing negative conduction in the internal substrate which upsets ADC readings.

The IMPORTANT issue is the conductance voltage.

BAT85 320mV @ 1mA
BAT82 410mV @ 1mA
BAT42 330mV @ 2mA (<320mV @ 1mA)

For my money, that makes the BAT42 the best of the 3 for this application followed by the BAT85 with the BAT82 comming in last and possiby not even suitable.

You could (if you can still get them these days) consider a germanium device such as the OA47.
 

amewsaj

Member
But is this the cause of the issue I am having at all ? Is this needed when using the USB - COM + COM - Serin cable?

It isn't even an ADC port, it is an input pin.

I have some wrong pulse readings on the other chip while doing this to the primary chip:

Downloading
Debugging
sertxd

What is causing this then?
 

BeanieBots

Moderator
But is this the cause of the issue I am having at all ?
Very unlikely.
The enhanced download circuit is to improve the accuracy of ADC readings when the ADC source impedance is high and there is a negative current flowing into (from) the serin pin.

Post your circuit.
 

hippy

Ex-Staff (retired)
Worse case scenario on current would be with Serial In at 5V, -15V on PC's TX line; I = V/R, 20V/22000R = 9mA.
Now I am confused - where's the 20v potential difference from?

If PC TX is -15v, why would Serin be 5v? ...and if Serin is 5v, the the Schottky is reverse biased anyway
What is the nominal voltage on an unconnected input pin ? I'd guess at half Vsupply, but somewhere between 0V and Vsupply.

As we are dealing with negative voltage the 0V reference for a meter ( black lead ) can be the Serial In pin, the measurement ( red lead ) to RX so the most it can be is with Serial In at Vsupply (5V) and RX at -15V giving a voltage across Serial In and RX as 20V.

PS : I corrected the 9mA, should of course be 1mA.
 

amewsaj

Member
Huge circuit, but only thing going on about this issue is

28x1 OUT6 -> 18x IN7

Directly wired connection

pulseout from 28x1
count on 18x.


When downloading, debugging or sertxd on the 28x1 I get various count readings on the 18x.
 

hippy

Ex-Staff (retired)
But is this the cause of the issue I am having at all ? Is this needed when using the USB - COM + COM - Serin cable?
Unlikely. As BeanieBots suggests; post your code.

If this is the 'COUNT off by one' issue, that can occur depending on how your pulses are synchronised to when you start your counting.

I'll explain that on the original thread and it's probably best to post your code there.

http://www.picaxeforum.co.uk/showthread.php?t=12323&page=2
 

BeanieBots

Moderator
Well, quite simply, that should not happen.
(download circuit will not help).
Either, a wiring fault, VERY sloppy connections / long wires AND/OR a lack of decoupling capacitors.

Are both PICAXEs powered from the same supply?
 

amewsaj

Member
No this issue has nothing to do with the other thread.
I still use my own code to read and it works just fine. Only while fx downloading to the other chip, chip 2 gets confused. It gets weird readings (random counts) Everything from 0-255 (the byte I read it into).
I am pretty convinced this is not a code issue, since the code isn't even active. (downloading...)


Same supply yes.
Wires: Doubt it, everything has been tested for proper connections (and wrong conns).
And since it works when the code is running, why would it be? Only on download or serial communication it behaves weird.
 

BeanieBots

Moderator
During a download, the 28X1 output pins are tri-stated.
That effectively leaves your 18X input floating.

Put a 10k pull-down resistor on your 18X input pin if errornous data during a download really is causing you problems.
 

amewsaj

Member
Why am I having issues when using sertxd too?

28x1 sertxd (1) repeated many times also gives me wrong count readings on 18x.
 

BeanieBots

Moderator
That's why a full circuit diagram is so important.

Do you have decoupling on BOTH PICAXEs?
Do the cables run close to each other?
Do you have anything else in the supply such a series diode?
What IS your power supply?
 

amewsaj

Member
I understand why you want the code and circuit. The code is long (3000 lines I think - not home now)..
And drawing the circuit would take an hour or more.
Not a print, I have soldered onto a board with cubber on each hole, and then wired all the connections.

Power supply is 9V adapter -> 1N4001 -> L7805 (100uF and 100 nF parallel).

connections are pretty close, but there are no shortcircuits (measured everything several times). If there were, the problem wouldn't only be on serial stuff, eventually download would not work.


Decoupling??
 

hippy

Ex-Staff (retired)
The code is long (3000 lines I think - not home now)..And drawing the circuit would take an hour or more.
Did you prototype this 'pulse communication' system, and did it work them ? If so it's either something wrong with the hardware or circuit you are now using or something which has changed in the code.

If you did not prototype then it may be best to do that now. That will allow you to iron out any bugs and peculiarities in the 'pulse communications' without having to worry about the rest of the program or circuit.

It's comparable to building a complete project only to find it does nothing when switched on ( the problem could be anywhere and there may be more than one problem ) and having built and tested each part of a project separately.
 

amewsaj

Member
I did test each part, also the count communication.

Pulseout a specific number to the other chip, and that chip then outputs the result binary using 8 LED's. When I then download to the primary chip I see the LEDs flashing randomly.

And again I measured all connections, so it is pretty weird.

The only change to make it "not work" is add a sertxd command to be looped.
 

BeanieBots

Moderator
Decoupling is what the name implies. It "decouples" one micro processor from another by placing a low AC impedance close to the power pins.
This is normally done by adding a 100nF ceramic capacitor as close as possible to the power pins of EVERY logic chip in your circuit.

Whenever a micro (or any logic device) switches state, it draws a very large current for a very short time. This can put a small glitch on the power supply which sensitive circuitry can react to. These glitches are removed by the decoupling capacitors.

Have a look at the motherboard in your computer.
You will see a capacitor close to every chip. They are the decoupling capacitors.

Many people don't bother with them and "get away" with it.
That's often fine in a simple one chip circuit. In a circuit with more than one micro, they are essential for reliable operation.

You should fit them as a matter of course regardless.
 

hippy

Ex-Staff (retired)
It seems you have two distinct problems -

Random count when downloading the driving PICAXE - This sounds like a hardware issue as already noted.

SERTXD interferes with the count - This sounds like a timining or synchronisation issue when the receiver's loop time is extended through sending data,

Can you produce a simplified circuit and programs which demonstrates both these problems but still reflects what your full circuit and program does ?

I just tested a PULSOUT and a COUNT system and it's not as easy as it first appears, it's a nightmare of timing and synchronisation and any change to code that works can easily throw that into disarray. You may be on a hiding to nowhere and be better off using an alternative system of communication; SEROUT/SERIN would be much more controlable and predictable.

This works, but alter the timing and all sorts of odd things happen ...

#Picaxe 18X
Do
Do
Count 7,500,w0
Loop until w0 <> 0
SerTxd( #w0," ")
Loop

#Picaxe 28X1
Do
b0 = 1 : Gosub SendPulses
b0 = 3 : Gosub SendPulses
b0 = 5 : Gosub SendPulses
b0 = 7 : Gosub SendPulses
b0 = 11 : Gosub SendPulses
Loop
SendPulses:
For b1 = 1 to b0
PulsOut 6,10
Next
Pause 1000
Return

Added : It doesn't work :-(

Though it does for most of the time, the PULSOUT and the COUNT timing frames get out of synchronisation which isn't surprising as they are asynchronous systems with slightly different timings, much like belisha beacons on road crossings go out of sync if not connected together

Without some synchronisation it appears that this is a flawed concept and won't ever work reliably.
 
Last edited:

amewsaj

Member
Correct, it isn't easy with the count system, but what is going on is even without sending any pulses, just doing a sertxd to the pc, the counter on the other chip claims to have received some counts. But the output pin to do pulses is not touched at all during that process..
 

hippy

Ex-Staff (retired)
Reporting a count value when it hasn't received any is likely a hardware issue as noted. A pull-up or pull-down is likely to fix that. If it doesn't you have a more serious noise problem in your circuit. Alternatively the SERTXD is reporting something other than what count returned, which would be a programming error.
 

amewsaj

Member
The sertxd has nothing to do with what the counted value is. It has an independant purpose.
I read the values binary by using LED's

Pull-down? So you mean I should put like a 10k from the count pin to 0V. But why should that have any influence. The chip should (as long as it is active) keep it to 0V. (low).
 

BeanieBots

Moderator
I suppose putting a 'scope on it is out of the question?

Yes, I DO think decoupling caps would help.
Even if they don't, you should fit them anyway, especially in a multi processor circuit.

Also, if you've got multiplexed LEDs there as well, you should have 100uF on the regulated side as well the unregulated side.

What happens if bring the 28X1 code right down to absolute minimum.
Say:-
do
sertxd ("hello")
loop

Do you still get counts on the 18X?
 

hippy

Ex-Staff (retired)
The sertxd has nothing to do with what the counted value is. It has an independant purpose. I read the values binary by using LED's.
The SERTXD may have an independant purpose but it may also be affecting the system overall, particularly with respect to timing.

If I'm waiting in my home ready to open the door to someone who knocks five times ( the secret code so as to not waste my time opening the door to anyone else ) it all works fine providing I am always listening to the door. If I pop out to make a cup of tea, go to the shops ( the equivalent of taking time out to do a SERTXD ) I could arrive back between knock one and two and only count four knocks and my system falls apart. If I'm logging how many knocks there are on my door that's an erroneous count in those circumstances; I put number 4 on my LED display not the 5 there actually was.

Unfortunately without a detailed description of how the pulse, count and serial output work and interact it's not possible to say if there are any flaws in the system design or not.

Pull-down? So you mean I should put like a 10k from the count pin to 0V. But why should that have any influence. The chip should (as long as it is active) keep it to 0V. (low).
That was explained in post #22, "During a download, the 28X1 output pins are tri-stated. That effectively leaves your 18X input floating".
 

Technical

Technical Support
Staff member
28x1 OUT6 -> 18x IN7

Directly wired connection

pulseout from 28x1
count on 18x.
When downloading, debugging or sertxd on the 28x1 I get various count readings on the 18x.
If you leave in the sertxd commands, but remove the programming cable completely from the system do you still get the same issue? If no then you have some kind of dodgy ground plane issue when the cable is inserted.
 

amewsaj

Member
If you leave in the sertxd commands, but remove the programming cable completely from the system do you still get the same issue? If no then you have some kind of dodgy ground plane issue when the cable is inserted.
Well, that seems to be the case. I did the sertxd loop

Code:
do
sertxd ("hello")
loop
Cable plugged in: Weird counts occur
Cable unplugged: No issues.

So what can I do about this?
I checked my download circuit, and it is correct, and no shortcircuits.
 
Top