PullDown resistor value for switch when Serial In-pin is used as input

Haroen

Member
Hi,
In my project with a 08M2 where all other pins are occupied accept the Serial In-pin, I like to use it as a switch input.
I did some reading and found limitations:
http://www.picaxeforum.co.uk/showthread.php?26648-Picaxe-08M-question&highlight=serialin+pin+input
So, use PullDown for programming and use DISCONNECT.

http://www.picaxeforum.co.uk/showthread.php?29922-Using-PIN-serial-in-like-normal-input-without-response-serial-output&highlight=serialin+pin+input
And, use a pulldown resistor of 100K for the switch and 22K for the download circuit.

My circuit already contains a pulldown resistor of 10K for the switch and sometimes works when using the download cable.
But with the ERF wireless it fails to download giving errors like "can't find hardware" and some other errors as well.
What is the right combinations of pulldown resistors for the switch and for the download circuit so that programming always succeed?
 

AllyCat

Senior Member
Hi,

My circuit already contains a pulldown resistor of 10K for the switch and sometimes works when using the download cable.
Is your "switch" a (normally open) "mechanical" pushbutton, or something else?

If it is a normally-open switch, then you should be able to use the standard programming circuit (10k + 22k) and arrange the switch to directly pull-up Leg 2 of the PICaxe to the supply rail (Leg 1), via a resistor of a few kohms (to safely limit the current). That switch must NOT be closed during programming, or until the program has started running (and the DISCONNECT excecuted). I've never used an ERF but can't see why this shouldn't work.

However, if your "switch" is a logic level and/or might become "active" during programming, then we will need exact details (of voltage levels, polarity, impedances and timing, etc.) and maybe someone with experience of the ERF can offer a solution. Also, don't forget that the Serial (Programming) Output pin (Leg 7) must be connected to the programming interface, and fully functional during programming.

Cheers, Alan.
 

westaust55

Moderator
The ERF module should work with the standard 22k and 10k Ohm resistors for programming as per the AXE027.

See page 5: http://www.picaxe.com/docs/rfa020.pdf

A circuit/schematic diagram showing how you have the ERF and the "switch" all wired up would be helpful. Maybe even a photo so folks can check physical against circuit diagram.

If you have used the DISCONNECT command (and no subsequent RECONNECT command) then you will likely need to perform a hard-reset procedure before the PICAXE firmware will detect the new program download signal and respond to the PC.
 

Haroen

Member
I've made a schematic with your modifications and end up with this
08M2 circuit.jpg

I've used the default circuit of the ERF pdf.

Photo will follow wjen I'm home again.
 

AllyCat

Senior Member
Hi,

Move R5 to the other side of R1 (i.e. connect directly to Leg 2) ; 10k should be a good value, but anything between about 1k and 22k should work fine.

R3 and R4 (150 ohms) may be a little too low. I suggest 330 ohms, or higher if possible ; the positions of the Red and Green are the "best" way around (taking into account the current-driving capabilities of the PICaxe pin), but see if you can find "High Brightness" or Superbright LEDs.

Cheers, Alan.
 

hippy

Technical Support
Staff member
When the ERF is connected to Serial In for wireless programming the ERF output will hard pull Serial In to 0V or V+. Adding a pull-up button to Serial In will not override the ERF pull and may cause damage, shorting the ERF output low to V+. The ERF was not designed for use with an external button on Serial In.

It might be possible to isolate the ERF output from the button push as shown below but this has not been tested.

It may be difficult to use an external Serial In button with wireless programming via ERF if it requires a power-cycle Hard Reset. The ERF should be wired so it remains powered while the PICAXE is power-recycled. This is not shown in the circuit below.

We would not recommend using an external button on Serial In when using the ERF for wireless programming; it will be far easier to use some other PICAXE chip which has enough I/O to have that button connected to a normal digital input pin.
 

Attachments

Haroen

Member
R5 direct on uP pin
Rleds=145 ohm Will give 20mA on uP pin and I need max brightness through circuit casing.
ERF is fragile , Should a second diode right between the 22K and the SerialIn pin give extra protection also for the programming cable too?
R5 is then still needed?
 

AllyCat

Senior Member
Hi,

Rleds=145 ohm Will give 20mA on uP pin
There is no certainty of that, and at what output voltage level? The PIC datasheet maximum ratings (for ~ 0.6v drop) are only 8 mA sink and 3.5 mA source (page 323 of PIC 12F1840 data sheet). A LED receiving lower current will just be a little "dim" (probably not even noticeable), but if the voltage levels aren't compatible with the ERF input thresholds, then the PICaxe won't program !

Yes, I'd strongly recommend retaining R5.

Cheers, Alan.
 

Haroen

Member
I've decided not to sacrifice my ERF that PICAXE doesn't sell anymore:rolleyes:

With all your help it finally works with succesful USBcable downloads!
For others I edited the schematic with the final version.
08M2 circuit2.jpg

Thanks to all helpful members.
 
Top