Crushing realizations in the shower, the downsides of being a hack
So I was screwing-around with my the main-board schematics last night. They are almost complete. After the addition of a speaker (actually, a piezo element), I had three pins left over. I was trying to decide what I should use those pins for. I know that I want at least one LED visible on the outside of the tank, as a status indicator. The tanks I am messing with, they have four LEDs near the back of the tank and I can repurpose as many of those as I want. So I'll probably have three LEDs (Though I toyed with the idea of using the pins for the Echo lines of my sonar sensors, instead of tying those pins together with the Trigger lines. I dunno. It makes the software a bit more complicated, switching pin modes every time they are used. I really don't know if I will run into any timing issues by sharing the lines).
And I played around with a NPN transistor and a piezo speaker for a while, I decided to take a shower and go to bed.
So I was in shower and that's when I realized: The IR beacon is going to be constantly on and that is going to interfere with the IR transmission. I had tested the IR transmission and reception but I had never performed that test with a IR LED shining passively nearby. The IR beacon was the linchpin to my whole scheme: It provided the light that the camera tracked. Without it, my tanks would be completely blind, just shooting randomly into the distance. And I couldn't turn the beacon off: it was tied directly into the daughter board power supply. Only by adding another wire (necessitating a 12-wire slip-ring) could I have the micro-controller turn off the beacon during the split-second that the tank gun was transmitting.
I figured something more clever was in order. I wanted to turn-off the IR beacon during the time that the IR transmitter was in use. For an idea of what an IR transmitter signal looks like, check out the top graph from this image I ripped out of a Vishay datasheet:
So, not only does the signal go to zero to indicate a logical zero, 38khz IR signals pulse at a 50% duty cycle. I need my IR beacon to be off during this entire transmission (the time period indicated as "60 ms" in the above graph).
The more I thought about it, the more I wanted the momentary switch-off of the beacon to be controlled in hardware, instead of by the micro-controller. Not only would I not have to add an additional wire going to the turret, the switch-off logic would remain entirely invisible to the main board. It would prevent any accidental "cheating" that could potentially be introduced by allowing the main board to control the beacon (forget to turn your beacon back on and your tank is in permanent stealth-mode).
But. How to do. I knew that I didn't want to add anything so complicated as a 555 timer. And this is when I am reminded that I am nothing but a hack when it comes to electronics. My circuits are the material equivalent of StackOverflow copy and pastes. My understanding of the fundamentals of the electronics is shaky, at best. I think that, for playing with something like an Arduino this is pretty much okay. I was mainly interested in the software aspect of it, anyway. Knowing that you need a current-limiting resistor when powering a diode, or that you need a pull-down resistor when reading a sensor value is pretty much the limit of what I need to know. But then I run into a problem like this and I have to decide whether to copy-paste a solution together or go about learning the basics of electronics.
Well. Ain't nobody got time for that. So google/stackoverflow/copy-pasta it is. I tried a variety of search terms before I found some information on time-delay circuits using capacitors. So this is what I am going to pursue for know. I looked around for some EDA software that could help me with this but I haven't found anything that is free and easy to use yet (Do people still use Spice, all entering their components and values into a text file? Geez. It's 2017.). The time dimensions I need to solve for are going to be too quick to see with my eyeballs. But I could solve the problem, broadly, for larger time scales, and adjust for tiny time scales with guesses or math. Again I find myself wanting an oscilloscope.
References:
http://www.brainlinksystem.com/all-about-ir-signals
And I played around with a NPN transistor and a piezo speaker for a while, I decided to take a shower and go to bed.
So I was in shower and that's when I realized: The IR beacon is going to be constantly on and that is going to interfere with the IR transmission. I had tested the IR transmission and reception but I had never performed that test with a IR LED shining passively nearby. The IR beacon was the linchpin to my whole scheme: It provided the light that the camera tracked. Without it, my tanks would be completely blind, just shooting randomly into the distance. And I couldn't turn the beacon off: it was tied directly into the daughter board power supply. Only by adding another wire (necessitating a 12-wire slip-ring) could I have the micro-controller turn off the beacon during the split-second that the tank gun was transmitting.
I figured something more clever was in order. I wanted to turn-off the IR beacon during the time that the IR transmitter was in use. For an idea of what an IR transmitter signal looks like, check out the top graph from this image I ripped out of a Vishay datasheet:
So, not only does the signal go to zero to indicate a logical zero, 38khz IR signals pulse at a 50% duty cycle. I need my IR beacon to be off during this entire transmission (the time period indicated as "60 ms" in the above graph).
The more I thought about it, the more I wanted the momentary switch-off of the beacon to be controlled in hardware, instead of by the micro-controller. Not only would I not have to add an additional wire going to the turret, the switch-off logic would remain entirely invisible to the main board. It would prevent any accidental "cheating" that could potentially be introduced by allowing the main board to control the beacon (forget to turn your beacon back on and your tank is in permanent stealth-mode).
But. How to do. I knew that I didn't want to add anything so complicated as a 555 timer. And this is when I am reminded that I am nothing but a hack when it comes to electronics. My circuits are the material equivalent of StackOverflow copy and pastes. My understanding of the fundamentals of the electronics is shaky, at best. I think that, for playing with something like an Arduino this is pretty much okay. I was mainly interested in the software aspect of it, anyway. Knowing that you need a current-limiting resistor when powering a diode, or that you need a pull-down resistor when reading a sensor value is pretty much the limit of what I need to know. But then I run into a problem like this and I have to decide whether to copy-paste a solution together or go about learning the basics of electronics.
Well. Ain't nobody got time for that. So google/stackoverflow/copy-pasta it is. I tried a variety of search terms before I found some information on time-delay circuits using capacitors. So this is what I am going to pursue for know. I looked around for some EDA software that could help me with this but I haven't found anything that is free and easy to use yet (Do people still use Spice, all entering their components and values into a text file? Geez. It's 2017.). The time dimensions I need to solve for are going to be too quick to see with my eyeballs. But I could solve the problem, broadly, for larger time scales, and adjust for tiny time scales with guesses or math. Again I find myself wanting an oscilloscope.
References:
http://www.brainlinksystem.com/all-about-ir-signals
Comments
Post a Comment