![]() |
Forum Index : Microcontroller and PC projects : Big caps on an input....
Author | Message | ||||
Grogster![]() Admin Group ![]() Joined: 31/12/2012 Location: New ZealandPosts: 9610 |
Hi all. ![]() I am playing with the new tilt-switch samples from Digi-Key. The pendulum one seems to work well. I am still trying to work out how to connect to the Rohm one that is 4mm square(the photo-transistor one), as it is QFN-ish, in that you have to reflow solder it in place, as there are no 'Legs' per-se. Anyhow, this is what I have so far: ![]() Standard arrangement for an I/O pin as an input. Suppressing the bounce from the tilt-switch with a cap is my first thought, so I have swapped the usual 100n for a big juicy 100uF 6v3 electro cap instead, and the series of pulses are averaged out nicely now to one long pulse about 1 second or so long which is what I want. My concern is putting a large-ish cap across an input like this. Can I ASSUME that there is no issue here, as the 10k across the cap will discharge it when the tilt-switch is not active, and the 1K series to the I/O pin would limit any serious current from flowing into the input pin from the cap. Yes? Assumptions are the mother of all.......well...you know the rest of that line. Smoke makes things work. When the smoke gets out, it stops! |
||||
OA47 Guru ![]() Joined: 11/04/2012 Location: AustraliaPosts: 986 |
Grogs, the arrangement you have is not dis-similar to the suggested arrangement for the delayed reset, so I would suggest it is ok. OA47 |
||||
redrok![]() Senior Member ![]() Joined: 15/09/2014 Location: United StatesPosts: 209 |
Hi GrogsterThat should fully protect the input. Note, the 1K only does "work" if the cap has 3.3V on it and Vcc is dropped to 0V. The max current would be about 3.3mA. Should be OK. A different problem I can see is when the switch is closed the cap is directly connected across Vcc to Gnd. The charging current can be quite high. I can reset a uMITE on my plug-boards when I add a discharged cap across the Vcc buss. Lets say the Vcc caps add up to 100uF. When you turn the switch on Vcc will instantaneously drop to 1.67V. Even if there is more buss capacitance, enough to prevent dropping below 2.3V, there will be a lot of transient noise on the buss. To prevent this add a small resister in series with the switch. Lets say the value was 100 ohm the peak current would be about 33mA. Probably enough to prevent problems. redrok |
||||
Grogster![]() Admin Group ![]() Joined: 31/12/2012 Location: New ZealandPosts: 9610 |
Thank guys. ![]() @ redrok: Like this? ![]() I expect that will have an effect on how quickly the cap charges up. Do you expect that to be a problem? EDIT: In other words, how long will it take a 6v3 100uF cap to fully charge up if the current is limited to 33mA kind of thing. Charging would need to be quite quick, or the bounce problem might resurface. I will hook up a 100R resistor in series with the switch now to see. EDIT: According to this calculator, with a 100R series resistor, the time to charge the cap will be about 0.01 seconds(10mS), so not going to be a problem. I might use 220R instead. That has the effect of lengthening the charge time to 0.02 seconds(20mS), but still so fast as to not be a problem. The 220R+10K will form a potential divider, but the I/O pin will still see 3.2v of the 3.3v, so that should be fine. I will breadboard a test. Smoke makes things work. When the smoke gets out, it stops! |
||||
redrok![]() Senior Member ![]() Joined: 15/09/2014 Location: United StatesPosts: 209 |
Hi Grogster; Ya, that should do it. Technically the charge time to the uMITE trip point, about 1/2 of Vcc, the time will be a bit less than the calculated RC value of 63%. The rule of thumb two 50% is about 1/2 of the time constant. Therefor the 100R is about .005S, 220 is about.01S. redrok |
||||
Grogster![]() Admin Group ![]() Joined: 31/12/2012 Location: New ZealandPosts: 9610 |
Marvellous, thanks Mr. Maths Teacher. ![]() Smoke makes things work. When the smoke gets out, it stops! |
||||
MicroBlocks![]() Guru ![]() Joined: 12/05/2012 Location: ThailandPosts: 2209 |
Personally i would choose a much smaller cap and higher resistors. You will achieve the same but with much lower currents. I presume the tilt switch is not changing rapidly so you only need to do a simple debounce. Microblocks. Build with logic. |
||||
Grogster![]() Admin Group ![]() Joined: 31/12/2012 Location: New ZealandPosts: 9610 |
The tilt switch IS changing rapidly. EDIT: It is attached to a Mare.(female horse) Smoke makes things work. When the smoke gets out, it stops! |
||||
CaptainBoing![]() Guru ![]() Joined: 07/09/2016 Location: United KingdomPosts: 2170 |
Aww come on! you can't just drop that into the thread and walk away with no explanation! ![]() |
||||
OA47 Guru ![]() Joined: 11/04/2012 Location: AustraliaPosts: 986 |
Wouldn't be a foaling alarm would it? OA47 |
||||
Paul_L Guru ![]() Joined: 03/03/2016 Location: United StatesPosts: 769 |
![]() ![]() ![]() ![]() ![]() ![]() Is the mare, by any chance, riding in a Kuebelwagen. If she is maybe we should merge this thread with your Little Spider thread. Paul in NY |
||||
palcal![]() Guru ![]() Joined: 12/10/2011 Location: AustraliaPosts: 1993 |
I'm disappointed I thought he was going to mount it on a BEE. ![]() Paul. "It is better to be ignorant and ask a stupid question than to be plain Stupid and not ask at all" |
||||
Grogster![]() Admin Group ![]() Joined: 31/12/2012 Location: New ZealandPosts: 9610 |
Owwwwww. I think I touched a nerve with the members! ![]() Yes, attached to a Mare, as the unit is a foaling alert system. Because of this, the Mare can thrust her head around quite a bit especially during foaling. When NOT foaling, she can still thrust her head around just in the normal way that horsies do when standing about. With that in mind, the tilt switch is designed to pick up on those thrusts, and act accordingly. So the tilt switch can see several pulse-type connections per second, as the Mare shakes her head/neck kind of idea. EDIT: so, when the horse is just shaking her head, the system will see a pulse.(with the cap ideas as discussed). Without the cap, the system sees several pulses per second, just with the normal movement of the neck/head of the horse. The system is attached to leather pouches fixed to the lower side of the Mare's jaw. When the Mare lies over on her side to foal, the tilt sensor will become more permanently 'On' in either the left or right direction. When that happens, the system tests that the sensor stays that way for more then a few seconds, then sends an RF message to a base unit, which reads those transmissions, and then on-sends that to a local pager transmitter so that the staff are sent a page when any mare lies over to foal. That's the idea, anyway. Smoke makes things work. When the smoke gets out, it stops! |
||||
MicroBlocks![]() Guru ![]() Joined: 12/05/2012 Location: ThailandPosts: 2209 |
:) Well that indeed makes a big difference. :) :) :) As an alternative, could you not use a counter input instead? Checking that every second will give you a nice easy integer number to work with. A non increasing counter can be used to determine the amount of time in a position. Microblocks. Build with logic. |
||||
TassyJim![]() Guru ![]() Joined: 07/08/2011 Location: AustraliaPosts: 6283 |
40 years ago I used to make 'grazing recorders' for cattle. They could tell if the cow was actually grazing or just chewing it's cud. Very useful information when you are looking for pasture that is easy for them to digest. One piece of advice - it needs to be make VERY tough. Jim VK7JH MMedit |
||||
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |