text
stringlengths 83
79.5k
|
---|
H: Most efficient use of resistors to heat an aluminum plate?
I'm building a reprap printer. I have a sheet of aluminum about 8x8" to use as the print surface, which must be heated to prevent problems while printing. </background-info>
My controller board can handle a maximum of 60V @ 11A, before either the PTC fuse trips or MOSFET overvolts. I'm not changing these components, so whatever solution I find has to fit within these constraints. I have 12x 1 ohm, 10W aluminum chassis-mount resistors that I intend to abuse as heater elements. I'm trying to find the most efficient way to parallel/series the resistors and what supply voltage to use to draw the most power. Existing power supplies I have are either 12V @ 18A, or 24V @ 6.5A, and I would prefer to not purchase another one if possible.
Exceeding the wattage of the resistors temporarily is perfectly acceptable, because I'm only shooting for a target temperature of 65-110C (depending on the plastic used). Any solution I'll be happy with should hit that temperature within 10 minutes or so, so pushing 25W through a 10W resistor in that time won't really cause them damage. And if it does, meh, they're a buck each. After the platform is at temp, a microcontroller will cycle the power of the resistors to control the heat.
AI: Seems like you want to get the max power from the resistors and power supplies that you've got. 3D printing is a long process. I don't see how temporarily exceeding the rated power dissipation can help. The following is for the steady state.
12x 1Ω resistors, each rated for 10W. The max steady state overall power you can dissipate is 120W. Each resistor dissipates \$P = I^2R\$. The max rated power is reached when
\$I=\sqrt{\dfrac {P_{rated}} R}=3.16A \approx 3A \$
Pick a series/parallel combination of resistors such that
\$\dfrac {V_{supply}} {R_{series}} \approx 3A\$ (just under 3A)
This can be achieved by using the 12V power supply and resistors in 3x parallel strings each with 4x resistors in series. Each string will pull 3A. Together, all 3x strings will pull 9A. The 12V power supply in the O.P. is rated for 18A. It should be able to supply the current.
Construction tips
Use thermal grease
Thermally insulate the bottom of the plate, if possible. |
H: How do I receive an entire string as opposed to 1 character at a time on the arduino?
I followed the instructions on this website successfully:
http://www.doctormonk.com/2012/04/raspberry-pi-and-arduino.html
and I was able to get communication between the pi and my arudino mega exactly as the website specifies.
However, instead of sending an integer representing the number of times the LED blinks, I want to sent ASCII text like:
"MOVE 5 METERS FORWARD", "TURN LEFT", "MOVE 10 METERS BACKWARD" to the arduino from the pi.
I wrote the following code:
char inData[64];
char inChar=-1;
void setup(){
Serial.begin(9600);
Serial.begin("Waiting for Raspberry Pi to send a signal...\n");
}
void loop(){
byte numBytesAvailable= Serial.available();
// if there is something to read
if (numBytesAvailable > 0){
// store everything into "inData"
int i;
for (i=0;i<numBytesAvailable;i++){
inChar= Serial.read();
inData[i] = inChar;
}
inData[i] = '\0';
Serial.print("Arduino Received: ");
Serial.println(inData);
}
}
I flashed above code succesfully to my Arduino Mega 2560.
I switched to my python terminal on the Raspberry Pi and in the console I typed:
import serial
ser = serial.Serial('/dev/ttyACM1',9600)
ser.write("MOVE")
What gets displayed on my Arduino's Serial Monitor is as follows:
Arduino Received: M
Arduino Received: O
Arduino Received: V
Arduino Received: E
But what I want is:
Arduino Received: MOVE
How do I change the code above to get all characters into the inData buffer?
AI: The problem is that the Arduino is looping around so fast, it will execute the if (numBytesAvailable > 0) line several times between each character arriving through the serial port. So as soon as a character does arrive, it grabs it, loops from zero to one, and prints a single character out.
What you should do is send an end of line character ('\n') after each command from your Python program. Then have your Arduino code buffer each character it receives and only act on the message once it receives the end-of-line character.
So if you change your Python code do send an end of line character, like so:
import serial
ser = serial.Serial('/dev/ttyACM1',9600)
ser.write("MOVE\n")
Then your Arduino code can be something like this:
// Buffer to store incoming commands from serial port
String inData;
void setup() {
Serial.begin(9600);
Serial.println("Waiting for Raspberry Pi to send a signal...\n");
}
void loop() {
while (Serial.available() > 0)
{
char recieved = Serial.read();
inData += recieved;
// Process message when new line character is recieved
if (recieved == '\n')
{
Serial.print("Arduino Received: ");
Serial.print(inData);
inData = ""; // Clear recieved buffer
}
}
} |
H: Connecting multiple ultrasonic sensors to one Arduino
I'm trying to connect five ultrasonic sensors (HC-SR04, to be exact) to an Arduino board to detect obstacles in five directions (four cardinal + one Z-axis). I read the datasheet on the HC-SR04s and the Arduino Uno as well, and found that the ultrasonic sensor draws 15mA when active, and the Uno can supply a max of 40mA through each pin and a total of 200mA from all pins.
Now since I don't have ten PWM I/O pins, I've thought that since I'll be firing the sensors all at once, one trigger pin is enough. The ECHO pins will go to a separate PWM pin for each module.
I have two concerns here (I'm just a beginner in electronics :)):
I'm going to supply power to each sensor off a 5V/2A BEC. So will this cause current overdraw from the Arduino PWM pins? If so, is there a workaround? Maybe a transistor-driven solution? (I've done a basic electronics course in college, but never had a chance to design one on my own.)
The second concern is regarding my trigger pin design. Will one pin be able to pulse five of the sensors, or will the current drop not let them fire (since they're all in parallel)? My guess is that it's only the voltage that's firing them up (assumption) and in parallel it would all be the same so it should work, right?
I searched around, but I only found information on connecting one sensor to the Arduino. I read something about running high-amp motors with Arduino by supplying the current through a battery so I think my first concern should be fine? But I'm not sure, and so I thought I'd ask here. Thanks!
AI: The problem with hobby related solutions is documentation is limited and not spec'd like commercial components or modules.
It is possible that it may work but make a block wiring diagram and consult with the OEM is advised. Mind you I don't know if they have adequate support for your question as these are built in China.
Hobby Services
3002 N. Apollo Dr. Suite 1
Champaign, IL 61822
(217) 398-0007
E-Mail: [email protected]
Internet Address: www.supertigre.com
It appears that your ultrasonic load is TTL so there is no problem switching 5 at the same time with a BEC, but I wonder if you have considered the effects of crosstalk on firing all at the same time. They indicate a 15deg detection angle but this would depend on the reflection angle of objects you wish to detect. There may be phasing issues with reflection cancellations like having 5 tweeters directed in a room. Reading the response of each echo in parallel with a time interval count won't be a simple textbook result with non-smooth objects with 5 senders.
YOu can test your orthogonal array design with any signal pulse generator and look at the signal on a parallel port logic analyzer or scope to ensure what you are design will work.
Power drive is the least of your concerns from these low power devices. Noise avoidance from conducted and radiated sources will be paramount and design of the transponder array must come first. I would spend some time on testing this part 1st to identify all the electrical, physical, acoustic, EMI, thermal, vibration both conducted and radiated sources of interference and how each affects your SONAR expectations with different objects. Will it be microphonic with vibration or loud pulse noises. How well does it reject other ultrasound sources of noise? Will the TTL Echo output change in pulse width with signal strength or just the delay time.
Will you get echos from the wrong sender due to corner refection effects. |
H: How to spy a Bluetooth COM transmission?
I promise, I'm not doing something mischievous :)
I have a remote device (IMU) which communicate with a PC through a Bluetooth transmission : an ARF7044A Bluetooth Device from Adeunis on the IMU and a BCM2046B1 Bluetooth dongle from Bradcom on the PC (I'm on Windows XP by the way) .
The problem is that sometimes the IMU send datas, but the PC does not "see" them, though it is possible to send datas to the IMU : I think the communication is not broken, but it is rather a low-level software problem.
The issue appear whether I'm using a hand-made communication software coded in C, but also on "professional" software like putty or Realterm, indicating a driver problem ( I'm using the btwusb Broadcom driver, version 5.6.7900 ).
My question : Is there a way to spy an open communication between the IMU and the PC to see when and why it goes wrong, like a debugging tool ?
I know it is not a "real" electronics question, but I have figured I might have more answers here than in stack overflow.
AI: I think you need to google "bluetooth sniffer".
Then you'll find commercial apps with bundled bluetooth dongles like this, free open source solutions like this and some articles that discuss updating specific over-the-counter bluetooth dongles that can be flashed with special firmware like this
Hope this helps! |
H: What's the purpose of this checkerboard pattern?
This gigabit Ethernet NIC has a checkerboard pattern out of copper etched on the PCB:
Each square is electrically isolated. What's the point of adding these? I guess that the PCB isn't filled with a copper plane due to cost concerns, but why don't leave it empty then?
AI: That's called copper thieving. It helps balance the amount of copper on the outer layers which makes the etching process easier. Basically it helps them avoid over or under etching the board.
Usually I'll have a note on my board files that I send to the fab house like: Fab may add copper thieving at their discretion so long as it is at least 100 mil from any major feature. Which basically means theive all you want but don't get it near any of my signals.
Why not just fill the outer layers with copper pour then? It's not cost, etching a pcb is not an additive process. They start with a full sheet of copper and burn it away. Having copper pour all over the place close to my signals!!! That would cause impedance discontinuities everywhere.
Plus depending on how it's routed you don't want to unbalance your board, for example having plenty of copper pour on the bottom but little on the top. That will lead you into having your board cup and curl when it goes through the oven. |
H: Calculating dBFs from RSSI
I have RSSI calculated as vector magnitude.
$$
RSSI = \sqrt{I^{2}+Q^{2}}
$$
I and Q are 12bit values from ADC. Is there a way to convert RSSI to dBFs and how it is done?
AI: Sure, take 10 * log of the ratio between the measured power, and the full scale power.
Since power goes as the square of voltage, you can remove the square root operation.
That gives you:
$$
dBFs = 10 \log({(I^{2}+Q^{2}) / (2^{11}-1)^2 })
$$
You can of course pull the denominator out of the expression, take its log, and convert it to a constant value to subtract from the log of the numerator.
Defining the maximum range of the inputs can get tricky; the range in two's complement form would be from -2048 to +2047 (though other representations are possible). Considering +/- 2047 the maximum is tempting, though some might say +/- 2047.5. And there's even a school of thought which offsets zero by .5. Rounding errors can have some very interesting effects after multiple DSP operations.
Also, it is tempting to think of the maximum as I=2047 Q=2047, however this is a vector which can only occur at the 45-degree phases - you could see it in an impulse, but not in an undistorted signal. Normally, you would want to adjust your gain to stay within the maximimum vector rotatable to any phase, ie, I or Q = 2047 and the other zero, or their combined magnitude = 2047, so that is what should be considered full scale. |
H: how to electrically isolate a PCB from a heat sink
I have a set of LED driving lights on my motorcycle that must be wired through a ground-leg pulse width modulation dimmer. The problem is the mounting bracket for the lights is grounded, so the lamp shorts to ground through the motorcycle chassis and the PWM dimmer cant dim the lamps. I had solved this issue by isolating the lamps from the motorcycle's chassis at the mounting point, but this has proved unreliable in the rain, and the brackets I had to use weren't up to the task and eventually broke.
I now need to look at internally isolating the lamp housing from the ground leg of the circuit. I had hoped that when I opened up the lamp there would be a separate grounding lead screwed to the light housing that i could simply disconnect, but it appears that the housing is grounded simply by the contact between the PCB and the housing, plus the PCB mounting screws.
My first thought was to just put some small rubber o-rings between the PCB and the housing, and switch from steel to nylon screws for mounting the PCB, but then I remembered that the LEDs need a thermally conductive path to the housing for cooling.
So the question: how to provide a thermally-conductive, electrically-insulated mount for this PCB?
I've seen mention of mica washers, some mention of electrically-insulating heatsink compound, but nothing that seemed authoritative enough to scream "answer."
The PCB is probably 7cm square, and it is surface-mounted to the lamp housing/heat sink by 4 screws, one at each corner. The PCB's entire back appears to be aluminum--actually it looks more like the PCB is aluminum. More likely there is a very thin PCB laminated onto a piece of aluminum stock, pretty cool really, first I've seen like that.
AI: Typical solutions I've used are either Kapton tape:
Or Sil-Pad:
Sil-Pad 400 is a composite of silicone rubber and fiberglass. The
material is flame retardant and is specially formulated for use as a
thermally conductive insulator. The primary use for Sil-Pad 400 is to
electrically isolate power sources from heat sinks.
If you use a sil-pad the screw will still electrically connect the componet tab with the heat sink. A solution to this is to use a shoulder washer to isolate the screw and the tab: |
H: Designing electronics and their enclosures for the outdoors
I think the title captures it, but to expand upon this further. What are some of the best practices that you use to place electronics outdoors? Include what you do for the cases and mention issues with temperature, moisture, lightning, shock hazards, UV Damage and if your device generates heat how do you deal with it, how do you get power to it etc.
AI: Moisture ingress protection:
Unless you are willing to completely encapsulate your circuitry in epoxy or similar, you will have to deal with water ingress into your electronics cabinetry. In general there is no guaranteed totally sealed box, if you have water vapour, temperature cycles and a sealed container it is a certainty that water will find it's way in.
On of the best ways of dealing with this is to put an explicit pressure equalization port in your case. In the early days we would use a fine brass or stainless mesh, that would prevent most moisture from entering. Now a days there are special membranes derived from outdoor jackets (brand name omitted here) that work very well as they prevent moisture ingress, allow for moisture egress and allow air pressure to equalize. |
H: About Quine-McCluskey method on circuit design and don't cares
My teacher have give me a question is like this.
Design a 2-of-5 Code to BCD 8421 Code converter. Minimize each of the output to SOP form using Q-M method and draw the circuit diagram using basic gates (i.e. AND, OR, NOT gates).
Can I treat the non 2-of-5 code output as logic 0 insteat of don't-care terms? because I dont have any idea how to do the QM method without error with 22 dont care term. =.='
AI: Yes, you can. Since she didn't specify what to do with invalid input, you can do what you wish. However using don't cares will result in a smaller result. |
H: Is a capacitor considered a solid state device?
Based on a description I read here.
Solid-state electronics are those circuits or devices built entirely from solid materials and in which the electrons, or other charge carriers, are confined entirely within the solid material.
I was thinking Caps are usually built of "layers" of "stuff" (paper, plastic, glass, mica), but they can also have fluid in them (electrolytic), which is not solid. The article I was reading mentioned that vacuum tubes aren't solid state because they contain/use gas, so would that be the same for a capacitor? or are they generally considered solid state devices anyway?
AI: For the 1st half or so of the 20th century, vacuum tubes (or "valves") were used for rectification (diodes), amplification (triodes, tetrodes, pentodes, etc.), and, for most of the 20th century, displays (CRTs).
In these devices, a space current of electrons exists between the cathode and anode, i.e., the charge carriers are transported through a vacuum*.
In the 2nd half of the 20th century, semiconductor technology advanced and rapidly rendered vacuum technology obsolete (except for CRTs). In semiconductors, the charge carriers are transported through the crystal lattice of the solid semiconductor, thus the term "solid-state" to distinguish these types of devices from the vacuum devices.
Generally, this is the context in which "solid-state" is used and understood.
In the case of capacitors, the dielectric doesn't support charge transport, i.e., there isn't a flow of charge carriers through the dielectric in a properly functioning capacitor so the dielectric falls out of the scope of the definition you've quoted.
*with some exceptions. |
H: How to detect when an antenna is not connected
I have a GPS receiver module connected to an AVR microcontroller and need to detect if it doesn't have an antenna properly attached. Some time ago I found a reference circuit but now that I need it I couldn't find it in my computer neither with a Google search. Could someone point me to any resources for this, or give the guidelines about the basics?
NB.: it's an active antenna.
Thanks!
AI: Looking at the GM862 hardware guide (located here), Telit indicates that their module has a built-in current measurement circuit for the GPS antenna input that is readable by AT commands. Using this, you should be able to read whether or not current is being drawn which should indicate whether or not your antenna is connected or you're experiencing a short circuit. |
H: What motion sensor to use for human breathing
I need a cost sensitive, reliable, durable motion sensor to track if a baby is breathing or not. This is for use in a university challenge project I hope to win. Any advice on my options are very welcome.
[edit]
criteria to be followedMy project should be cost sensitiveshould be low power Should be easy to use by untrained personel
AI: Such motion sensors are commercially available. They have a transducer that takes the form of a large, flat pad. This is put under the bedding, and the infant lies on top of it.
It is coupled to some transmitter that will activate an alarm on a receiver if the transducer stops detecting movement.
So, that is what the successful, commercially available product looks like.
A good starting point would be to survey these, get one, and take it apart.
In a university challenge project, you don't have to beat a product in the marketplace, but of course whatever you come up with inevitably does get compared with what is out there.
All products have limitations because removing all imitations means skyrocketing cost. If you could find one or two limitations of the existing product and improve on them, then you have a "story".
Sometimes it's enough to improve on some limitations while introducing or increasing others. From the point of view of a consumer who cares about the limitations you improved, and does not care about the worsened ones, this is an improvement and in the market as a whole, it represents a broadening of the available choices.
Do not think you have to monotonically improve something; just making different design trade-offs is interesting. |
H: Does a switch need to be debounced when opened?
Suppose that an input on a microcontroller has a pullup resistor to 5V and a switch to ground (normally open) connected to it. I know that a switch should be debounced (in my case, in software) when closed, but is debouncing when a switch is opened necessary?
AI: Yes, debouncing in both directions is necessary if you want a guaranteed single edge each time the switch changes state.
Fortunately, you don't need any additional hardware for debouncing if the switch is connected to a microcontroller. If the micro has a internal pullup, which many do, you need nothing more externally than the switch between the micro pin and ground.
I find 50 ms is a good debounce time. Most switches bounce for well less than that, but a few can be nearly that long. But, 50 ms will still feel instantaneous to a human user, so you might as well be extra reliable. The only difference is the number you count to in the firmware, so no extra cost there. I usually have a 1 ms periodic interrupt for other reasons anyway, so if the switch is in the same state 50 times in a row in that interrupt, then you declare it debounced to the new state.
Details on debounce logic in response to comment:
Generally you will have a global bit that indicates the official debounced state of the switch. This is what any logic that needs to know which way the switch is set uses. The only additional state you need is a counter, usually a single byte, in the interrupt routine. Let's say the interrupt is every 1 ms and the debounce time is 50 ms. For each interrupt:
If instananeous state matches debounced state:
Reset counter to 50
Done
If instantaneous state differs from debounced state:
Decrement counter
If counter reaches 0:
Declare the new debounced state
Reset counter to 50
Done |
H: No silkscreen on board? How common is that? What are the advantages?
I'm a young engineer and I just started at my second job. I was surprised to see that the PCBs have no silkscreen. I'm currently working on the redesign of a PCB currently on the field and I'm trying to push for the re-introduction of silkscreen on boards. Some of the responses I get are:
boards are cheaper without silkscreen
since there are so many 0402 components, the silkscreen won't be readable anyways
there are too many vias and placing of silkscreen would be very difficult
you can view where the components are on your PC
In my opinion, those are not valid responses, but I'd like to know if there are any other companies out there that have similar "practice". Some of the products we produce go from 1000/year to 20K per year. But no silkscreen makes it more difficult to debug/test prototypes and field returns.
AI: Well I've made 1 million units for a product and they all had silkscreen and we fought over the cost of a resistor so it's not that cost prohibitive. Yeah I guess there is a cost associated with that but it's not that much. Also when you need to do rework, or when at the end of the line they are repairing boards that didn't pass testing, you want to be able to say "yeah replace U1 and change R17 to 33 Ohms" without having to haul out the schematic and the layout. Sure some factories will have computers with your drawings out there, and some have dirt floors ;)
For 402 components or vias just move your silkscreen, I mean I have 201 components that are labeled properly it's a matter of taking the time to do it.
So in short I agree with you I always prefer silkscreen, the only time I don't do it is when I'm making something for a hobby for myself and I'm being really cheap. Even then I usually try to label the parts in copper. Not saying you should do that for a real board though. |
H: Starting with pic programming dspic30f2010
I'm pretty sure that it's a duplicate in some way but I have to ask anyway. I'm pretty new to chip programming and I got some results using arduino but I still have no idea how to use the pic board my friend gave me.
http://www.futurlec.com/dsPIC30F2010_Board.shtml
It looks good so far. I have 3 cables but I have no idea how to download a program to the board. My question for now isn't that much related to compilation. I have some sample hex files that can be downloaded to the board.
usb -> rs232 (plugs in lights are lighting)
db9 -> rs232
db25 -> 10 female plug (no idea what's the actual name for that plug EMPIC or something)
Since I only have a laptop the only usable cable is usb. I could probably find adapters for the other cables but yeah.
When I plug the usb cable, leds will light and it seems that current is working. On my db9 cable, it's written download rs232 So I kind of assume that downloading a hex file using the rs232 plug should work. But after reading, I believe that this plug might be just for use with the chip and not for programming the chip.
http://www.futurlec.com/Pictures/dsPICBRD4_600.jpg
You can see there that it's just above "download ET-EMPIC"
I can take pictures of my whole set if something isn't clear enough. I'd really love to get working on that chip. I read some of the spec about the chip but couldn't really find anything on how to get started. It's as if people who wrote documentation are assuming that people already know why programmers exists (quite confusing term to be honest), how to use them and how to make things happen.
I'm quite confused and don't understand why it's so hard to actually get something on the board. If someone can help me downloading a hex file to that board I'd be the happiest man on earth for some time.
As far as I understand, this board should be enough to be used without a programmer. But i'm guessing that I have to use the db25 to empic plug. If I have to buy something then I'll probably purchase it. I was also thinking about making my arduino board work as a programmer for my dspic but this isn't really a good option.
Also something I don't understand. The powersupply is requiring 16v while in the docs, I read somewhere that while downloading a program I should supply not less that 14v to the board. I know that my usb cable are providing not more than 5v. Any reason why the programmer would require so much to download the program?
edit
After a bit of research, I found that:
http://www.etteam.com/product/06A07.html
ETT is the actual constructor of the board. Problem is that it's all written in thai. In short I believe it says I have to use winpic800 using ICP plug. It should be possible to program using the ICSP pins but I'd need an external programmer.
AI: From a quick look at the first link, it seems this board has some kind of programming function built in. That means it should come with software to send the necessary commands over the serial line, then special hardware on the board will wiggle the PIC programming lines appropriately. You will have to get this info from the manufacturer or the reseller, which could be Futurelec in both cases.
The reason the datasheet doesn't go into much detail about how to program the chip is because there is a whole separate document for the called the Programming Specification. A number of similar chips use the same programming protocol, so they document it once.
I have some general de-mystification about PIC programming at http://www.embedinc.com/picprg/icsp.htm. |
H: What is the definition of Cload for MOSFET drivers?
I am currently looking at the LTC4444 MOSFET driver.
It states that the rise and fall time of the gate driver for 1nF load. Is this 1nF load the Ciss value or Qg/Vgs of the MOSFET?
Thanks
AI: It is the Cgate of the driven load, in your case the gate capacitance. |
H: PIC circuit won't stay powered
I've built a simple LED sequencer using PIC 18f4550. Outputs are 10 pins on ports C&D. I have now built (soldered) this circuit 3 times and it still only powers on intermittently. I installed a very low current "power on" LED to help troubleshoot. I notice if I touch the chip or certain areas of the board, the circuit works (& power light on). But it intermittently goes out. Almost like there's a loose connection or some capacitive issue. Circuit works fine when the power light is on. Symptoms are the same whether breadboard or soldered. Ideas?
Thanks
please excuse the crudeness of this drawing.
AI: You probably are missing a pullup on the reset pin (/MCLR) |
H: Safe to put capacitor at I/O pin?
I'm using a microcontroller to simply turn on and off an LED, but I want it to fade in and out. I set up the circuit in this way:
When the pin goes high, the capacitor would instantaneously draw a large amount of current as it starts to charge up, and the pin can only source up to 25mA.
I was wondering whether this is still safe to do or could it possibly damage the pin?
AI: There are lots of reasons why you shouldn't do this. Here are the ones that I can think of:
It won't make the LED fade in. As others mentioned, the RC time constant is too short to be noticed.
You run the risk of exceeding the current on the output buffer and damaging the part.
You run the risk of exceeding the current on the clamping diodes on the pin and damaging the part.
Others have mentioned 1 and 2, so I will elaborate on 3.
When your device turns off, the power rail (I'm assuming 5v) will go to 0v but the capacitor will still be charged. Inside the MCU is a diode from the pin to VCC, and another from GND to the pin. If the cap is charged and VCC is 0v then the diode to VCC will be forward biased and start to conduct. If the cap is large enough and the 5v rail decays quickly enough then the current flowing through this diode can be quite large.
Normally this isn't a problem, but if you try to make that cap really large (to lengthen the RC time constant) then it becomes an issue. If the cap were really large then it would not surprise me to see several amps through that diode.
(Note: I'm ignoring the load on the +5v rail and what it does to this problem. Deal with it.)
As others have also mentioned, PWM is the correct thing to do here. But let me add that the human eye has a logarithmic response, and you have to take that into account when fading in/out.
What I mean by this is that lets say that the LED is spitting out 1 mW of energy and you increase it to 2 mW. You see something less than a doubling of of the light. Now you change the energy from 2 mW to 4 mW. What you see is the same step up in light as when you went from 1 mW to 2 mW. In other words, the 2 mW increase the second time around produced the same apparent increase in light as the 1 mW the first time.
If you were going to make an LED fade in, using PWM, you don't ramp up the PWM duty cycle linearly. You do it exponentially. So instead of 10%, 20%, 30%, . . . 90%, 100% you do it like this: 1%, 2%, 4%, 8%, 16%, 32%, 64%, 100% (or something similar). Fading out is done the same way, just going down.
Incidentally, this exponential fade in is exactly opposite what an RC filter would do. That would give you something like 0%, 50%, 80%, 90%, 95%, 98%, 99%, 100% (but with voltage, not duty cycle). So even if you managed to get an RC time constant that was long enough it still wouldn't have the required shape to look nice. |
H: Using multiple resistors on a breadboard to limit voltage to LED
so I've recently begun my venture into electrical engineering, just got myself a breadboard with some jumper cables, a pack of assorted LED's and a few 200 ohm resistors.
I'm trying to understand how to further limit voltage to my LED using a 9V battery and multiple 200 ohm resistors but I've come up with the following question / problem.
Judging from this image: can you please tell me if this is wired properly? I have 7 200 ohm resistors connected in this circuit and it doesn't appear to be dimming the LED at all. When I take away 3-4 resistors, it's still just as bright. @ 1400 ohms, I figured the LED's would be significantly dimmer but alas they're not.
The specification of the LED i'm trying to power with my 9V battery is, Green, 2.9-3.1V with a forward voltage of 20mA
Anyhow, I'm having a heck of a time tying to wrap my head around this and figure it's something small I'm missing. When I touch all 7 resistors connected to this circuit, I can definitely feel a significant amount of heat coming off of them.
Would anyone be able to assist me with this issue I'm having? any advise or criticism is appreciated.
Thanks all.
AI: First of all, lovely picture. This makes it easy for me to see what's going on.
Looks like you are adding the resistors in parallel and so each additional one is reducing the total resistance.
Try hooking them in series instead and you should see the LED get dimmer. |
H: Problem with circuit created with fabric pressure sensor
This is only my second time working with any type of circuitry, so I apologize in advance if I don't use the right terms when I explain my problem. Feel free to correct me!
So in one of my projects, I used this instructable to create a pressure sensor out of conductive fabric. I followed the instructions and the sensor worked flawlessly. I actually want to do this on a larger scale. But of course, I'm testing this small version first before I move on to a big piece of fabric.
When I tried setting this up with an Arduino Uno (Uno is for testing purposes, I'm actually going to use a Lilypad), I was able to create this exact circuit, send light to the LED, and output the resistance value onto the Serial. But for some reason, when I remove that LED, it looks like the connection going into the Arduino, sending the resistance information, won't go through. You can take a look at this picture** to see what I mean. I also tried connecting the power to the pressure sensor and then connecting the output straight into an Analog pin on the Arduino. Even though this exact thing works with an LED attached and outputs the resistance value to the Serial, it doesn't work without the LED.
On a side note, I was wondering if anyone knew if I made this on a larger scale, using a lot of conductive fabric, if it would affect the resistance and the results of this project in any way?
**The picture shows the power going into the fabric from the Arduino through the green wire on the right side. On the left, the long red wire in the return going into the breadboard. The black wire from the breadboard is pinned into Analog0 and the shorter red wire is connected to GND.
AI: As this is only your second time working with electronics, I'll try to keep my terminology simple.
It's hard to see exactly how you have wired up the sensor and LED, but I can take a guess. (If I'm wrong, then everything below probably makes no sense).
The sensor is connected between + power and the Arduino input, while the LED is connected between - power and the Arduino input.
When you press the sensor, electrical current can flow from the + side of the power the Arduino sensor pin, charging it up and giving it a high voltage. Current also flows through the LED, causing it to light up.
Now, what happens When you release the sensor? The electrical charge inside the Arduino sensor pin which was giving it a high voltage, will now flow as current through the LED to - power, bringing the voltage down, so that the Arduino sees you've let go.
But what happens if you don't have an LED in there? The electrical charge in the Arduino sensor pin has nowhere to go, and so it just stays there, and the voltage doesn't change.
The reason the Arduino's sensor pin behaves like this is because it behaves like a tiny capacitor. It can store a small amount of electrical charge, and thus 'remember' the voltage that was placed on them by the sensor.
So, how can you fix it? You'll need to have somewhere for this charge to flow. If not an LED, then a resistor should do. Any value between 1k and 1000k will probably work fine. |
H: What's the best comunication protocol for a sensor network?
What's the best comunication protocol for a fast and cheap wirelless sensor network?
Is it one of these?
WirelessHART
IEEE 1451
ZigBee / 802.15.4
ZigBee IP
6LoWPAN
Other
AI: All of those you've listed use 802.15.4 as the physical radio layer.
802.15.4 is a good choice as there are many chips from semiconductor makers that have this radio. Also look into BTLE.
A great way to get started with 802.15.4 and 6lowpan is with the Contiki Operationg system and Econotags. |
H: Is that a capacitor and how does it work?
I'm trying to understand how my (rfid?) travel card works. It looks like this:
I'd like to know if the two portions of wire shown at the end of the arrows are capacitors and, if it is the case, how does it/they work(s). Could it be for example charges that accumulate on the surface of the wire creating a capacitive effet?
AI: Yes, the zigzags are to match the RFID antenna.
The basic idea is that the impedance of the antenna and the impedance of the whatever you are hooking the antenna up to need to be matched in order to transfer power from the antenna into the input circuit.
Whoever designed this probably used a simulator to figure out how to make those zigzags and then measured the results on a vector network analyzer.
Read RF Circuit Design by Chris Bowick to really understand (and then get some play time on a network analyzer). |
H: LED properties for throwies
A throwie is a small LED attached to a coin battery and a rare earth magnet.
In quantity, they are used for creating non-destructive graffiti and light displays.
Singly or in small quantities they are just fun.
You use them by throwing individual LEDs onto (ferromagnetic) metallic objects.
By throwing LEDs onto an object, the object itself acts as a canvas.
Throwies usually consist of a CR2032 or pair of CR2016s with an LED held across the battery with tape and a strong magnet. Very simple, no current limiting resistor, easy for kids to assemble. Lots of fun.
What are the properties for a good throwie LED?
Good things, possibly in order of importance:
Safe (no exploding or burning batteries, LED can withstand being thrown, etc)
Bright
Cheap
Omnidirectional light
Different colors
Lasts a long time (days great, a few hours minimum)
While I know there is no right answer, I'd like to know the properties to look for and a range of the values that would make a good throwie.
AI: This product is a consumer liability.
Preventing a short and subsequent exposure to rain or water is paramount.
Ignoring this risk outlined in the MSDS of any Lithium Manganese Diodxide battery and blocking any vents with sealant or epoxy is also a bad idea.
There are kits from China for under a dollar per CR2032 10mm diffused LED, but I have no experience with them so I won't recommend any.
Here are some guidelines:
Energizer coin cells have approx 10 ohms internal resistance (IR) which rises quickly towards end of life. Panasonic appears to have a much higher IR (~100ohm) perhaps for safety reasons.
Diffused LED's would provide best display properties at all angles.
10mm LED's can be bought for <25 cents but compare mcd levels with 5mm LED's.
Different colors have a nominal voltage that may exceed the 3V cell voltage which has a large positive temperature swing of +/-0.3V that may also force excess over or under brightness. Close to 3.2V will last long but dimmer. Close to 2.8V will be brighter but last shorter.
Expect maybe 50% of rated 225 ~ 250 mAh capacity when overdriving well beyond rated load.
Getting the right match of LED's to CR2032 is a matter of luck since there are so many variables uncontrolled.
use silver conductive epoxy for a reliable bond of leads on either side of coin cell, sparingly with excess lead length sheared off.
Rare earth magnets must be epoxied to case are very brittle so must be coated. |
H: Voltage limitations on AREF for Arduino
The default for the Arduino A/D capability is a 5v reference. Given the 10-bit A/D converter, this is 4.88mV per number from 0 to 1023. The Arduino also supports setting the analog reference voltage to 1.1V, giving an accuracy approximately 5 times higher.
I wanted to try increasing that further.
The Arduino has an internal 32k ohm resistor on AREF, so I connected a 1M ohm resistor to Vcc. The voltage reads 0.16V, but then A/D converter doesn't work. Presumably there is a lower limit. With 100k, it works, but the reference voltage is more than 1.1V, so there isn't much point.
Is it possible to set the reference voltage to less?
AI: Not sure which Arduino you have but on page 377 the datasheet for the atmega2560 says Vref min for the adc is 1.0V. So unfortunately that probably won't help you. |
H: Identifying / replacing some jacks and removing glue
I am by nature a CS / IT guy, and I am trying to replace some connectors on a relatively nice speaker system (Altec Lansing VS4121), as well as remove the (what appears to be wood) glue from it, for easier maintenance in the future.
I've included some image I've taken of the board here, for you to get a better idea what I am working with: https://i.stack.imgur.com/0GhHt.jpg
My question(s): where can I locate replacement jacks for the connectors shown (stereo mini-jack, a component / RCA mono jack, and something which appears similar to, but is not, a S-video jack), and what solvent should I use on the glue if I do not wish to damage the board? I was thinking that isopropyl alcohol probably wouldn't do the job, then thought of white vinegar, but since my interactions with PCB components has been somewhat limited, I thought better to ask before attempting.
I am also thinking of increasing the cable lengths (not shown) for some of the interior stuff, as they are barely long enough to connect with the board.
AI: So I agree with the guys above, try to mechanically remove the connectors. First though flip the board over and take a good look at the solder and see if it's cracked. That's pretty common after mechanical stress. If it is cracked a quick re-solder could fix.
If you have an meter you could check to see if the pins are making connection. You could stick a pin or something to get into the tiny connectors, or a cut old cable, and then check each pin to see if a connection is being made.
Buy the parts
I'd try digikey the smaller connectors are 3.5 mm mono jacks
The s-video looking one I think is called a mini din.
Hope that helps some. |
H: How to polarize a signal before sending it to the antennae
I am an electronics noob and searched around the FAQ and this question seems askable. My questions are:
How can I create polarized signals and are there any parts I need to be aware of to easily do so? (not receive and filter out polarized signals but send them)
Do I need a different oscillator for each type of polarized signal I want to send out?
AI: So I'm not sure what your working on (context helps!), but here's some general advice:
A signal is generally polarized by the orientation of the antenna you are outputting from. A vertically oriented antenna will output waves which will be more easily picked up by another vertically oriented antenna. A horizontally oriented antenna will output waves which will be more easily picked up by a horizontally oriented antenna.
Vertical polarization has the benefit of being omni-directional (when using a whip or dipole antenna). Horizontal polarization has the benefit of bouncing off the surface of the earth (or ocean) with less loss, thus generally traveling further with the same power. The downside to horizontal polarization is that you generate a directional wave so it needs to be aimed at the target.
You can get a varying polarization by having two antennas orthogonally oriented and then varying the strength of the signal in the antennas.
I hope that helps! |
H: If a wire is rated 10A, 120v AC. How many amps could I put through it of 13.8v DC?
I am using a wire that is rated 10Amps at 120v ACwith a car headlight and a SLA battery. About how many amps could this wire carry before getting warm or melting of DC current at 13.8volts?
AI: Unless you're working with RF (e.g. high-frequencies, > ~100 Khz), or really, really large wire (cross sections in inches), Amperes are Amperes are Amperes.
As such, a wire rated to handle 10 amps can handle 10 amps, independent of the voltage.
The voltage rating of wire generally relates to the breakdown voltage of the insulation. Basically, with wire rated to 120V, you can be confident that normal handling of the wire while it's energized with 120V will be safe.
If you were to put ~1000V on it, you might encounter issues with the insulation breaking down, and it could possibly shock or electrocute someone. However, this is a safety issue, and does not affect the wires ability to carry current. |
H: PIE vs Manchester Coding
Why is Manchester encoding preferred to PIE(Pulse Interval Encoding) for applications were data is transferred through inductive coupling? For transmission of data and power through wireless medium (other than inductive coupling) will PIE be better suited?
AI: Manchester encoding is designed so that the percentage of time that the signal is in one state is exactly equal to the percentage of time that the signal is in the other state. This means that there is no accumulating bias of the average level of the signal while it is transferred through what ever communications medium is in use. Pulse Interval Encoding on the other hand does not have this property.
The average level of zero for signals being sent through a channel is important for any medium that cannot be DC coupled or for where an accumulating bias toward one state or the other would would cause the receivers used in the path to saturate toward one side or the other.
Manchester encoding extracts a price for its use because it requires two times the bandwidth of the actual data rate being sent through the communications channel. There are a number of other serial type protocols that help to lower this "cost" by being designed for less than the 2X bandwidth requirement. The various schemes add compensating patterns to the data flow that so that the average level of the signal stays at zero over a longer period of time than the one bit interval used by Manchester.
Pulse interval encoding is commonly used for IR encoding with remote controls. They get by with this at the receiving end in one of two ways. The messages sent are short compared to the repeat time between messages which allows the receiver to relax to the center of its detection range between messages. And some IR encoding protocols include both the true and inverted copies of the data in the message packet sent which helps to average the receiver. It is interesting to note here that Manchester encoding is actually used in some IR remote protocols including the Philips RC5 encoding. |
H: Connectorless MicroUSB or miniUSB on PCB: Feasible?
This question extends upon "Connectorless USB on a PCB". Our requirements are for a smaller connector than standard USB, and also 5 leads instead of USB 1.0's 4. The connector will be used perhaps twice in the lifetime of the board, for ICSP / JTAG programming / firmware updates. The product is a low-cost throwaway device somewhat like the DigiSpark.
Edit: Also, the connector will be inaccessible without breaking open the enclosure, so it is production-access-only. If end-customers break open a $5 toy, well, they have earned the right to destroy or reprogram it!
Cost and added height of adding a connector of some sort, such as a microUSB socket is highly undesirable.
We would like to do our programming / update using a standard USB to MicroUSB cable such as is shipped with many modern smartphones, plugged into a configuration & testing board (not an actual USB port).
Edit: [28-Oct-2012]
It turns out that microUSB is not viable, if only because of the thin PCB required.
USB 1.1 / 2.0 are not viable due to having only 4 contacts on the USB-A end: Thanks @DaveTweed!
Top 5 contacts of USB 3.0 Type B cable (image) appear PCB friendly, so question remains open
The questions:
Has anyone had success using such a connector etched onto a PCB? Could you share a link please?
What thickness of PCB would we have to go into production with, for such a connector to work?
Is there any available reliable footprint we could use for such a connector?
What else would we need to keep in mind - such as board cutting/milling tolerances, stiffness of PCB, rounding of "connector" corners, ...
SOLUTION: Added here for reference.
The solution that worked out best for us was a 3M SOIC narrow test clip, which has 7 contacts to a side, and a conventional IDC 0.1" cable going back to our programming board.
No additional milling is required, half of a standard SOIC pad footprint close to the edge of the board, with solder bumps on the pads, works out perfectly, and the clip grips the board firmly. Varying PCB thicknesses have been tested, they all work fine.
A bit of a convenience hack we added: Positioning two of the nearby components equidistant from either edge of the SOIC "programming pad footprint" ensures that the clip can be attached very quickly and perfectly aligned to the pads.
In laying out the programming pad pins, we ensured that a misalignment of the clip would not cause any problems either due to shorts or problematic signal injection. Needing only 5 of the 7 pads simplified this reshuffle.
Hopefully this solution would help others with similar requirements.
An observation: Pogo pins suitable for 0.05" spacing worked out way too expensive compared to the SOIC test clip approach.
AI: If this is for production access only, then here's a trick I used once. The PCB (standard 0.062" thickness) was designed with SMT pads along one edge (both sides) so that a 2×7 0.100" JTAG header could be soldered to it, with the pins sticking out from the edge. This was useful for debugging prototypes, which needed more or less constant access to the JTAG (and weren't in cases).
In production, the connector is omitted, and I used a slightly modified DIP clip to access the pads for the connector. I just needed to bend the contacts inward a bit to get adequate friction and contact pressure.
Instead of the DIP clip, you could use a standard card edge connector as well. |
H: What "rule of thumb" to use for mapping -3dB frequency to ideal response for 2nd order Sallen-Key?
For a first order passive filter (RC circuit), we often reach for a the familiar 10X rule. If the -3dB corner frequency is f, then "ideal" frequency response starts at 10f.
What similar factor can be used for a second order Sallen-Key filter which is critically damped (C2 = 2C1)?
If, say, the -3dB roll-off of such a low-pass filter is at 25Khz, until where do we consider the frequency response to be as flat as we would by the 10X rule for RC filter for the same corner frequency?
AI: There's many ways to answer that, here are some to throw out ideas:
1) since it is a second order filter with 2X slope per octave then you can argue that it should be sqrt(10) X.
2) typically though that measurement might also take into account the ripple and constrain it so that a fixed factor may not be apropos. In your case of critically damped this doesn't hold, but in a more general sense perhaps a simple factor isn't the right criteria.
3) Since I work with S&H system and switched cap we don't use a 10X but how many time periods until settled to within the error budget of the system (so it's variable depending upon what is being designed). |
H: USB data sniffing cable
I am looking for a way to sniff the data running between a PC ("A") and a USB device ("B") by using another PC ("C").
To do this, I spliced the cable going from A to B and soldered another USB cable to create a Y splitter and ran it to C, thinking the signals will be duplicated.
What happened was the two PCs A and C fought over the control of B (should have seen that coming...) and all hell broke loose.
I have a couple of assumptions/ideas I would like to run by you:
1. Can I disconnect the VCC and GND wires on the sniffing cable, so that C will not try to control B?
2. Can I place a diode on the D+ or D- wires of the sniffing cable of to make the data flow only one-way?
3. Will I be able to read the data off the USB port in C?
Any comments/suggestions will be greatly appreciated.
(Disclaimer - I am a NOOB to USB so go easy on me)
AI: What usb-versions do you want to support (specifically, do you need usb3)?
To answer your current question/idea:
Can I disconnect the VCC and GND wires on the sniffing cable, so that C will not try to control B?
Yes, unless your sniffer runs on the host-supplied power
Can I place a diode on the D+ or D- wires of the sniffing cable of to make the data flow only one-way?
D+ and D- are differential data (the base-voltage-levels indicate to the usb-device the maximum amount of current it may draw). So.. the diodes are useless for your application. Especially since your sniffer MUST run in 'promiscuous mode'.
Will I be able to read the data off the USB port in C?
If you build a sniffer, then yes, but not with the simple splitter-cable you have in mind.
Also note that USB3 is finally bi-directional (where as previous versions where not).
Also note that USB2 is already 480Mb/s and this might (depending on your computer C) be a lot or impossible to capture as a stream. Now USB3 will be around 5Gb/s...
So if you'd want to build a sniffer of your own, you'd be looking at a differential data buffer capable of at least 480Mb/s, and some processor to handle the copy of the data and store it in memory, then have your computer C download the captured data.
Oh, and don't forget, you'd need software on your computer do do something usefull with the captured data.
The data is encoded with NRZI. A 0 will make the signal flip sign and a 1 will keep the same signal level. If a 6bits of 1 are sended an additional 7th bit (0) is send to make the signal flip. Adding this dummy bit is called bit-stuffing and is used to keep the clocks of the host and client in sync. The clocks are generated from the data signal.
When the signal is received the NRZI is decoded and bitstuffing removed. Then the controller will detect the USB packet start (start with a synac field). The packets are buffers which are called endpoints.
CRC is applied to the packets to maintain data integrity. When an error is detected this will be flagged and the corrupt packet will be discarded.
UPDATE:
Please read this answer that details some very interesting options that might help you with software-only solutions, like in vm-ware or wireshark, depending on what information you need:
A. Physical (electrical signals)
B. The bitstream (which is just the differential between D- and D+)
C. The USB packets
D. The USB descriptors and the USB data |
H: Long range proximity sensor (30m+)
I am looking for a sensor that could be mounted on the front of a car, to tell the distance to the car ahead, to detect safe driving distance.
I was thinking of the possibility of a laser perhaps, but I am unsure of where to get a sensor like this, or if I am going to have to build my own.
What are some feasible and inexpensive ways/products to sense this distance?
Please note, I do not intend to break the rules by asking for specific products, I am just asking what should I search for.
AI: Pretty sure they use radar for adaptive cruise control in cars. Check this sensor out:
I've heard them called "headway sensors" or "radar headway sensors". There are other technologies like acoustic but I'm not sure if they'll have the range you're looking for. Laser could work but it's aim is pretty narrow, dust dirt and fog can get in the way etc.
Good Luck! |
H: Simple op-amp differential amplifier
EDIT: Thanks everyone, I got it to work:
Now if only I could accept multiple answers...
.
.
.
Is the output of this op-amp circuit linear in input voltage? The last equation \$A = \frac{R_f}{R_1}\$ seems to imply the output is linear but when I simulated it in multisim with a sine wave input, the output was either a sine with an amplitude of 0.1V or a square wave with amplitude of 4V for small changes in input amplitude. How can I keep the output linear?
I am trying to amplify a 10µV to 100 µV differential signal to at least 1V using an analog amplifier so that I can measure it using an ADC such as the one on an arduino. Is there an easier way to do this with only a few parts?
Frequency range: 8Hz to 50Hz
The opamp I used in multisim is OP497 (this was the first one I found in the multisim catalog that had a DIP package)
edit: I flipped the op amp and now the output seems linear but the peak to peak output voltage is only 45mV. Shouldn't it be much higher than the input?
Input in simulator: 20Hz sine at 500mV peak, 500mV offset
Screenshot:
AI: I think you've got your opamp "upside down" in your schematic though it's hard to tell for sure due to the coarse resolution of the image. But it does look like your feedback divider is connected to the non-inverting input rather than to the inverting input.
If so, you've got something like a schmitt trigger circuit there rather than the difference amplifier you intended. |
H: What is the name of this connector?
These rectangular 2x5 and 2x3 pin connectors seem to be commonly used for flat ribbon connectors. This example is from an AVRUSB programmer. What is the name of this style connector?
AI: It's an insulation-displacement connector (IDC). |
H: Delay in Combinational Logic Circuits/Stability
What does it mean for an output signal to be stable? Is my understanding correct that when an input to a logic circuit changes, the time delay for the signal to reach the output (the time for the output to reflect the change) is directly proportional to the number of gates the signal must pass through? So is it simply that an output is stable when that time delay has finally passed? My textbook uses a 1-bit adder as an example.
AI: Yes, you've got it right. In digital logic, the circuit is stable after it's stopped changing due to a change in the inputs.
the time delay for the signal to reach the output is directly proportional to the number of gates the signal must pass through?
Except for the fact that the delay of different gates might be different, this is correct. For example, an AND gate might have a longer propagation delay than a NAND gate.
edit
As Michael points out in the comments, there are other factors affecting the delay. I answered the question thinking mostly about discrete TTL or CMOS logic designs. Even then, factors like the fan-out from each gate will affect the path delay.
In FPGAs the situation is much more complicated. First because there's no 1-to-1 correspondence between the basic gates (AND, OR, etc.) and the implementation in the FPGA. Second because the speeds you can achieve in an FPGA are much faster than in discrete logic, so relatively small effects start to have a more significant impact in the overall design. |
H: How do you determine the input impedance for an inverting amplifier?
Essentially I am getting confused trying to do the sums for an op amp with a gain of 10dB and an input impedance of 1kohm.
I worked out that \$\frac{V_{out}}{V_{in}}=-\frac{R_{2}}{R_{1}}\$ because \$V_{+}\$was going to ground, \$=>V_{-}=0\$.
I know that the output impedance of the amplifier itself is very high.
I know that the compensation resistance \$R_{3}=\frac{R_1R_2}{(R_1+R_2)}\$ but I am not certain why.
I had thought the input impedance would be the \$R_1||R_2\$ (or whatever else would go to the node for \$V_-\$ which in this case is just \$R_1\$ and \$R_2\$) but I am doubting myself.
Can anyone clarify what this input impedance is actually referring to?
I should also perhaps add that I am going to construct this for real out of a 741 amplifier so I am trying to figure out what resistances to pick to get my 1000 \$\Omega\$. I can't believe that \$R_2\$ wouldn't matter in this, so if anyone can clarify that, it would be useful.
AI: @DaveTweed wrote a good verbal proof for \$R_{3}=\dfrac{R_1R_2}{R_1+R_2}=R_1||R_2\$.
Here's an algebraic version.
Let's drop the ideal op-amp assumption that op-amp input currents \$I_{b+}\$ and \$I_{b-}\$ are zero.
\$I_b=I_{b+}=I_{b-}\neq0\$
In practice, \$I_b\$ can vary between different batches of ICs. \$I_b\$ isn't known. Let's assume that it's fixed.
First, consider the case without compensation resistor, \$R_3=0\$.
\$\dfrac{V_{in}}{R_1}+\dfrac{V_{out}}{R_2}+I_b =0\$,
\$V_{out}=-V_{in}\dfrac{R_2}{R_1}-I_bR_2\$
Notice the \$I_b R_2\$ nuisance.
Second, consider \$R_3\neq0\$. Let's find \$R_3\$ such that \$V_{out}\$ is closest to \$-V_{in}\dfrac{R_2}{R_1}\$
Voltage at the positive input: \$V_{(+)}=I_bR_3\$
\$\dfrac{V_{in}-I_bR_3}{R_1}+\dfrac{V_{out}-I_bR_3}{R_2}+I_b=0\$
\$\dfrac{V_{in}}{R_1}+\dfrac{V_{out}}{R_2}+I_b\left(\dfrac{R_3}{R_1}+\dfrac{R_3}{R_2}-1 \right)=0\$
Notice the \$I_b\left(\dfrac{R_3}{R_1}+\dfrac{R_3}{R_2}-1 \right)\$ nuisance. Let's equate it to 0 and solve for \$ R_3 \$.
\$I_b\left(\dfrac{R_3}{R_1}+\dfrac{R_3}{R_2}-1 \right)=0\$, when \$\dfrac{R_3}{R_1}+\dfrac{R_3}{R_2}=1\$
which can be solved for \$R_{3}=\dfrac{R_1R_2}{R_1+R_2}=R_1||R_2\$
Extra:
I made an assumption that \$ I_{b+}=I_{b-} \$ (the input currents are equal).
How good is this assumption?
The average of the input currents is called the input bias current \$ I_b = \dfrac{I_{b+} + I_{b-}}{2} \$, and the difference is called input offset current \$ I_{OS} = I_{b+} - I_{b-}\$.
\$ I_b\$ and \$ I_{OS}\$ are mentioned in the datasheets. Usually \$ I_{OS}\$ is significantly smaller than \$ I_b\$. For example, LM324 has \$ I_b\$ = -60 nA max and \$ I_{OS}\$ = ±5 nA max.
The output error due to input currents
\$ E_O = \left(1 + \cfrac{R_2}{R_1} \right) \left( \left( R_1 || R_2 \right) I_{b-} - R_3 I_{b+} \right) \$
Substituting \$ I_{b+} = I_b + \cfrac{I_{OS}}{2}\$ and \$ I_{b-} = I_b - \cfrac{I_{OS}}{2}\$ , then factoring out \$ I_b\$ and \$ I_{OS}\$ .
\$ E_O = \left(1 + \cfrac{R_2}{R_1} \right) \left( \left( \left( R_1 || R_2 \right) - R_3 \right) I_b - \cfrac{1}{2} \left( \left( R_1 || R_2 \right) + R_3 \right) I_{OS} \right) \$
Like before we choose \$ R_3 = R_1 || R_2\$ .
The \$ I_b\$ term collapses and the error reduces to
\$ E_O = \left(1 + \cfrac{R_2}{R_1} \right) \left( - R_1 || R_2 \right) I_{OS} \$
The error can be reduced further by reducing the values of \$ R_1\$ and \$ R_2\$ while
preserving the ratio \$ R_2 / R_1\$ . |
H: Ideas for attaching / connecting / stacking one PCB onto another with no gap
What methods might be feasible for attaching/stacking one PCB immediately on top of another PCB, with the following conditions:
Zero spacing/gap between the two PCBs
Electrical contacts are needed, not just physical attachment
Assume that the top PCB is about a third the size of the bottom PCB
I'm at the early design stage of a project and am trying to survey the options first, so I'm open to recommendations of standard methods as well as any creative ideas.
Note: I'm already familiar with edge castellations (AKA "half vias"), so other suggestions would be of interest.
For instance, is it possible to design it such that the top PCB has pad-contacts only at the bottom (QFN/QFP style) which are somehow solderable onto pads on the bottom PCB?
EDIT: To answer @Andrew's question:
My purpose of stacking the two boards like this is that the Top PCB will be variable across variants of my device (in fact, variable not only in what the Top PCB contains but also size and number of contacts it has), hence the goal of having one constant Base PCB with pads onto which I can attach a variable Top PCB.
AI: This is not a direct answer to your question, but I think it's quite relevant.
A few years ago, we did the same thing. We made little daughter boards that used edge castellations to solder it onto the mother board.
The difficulty was that we had components on the bottom side of the PCB. These were the vital decoupling capacitors needed by the chip.
So the motherboard had very large vias to accommodate these components.
You can see several large round holes in the PCB. Through the holes you can see the capacitors on the flip side of the daughter boards. Since the holes are just large vias, they end up through-plated (our supplier doesn't offer unplated holes), so you have to be careful that the plating doesn't short any pads on the daughter board.
A few thoughts about using pads under the PCB. I assume you mean something like this Telit HE910 module:
Which reflow solders directly onto a PCB. Notice that in the picture the gap between the module and main PCB is not zero, but certainly less than 1mm. Clearly this technique works. Whatever components are inside the module don't mind undergoing an extra reflow process. This is because components can usually survive at least two reflows (once for each side of the board). Since those modules only have components on one side of the PCB, they have almost certainly experienced only one reflow.
Instead of reflow, you might be tempted to use a hot plate to solder a module like this. This would enable you to solder the module down without getting the components inside the module too hot. However, I would advise against this method. At the moment the solder solidifies, the mother PCB will be much hotter than the daughter PCB. As the mother cools and shrinks, it will generate shear forces in the solder joints, and may warp. |
H: Mux for ultra low noise pre-amplifier
I am searching for a method for multiplexing 3 DC voltage sources (each ±10V p-p) to my ADC pre-amplifier circuit.
My requirement is that the multiplexer should not inject excessive noise into the readings. It should be as noise free as possible, like 1 µV peak to peak max.
I'm considering building my multiplexer with switches or relays. For switch ADG1401 looks promising (however, in the data sheet I couldn't find noise related data)
Can a relay be more noise free? Do you have advice about other solutions for this requirement?
AI: A relay is your right choice unfortunately (because they wear out and are noisy). I know for a fact that systems that use SQUID magnetometers use relays simply because of low electrical noise. We used reed relays for the low parasitics and good signal flow. |
H: What type of silkscreen ink is used in PCB manufacturing?
Let's say I'm looking to start my own PCB manufacturing company* and I have everything figured out except how to silkscreen the boards.
Where do I get silkscreen ink from?
Is there a special type of ink specifically for PCBs?
What type of properties would I be looking for in a good silkscreen ink?
Can the inks be tinted to create any color I wish?
Of course, I've Googled, but many results deal with silkscreen printing for fabrics and I'm not sure how much of that info applies to PCB manufacturing. Thanks. *I'm not. :D
AI: Try 'Epoxy Ink PCB Screen Printing' in your favorite search engine.
Here's one source, and the ink description gives away the desirable properties regarding substrate supported, adhesion qualities, curing process and immunity to acid/alkali treatment.
Du-Pont PCB silkscreen inks
Nazdar
Another co. I had never heard about
PS: No personal experience with those. For low volume usage, and DIY silk-screen, I believe people have used inks used for ceramic painting, which need to be cured at high temperature. |
H: Name of component on output side cable of a DC power adapter?
What is the name of this component (circled in red) of a charger?
What are the uses of this component?
AI: This EMI Common Mode (CM) choke absorbs noise with lossy ferrite in a cylindrical shape.
In this photo a DC-DC converter, it will be high permeability perhaps optimized in the 1~40 MHz range.
All VGA cables have to suppress the DAC video pixel noise from 40 to 300 MHz range which affects the choice of ferrite to lower permeability types.
There are hundreds of varieties of ferrite compounds and hundreds of varieties of cylinder shapes. The method of attachment can be assembled by the cable mfg as a cylindrical sleeve, prior to plug attachment and then plastic molded casing is applied to this and the plugs. Similar to the snap-on clamshell perfected by TDK, Tokin and others.
This is useful for all types of cables with pulse noise to improve integrity of high impedance signals as well as reduce interference of both ingress and egress for passing EMC tests. Their product is precision machined and tightly clampled to avoid acoustic vibrations often requiring epoxy in other designs to avoid vibration. |
H: How to store parameters on a microcontroller
I'm currently working on a Project which needs to store some values (in the form of parameter lists). These values can be of some defined types (uint32, char[], ...).
Now I would like to make these parameter lists persistent, meaning I want to load and save them.
I also want to be able to "download" them to the computer and edit them there, then upload them again to the device which will then use them.
Until now, I have used a simple text file which features Key-Value pairs such as:
EnterTime=18.0\n
DisallowTime=3\n
EnterMessage=Hello this is me\n
ExternalPhoneNumber=+1212345678
...
Yet, I think that there must be a better approach. Space is not a real problem, but I'm not sure if I want to switch to XML, I don't think that would be a better approach.
Any ideas on this? How do you handle such a situation?
Kind regards
Thomas
AI: XML may be a better approach when you want to share your data through web and internet
or make it inter-operable with another application. If you using a single standalone
application and you don't have tree like data structure to be stored, My suggestion is to
use simple key value based file that you already came with.
There are ready-made libraries for you to parse your such text files.
Take a look at this: http://cfgparser.sourceforge.net/
Or you could simply code a recursive decent parser by yourself. |
H: LPT circuit switching
Is there a short tutorial describing simple, low voltage circuit switching using the LPT port?
I know it could be done using USB or RS 232 relays, but I would like to assemble it with (buying) minimum or none electronic components, except things I have: an LPT cable, a LED diode or a fan, and a 12 V adapter.
AI: This is one way:
Parallel Port Controlled LEDs |
H: Unwanted current thru transistor
I have the following circuit:
What the circuit should do:
When switch SW1 is open, D1 is OFF and D2 is ON
When switch SW1 is closed, D1 is ON and D2 is OFF
The circuit works almost well. The only problem is, when switch is open, D1 instead of being completely off, it's slightly lit. At some point, I've remove Q1 and D2 completely, but D1 was still slightly lit.
What can be the problem ? Any ideas on how can I fix it ?
AI: What can be the problem ?
With SW1 open, the path for Q2 emitter-base current is through R2, D1 and R3.
Any ideas on how can I fix it ?
The above circuit uses one less transistor but consumes more than twice as much power when L1 is on than when L2 is on. It would be straightforward to add another transistor and resistor to "fix" that. The value of R3 should be determined experimentally. |
H: Is a relay one way?
I'm no electrical engineer, so maybe this is a stupid question.
I want to make my own alarm system using a netduino board.
I bought a couple of motion sensors for mounting into my ceiling.
The problem I see is that these sensors are designed to directly switch a light source (they use 220v). I would like to use them to signal my arduino that something was detected.
Perhaps using this.
I know that a relay is used to switch a high voltage circuit from a low voltage circuit.
My question: Can a relay also work the other way around, meaning that the high voltage switches my low voltage circuit? Or do I need to buy another type of component for this situation?
AI: The relay shield that you linked to is a device that allows the microcontroller to manage the coils of four relays. The coils then operate sets of contacts to allow the switching of external circuits. This control flow would be OUT from the microcontroller. This shield is not useful to your application.
Your application wants the motion detector to drive an INPUT to the microcontroller board. If the sensor only has provision for turning a light on and off at 220VAC then you will have to adapt the sensor with either a detector circuit that can sense the AC on from the sensor or deploy a relay. The relay would need to have a 220VAC coil that you would wire in place of the motion detector light or wire in parallel with the light. When the light would normally turn on the relay coil would energize and pull in the relay contacts. The switched contacts can be wired over to the microcontroller board to an INPUT pin so that the programmed code can detect that the motion detector has the "light" on or off.
With careful wiring to make sure that the relay coil connections are separated and insulated from the relay contacts you should be able to connect safely directly to the microcontroller (MCU) inputs with the relay contacts. Setup the INPUT with a 1K --> 4.7K pullup resistor to the VDD of the MCU and then connect the relay contact pair to the INPUT and to GND. |
H: Bench Power Supply Design
I've been thinking about designing and building my own bench-top power supply for general use. I envision the primary use to be with prototyping low-power analog/digital circuits with the occasional small DC motor and other electro-mechanical devices. The primary reason I'm doing this is to become more familiar with power supply design, and having a useful bench-top supply is an added bonus.
Target specs and device goals so far, recommendations/suggestions are welcome:
Powered from mains electricity (I live in the US, so I'm targeting ~120VAC@60Hz).
Mains isolated.
Variable voltage and current output, at least 1A max output current and 12V max output voltage. Preferably I'd like a 15V or 24V max output voltage as well as split supply, though these aren't critical specs.
Decent efficiency. I haven't quite spec'd out a target efficiency yet, but I would expect greater than 50% efficiency. I've heard of SMPS supplies going up to ~80-90%, possibly higher.
Since this is taken as primarily a learning exercise, I've been seriously considering if I should turn this project into one where I can learn more about using mains electricity directly. I'm hesitant to do so because I understand the very real danger involved with getting something wrong on mains and I could use a wall adapter (either AC-AC or AC-DC) or pre-built constant voltage unit to power my supply to reduce the risk associated with working with mains. I'm curious as to what you guys think about this, as well as any recommended resources I should check out before working with mains directly. If you have any suggestions for projects which would be better suited for a beginner working directly with mains that'd be great, too.
If I did choose to go with the direct mains method I think I'd starting out with a basic transformer to provide isolation and reduce the input voltage, then use some circuitry to get adjustable voltage/current.
The basic interface with the mains:
The main side is tied across the one side of the transformer, and the powered circuit is tied to the other side. The signal is then rectified through a diode bridge, and the output is filtered using a large capacitor in parallel with the load. If I wanted to, later down-stream I could use circuitry to further regulate the output voltage and current (something similar to what is done here).
The voltage across the load should be (assuming a sufficiently small load or large capacitor, as well as a near-ideal transformer):
\begin{equation}
V_L = V_{main} \cdot \frac{N2}{N1} - 2 * V_D
\end{equation}
Where Vmain is the amplitude of mains electricity (~170 V in the US).
This is a basic design which works in theory, but what real-world considerations do I have to take into consideration when designing the actual interface with the mains electricity? I know that a highly capacitive or inductive load will result in a poor power-factor, but since this is a general purpose power supply I'm assuming that whatever load gets attached down-stream will be designed to compensate for that rather than try to have the power supply do the compensation.
An alternative approach is to use a switched-mode design, but I haven't found many useful resources on how to design/implement one. From what I understand a SMPS uses much higher frequencies so the transformer can be smaller while still providing a semi-stable DC output. What I don't understand is how you're suppose to take the 60Hz signal from the wall and up that to a ~10kHz or even ~1MHz input for the SMPS transformer.
AI: You have the right idea for a basic unregulated supply. A transformer, four diodes, and as large a cap as you can manage will serve well enough for a lot of purposes, but isn't appropriate for all.
There are two main problems with such a unregulated supply. First, the voltage is not known well. Even with ideal components, so that the AC coming out of the transformer is a fixed fraction of the AC going in, you still have variations in that AC input. Wall power can vary by around 10%, and that's without considering unusual situations like brownouts. Then you have the impedance of the transformer. As you draw current, the output voltage of the transformer will drop.
Second, there will be ripple, possibly quite significant ripple. That cap is charged twice per line cycle, or every 8.3 ms. In between the line peaks, the cap is supplying the output current. This decreases the voltage on the cap. The only way to decrease this ripple in this type of design is to use a bigger cap or draw less current.
And don't even think about power factor. The power factor a full wave bridge presents to the AC line is "not nice". The transformer will smooth that out a little, but you will still have a crappy power factor regardless of what the load does. Fortunately, power factor is of little concern for something like a bench supply. Your refrigerator probably treats the power line worse than your bench supply ever will. Don't worry about it.
Some things you can't do with this supply is run anything that has a tight voltage tolerance. For example, many digital devices will want 5.0 V or 3.3 V ± 10%. Your supply won't be able to do that. What you should probably do is aim for 7.5 V lowest possible output under load, with the lowest valid line voltage in, and at the bottom of the ripples. If you can guarantee that, you can use a 7805 regulator to make a nice and clean 5 V suitable for digital circuits.
Note that after you account for all the reasons the supply voltage might drop, that the nominal output voltage may well be several volts higher. If so, keep the dissipation of the regulator in mind. For example, if the nominal supply output is 9 V, then the regulator will drop 4 V. That 4 V times the current is the power that will heat the regulator. For example, if this is powering a digital circuit that draws 200 mA, then the dissipation in the regulator will be 4V x 200mA = 800mW. That will get a 7805 in free air quite hot, but it will probably still be OK. Fortunately, 7805 regulators contain a thermal shutdown circuit, so they will just shut off the output for a while instead of allowing themselves to get cooked. |
H: How would I design a simple logic circuit for 3 input bits?
All -
Suppose I have 3 input bits
Bit #0
Bit #1
Bit #2
I need to design a logic circuit has follows:
Input: Bit #0 = 1, Bit #1 = 1, Bit #2 = 0
Output: 0
Input: Bit #0 = 1, Bit #1 = 0, Bit #2 = 1
Output: 1
Input: Bit #0 = 0, Bit #1 = 1, Bit #2 = 0
Output: 1
Input: Bit #0 = 0, Bit #1 = 0, Bit #2 = 1
Output: 0
I know it's going to be a combination of XOR gates, but I'm not able to construct something that works for all 4 cases above.
Is there any software that can generate a simple logic circuit that satisfy the input/output conditions above?
I would appreciate all / any help.
AI: We normally present this kind of requirement in a truth table.
I'll assume that for the input combinations you didn't specify in the question, you don't care what the output is. In the truth table, we'll represent this with an "X".
Then you have a truth table like this:
IN2 IN1 IN0 | OUT
---------------------
0 0 0 | X
0 0 1 | X
0 1 0 | 1
0 1 1 | 0
1 0 0 | 0
1 0 1 | 1
1 1 0 | X
1 1 1 | X
You can easily realize this truth table by simply XOR'ing bits 0 and 1, and ignoring bit 2. |
H: Test electronic speed control (ESC) using a servo tester
I'm trying to test my 20A Hobbywing Skywalker electronic speed control (ESC.)
For that I bought this servo tester from eBay.
I'm a bit confused about the servo tester input. Shouldn't it be just supply power? What is that third pin (signal) on the input side?
Can I check the ESC without supplying it with power and connecting a motor?
AI: I have the same servo tester: The input does require just the supply voltage to be provided. The PCB trace for the S pin is not connected to anything else on the circuit board.
It appears that the 3-pin connector has been used by the designer to accommodate customers whose only source of a 4.8-6 volt supply is a servo connector from either a battery pack or some other servo control equipment.
The third pin does provide improved structural stability compared to a 2-pin connector which would be prone to shear or lose grip due to accidental pulls on the wires, or rough use. However, I would hesitate to state that this was one of the thought-through reasons for the design decision. |
H: What does "full array operation" mean for EEPROM?
What is full array operation as shown in data sheet of AT24C08B: Two-wire Serial EEPROM (page3)? What is application of that full array operation? Please help to clarify.
AI: The Write protection pin prevents the memory from being written on. In page 3 the datasheet explains that asserting (pulling high) that pin makes the whole memory array to be protected from write operations. |
H: Is SystemVerilog string manipulation synthesisable?
I learnt that SystemVerilog provides a string datatype, which allows for many string operations, such as comparison, concatenation, length, etc.
Are those string operations synthesisable?
AI: As I understand it, hardly anything in SystemVerilog is synthesisable; it's intended for use in testbenches and simulations. |
H: Radio Control Electronic Schematic
My friend, who is interested in jet engines and welding is getting is working on a jet car, or something along that lines. I am just working on the electronics because I like the circuit building and like to understand how that works. I am wondering how controlling motors or relays or solenoids with a remote controller can work and how I would build this. I am thinking that maybe one frequency will control one output, and a slight frequency change will control another output. I may be totally wrong, but I want to control 3 or four outputs with radio control. I also want to be able to change the frequency from something like a couple different so if i have interference from like military or fm, i can change it. So maybe like 20 Mhz to 90 Mhz. (I know the FCC doesn't want me to broadcast at other frequencies being used and RC is only allowed 29 and 47 MHz, but I am not worried about the Law, and pretend I am doing this on Pluto, where I don't have to worry about the interference, and this is just a QA website, so don't mention the FCC)
So My question is how will I transmit a signal from a Radio Controller with a few pushbuttons and Have a radio Receiver pick up the signal and convert it to a signal a motor can read. I know that I will be using transistors to be amplifying the signal coming in, and I am trying to stay away from Ic's that you program with a computer because I like understanding how they work, like logic gates and transistors as amplifiers, not just CODE because I am not satisfied with programming something and not understanding how it works.
So Any information on Radio Control, how it works, and how to use the circuits will be great, because google hasn't helped me at all, and isn't even close to helping me understand the theory of radio control, or how to do this. I know without a MicroController the circuit will get complicated, but i will be willing to take the extra step to understand how it works.
I probably don't know what I am talking about and I am only 14, so sorry about making the question really horrible, and long, but any information will help.
AI: Nowadays, you don't just broadcast each signal on a different frequency. You send a digital stream that includes instructions for whatever you want to control. For example, a number proceeded by a 1 byte might control valve 1, a 2 byte valve 2, etc. You have to figure radio messages will occasionally get garbled or only partly received, so usually you send a packet of bytes followed by a checksum. The receiver ignores the whole packet if the checksum is not consitent with the rest of the packet. All this will include using a microcontroller in the transmitter and in the receiver. Once you have that, there are various chips that can do the digital RF communication between the two.
However, a much simpler way for you to just get things done is to use off the shelf hobby RC controllers and receivers. These take care of encoding the desired position of several "hobby servo" motors in the transmitter and decoding this in the receiver. You don't need to care how it is done. You move a joystick or lever in the transmitter, and a motor arm moves in the receiver accordingly. You can hook those up to whatever you want to control on the jet engine. |
H: Are there many logic circuit solvers available to test / download?
All -
I have found something called "Simple Solver" located here:
http://home.roadrunner.com/~ssolver/syn.html
and you can download it here
http://www.softpedia.com/progDownload/Simple-Solver-Download-103308.html
My question is: Is Simple Solver the only one out there that solves digital circuits for you given inputs / outputs you want? Is there other software besides Simple Solver that will solve digital circuits?
Would appreciate all / any advise.
AI: Yes. By "solve" it appears to mean generate gates. All FPGA and ASIC synthesis tools do that. As The Photon said, this includes free tools from FPGA vendors. |
H: Is there any such logic gate that accepts inputs from both sides and also stores information within the gate itself?
I'm trying to design a logic circuit that will end up looking a binary tree (there will be a "root" logic gate at the top and a whole bunch of "leaf" logic gates at the bottom).
Input is fed as bits into the leaves and the outputs are passed upward towards the root. But at any time (not necessarily at the root) the flow could change direction and they need to "follow" the path where they came from down to the leaf where they originated from.
I feel like the only way to create "breadcrumbs" is to create a storage bit at each gate indicating either right or left down the tree, leading to the leaf node.
Am I way off in my thinking here? Is it possible to have inputs go upward towards a root logic gate and then reverse the direction and go back to the leaf logic gate?
AI: The logic that accepts and stores input is a "flip-flop". If you wish to store from either "side" you can have a 2:1 multiplexer that selects between the 2 inputs. |
H: How hot does a voltage regulator get?
Since I've always did electronics through my Arduino and I feel I'm pretty much a beginner, I've never used a voltage regulator before. I want to create this circuit, but I want to hide it in my printer so I want it to work without a battery.
http://hacknmod.com/hack/beginner-spy-tutorial-your-first-diy-mini-fm-bug-transmitter/
I am planning to put a 3 V voltage regulator on it, but I wonder how hot a voltage regulator can get if the maximum voltage is used. And should I be worried about the heat, as in should a try to cool it?
AI: The heat produced by a voltage regulator isn't a function of the voltage, it's a function of the power.
You can calculate the power the voltage reg will dissipate by taking the voltage-drop across the regulator, times the current flowing through the regulator.
E.G: $$Power = Volts * Amps$$
In other words, if you have a 30V source, and your device is running off 3V, you have \$30V - 3V = 27V\$ across the regulator. However, if your device is only drawing ~3 mA:
$$27V * 0.003A = 0.081W$$
You would only have a dissipation of 81 milli-watts, which wouldn't even get too warm to the touch.
However, if you have a 5V input, with a 3V output (giving 2V across the regulator), yet your deice is drawing 1A, you have:
$$2V * 1A = 2W$$
You have a power dissipation of 2 watts!
Basically, there is more involved in evaluating heat production then just the voltages |
H: VHDL - How does a process run concurrent with other processes and components while it executes sequentially?
Just as the title says, how does this occur? I'm trying to wrap my head around processes vs components and I don't understand how this mechanism works. This may not be a proper question so please help me formulate it to be more specific, but I just really need to understand this concept to keep moving forward in my design.
For example:
count: process (x)
variable cnt : integer := -1;
begin
cnt:=cnt+1;
if (cnt > '9') then
cnt:=0;
OVERFLOW <= '1';
endif;
end process;
I understand that the if statement is dependent on the previous increment statement. I also understand why order is important (logically it makes sense - I check condition after updating), but what doesn't make sense to me is without any kind of clocking or other sequential mechanism, how does OVERFLOW (which is a signal in this example, not shown) get it's value updated concurrently with all the other signals in the design when it depends on cnt being updated first? Furthermore, any other signals which have implied processes associated with OVERFLOW are assigned concurrently, making them dependent on cnt by proxy as well.
AI: Signals are always evaluated in a concurrent way. Variables are really just a convenience for making calculations or used as helpers in loops or generates. In general, they contain combinatorial evaluations or are used as iterators. In that sense they produce synthesis, but the sequentiality in their assignment is not synthesized per se, they will never make a signal change more than once in a single pass of a process (signals retain the last value assigned to them in a process).
This phrase that I use "single pass of a process" sounds very academic, and does not properly convey its relationship with hardware (hardware in this context being basically logic gates and flip flops). The process is evaluated when any signal in its sensitivity list changes. What this means in hardware is that the inputs to a combinatorial block changed, therefore it may be possible that the output or outputs of this block change as well. A signal may be assigned multiple times in a process, but this is only a way to code priority in evaluations (in describing how the combinatorial block works), not actual changes in the outputs in sequential manner. That is why it is said that the signals retain the last assignment in a process.
The best way to understand all this is to see how digital blocks that you can see in a schematic are coded in vhdl (or the language of your preference). When you get the hang of it, and start using variables as 'helpers', you'll see why they are what they are, why they are not the same as signals, and why the sequentiality in their assignment inside processes is not synthesized as such. |
H: Why ARM CPUs are not used in servers and desktops?
I was wondering why ARM CPUs are popular for mobile and other portable devices but not on desktop/server computers? The only thing I know is that ARM CPUs consume much less power than x86 processors. This is a good argument in favor of using it on mobile devices but also on desktop/servers. Yet it is not so widely used. Is it the instruction set or performance or smth. else?
AI: From what I see:
Software compatibility (for most people, a desktop PC that can't run x86 software is a definitive no-no).
Even the fastest ARM CPUs are often slower than x86 CPUs. From here (which links to this Phoronix article):
In a nutshell, the system with a 1 GHz TI OMAP 4460 dual core processor came out ahead of the netbook with a 1.6 GHz Intel Atom N270 chip in some of the benchmarks, and came out behind in others.
Power consumption is not really the biggest concern on a desktop computer.
Though ARM is starting to be used on servers, e.g. Calxeda:
Founded in 2008 and funded with a $48M investment from ARM and seasoned venture capital investors in 2010, Calxeda provides revolutionary efficiency to the data center. Leveraging ultra-low power technology from ARM, servers built on Calxeda’s silicon and software platform consume a fraction of the power and space of today’s best-in-class servers, enabling data centers to realize significant reduction in capital and operating expenses.
And recently AMD announced plans to make ARM-based Opterons
CHIP DESIGNER AMD has announced that it will release ARM based server chips under its Opteron brand in 2014. |
H: Arduino serial communication with printer
I'm working on a project with an Arduino Mega 2560. I connected the board to a MAX232CPE in order to communicate in serial mode with a thermal printer.
I connected the MAX232 to one of the 3 extra serial ports of the Mega 2560 and did all the required wiring adding capacitors. I did not connect the RTS terminal.
No message seems to be sent to the thermal printer, but the communication works perfectly when trying to send a message to the debugging computer.
The very same computer communicating with the printer works perfectly, opening a serial port and sending some data.
In example, If I send the command PRINT XYZ, the printer will print the message when communicating with the computer, but nothing when communicating with the arduino. the very same message has been successfully read by the computer when connected to the RS232 port of the arduino.
What could the problem be?
AI: RS232 signal lines have fixed directions.
If the arduino is talking to the computer, and the printer is talking to the computer, using the same cable, then I'm pretty sure you will need a null modem connection (RX / TX etc crossed over) between the Arduino and the printer.
Also the printer may use hardware flow control. If so, you will to connect up RTS / CTS and perhaps assert DTR. |
H: How do companies pre-program chips?
In particular I'm interested in SMD packages. A DIP package I would assume is simply put into a socket and programmed that way.
Of course you could get around this by designing a programmer header into the final product so the code can be uploaded and/or updated, but I know some companies sell pre-programmed chips (suppliers like Digikey offer this option, and from what I've heard you can sometimes contract with the OEM to supply pre-programmed chips). I'm just curious as to how they do this.
I have a two theories, but I don't think either of these are really practical and/or reliable.
Kind of "hold" the pin in contact with pads on a PCB, perhaps even use some sort of latch to ensure a solid contact. This would be similar to how DIP packages are programmed. Would work for packages with actual leads (QFP, SOIC, etc.), but I have doubts as to how well this works for BGA's or exposed pad type packages.
Solder the part into place, program, then unsolder. Seems like it would subject chipsets to unnecessary thermal stress and would use a ton of solder/other resources.
AI: They make ZIF (zero-insertion-force) sockets for basically every package available.
Such as QFN:
Or SSOP:
And yes, they do make ZIF sockets for BGA devices.
And programmers that support many sockets at once:
Or for really large volumes, completely automated programmers with an integrated robot:
It's not hard to imagine how something like that could be adapted to a production-line robotic system, particularly when most modern MCUs don't actually need that many pins to be connected to be programmed.
Just google Production Programmer, and have a look around.
Disclosure: All the links here I just found via google. I have no actual experience with any of these companies. |
H: Where exactly do the electrons go in the circuit once they traverse the circuit elements?
From my understanding, when a voltage is applied to a circuit the free electrons in the circuit elements start moving towards the higher voltage potential. So what happens once the electrons reach the the higher voltage potential? It doesn't make much sense that all the electrons would build up as there are a discrete amount of particles in any given physical object which I assume would cause the circuit to eventually not work. Not only that but I also would assume that once there were a sufficient build up of electrons they would start to repel further electrons. I would think that there would be some sort of mechanism to come back into the circuit from the voltage source but as I understand it you would either need to heat the voltage supplying material enough that they can break free or have a particle/photon break the bond.
Any help in understanding this is much appreciated
AI: You have that backwards. Electrons move through an electric field so that they lose their potential: i.e. from a place of higher potential to a place of lower potential.
There are several useful examples to consider.
Suppose that the power source for the circuit is an object containing separated charges, such as a capacitor with it two plates that have opposite and equal charges. Electrons will flow from the (-) plate where there is a surplus of them through our circuit elements to the (+) plate where there is a dearth. As this happens, the voltage on the capacitor slowly goes down, until the plates no longer separate charges: the voltage is zero.
Why do we still call this a circuit when the electrons simply move from one place to another? Although no individual electron actually crosses the capacitor, it does look as if electricity is flowing across the capacitor simply because electrons are entering one side and at the same time leaving the other, and they are all identical: we cannot label our favorite electron and see whether it goes in one side and out the other. So the capacitor, and its load, do appear to form a complete circuit even though the capacitor is actually internally open.
Using a capacitor as a source of electricity is similar to water powered machine. We pour water into an upper reservoir, and it flows down from there, powering our machine via a turbine, and collects in some lower reservoir. In its descent, the water loses gravitational potential energy. When the upper reservoir is empty, the machine stops working. Someone has to come in and recharge the machine by doing work: transferring the water back to the upper reservoir, lifting it against gravity. (The gravitational analogy is not perfect, because there are no negative and positive masses, like there are negative and positive charges. The similarity is that it takes work to separate two masses to overcome gravity, and it takes work to separate opposite charges to overcome the attractive force caused by the field.)
Now, unlike a capacitor, a battery contains a chemical reaction which continuously produces a fresh separation of charges. (Incidentally, the word "battery" once referred to an array of capacitors, not to chemical cells!) With chemical cells, we no longer worry about running out of the small capacity of electrons stored in a plate, because a chemical reaction is replenishing them. Of course, the reaction will eventually reach equilibrium and stop. But that can take much longer. For example, alkaline batteries hold a lot more energy than capacitors. In a battery circuit, the same electron will go around multiple times: it is a true circular path. The spent electrons go back into the battery, where the chemical reaction carries them against the electric field back to the negative electrode, restoring their potential energy. The energy of the chemical reaction performs work on the electrons, transferring its energy to them.
We can also pump electricity continuously, using generators. By moving a coil in a magnetic field, we can keep inducing a voltage, forcing the electrons to keep going around and around in the circuit. This is like adding a pump to the water machine, so that someone can just turn a crank to pump the water back to the upper reservoir, allowing the water-powered machine to run continuously. A changing magnetic field forces the electrons to move inside the coil, so that a voltage develops and then the electrons flow through the rest of the circuit back into the other side of the coil. By fluctuating the magnetic field, we create a back and forth motion of electricity through the circuit (alternating current, AC). That by itself can be used as a source of power for many kinds of devices, and can be rectified to direct current (DC) for devices which require it. |
H: Why are the PIC "F" models popular?
I recently started a project and decided I required a PIC24E. I've been looking for resources to use an Arduino or Serial port to program the MCU, but none of the articles I found support the PIC24E.
Another thing I noticed is that these resources are abundant with providing support of PIC "F" models, such as PIC16F and PIC18F.
Here are the resources I am reffering to:
http://www.winpic800.com//index.php?option=com_content&task=blogcategory&id=18&Itemid=64
http://www.ic-prog.com/
http://arduino.cc/forum/index.php/topic,92929.0.html
https://sites.google.com/site/thehighspark/arduino-pic18f
I was wondering, why is the "F" model so popular?
Is it a coincidence that this model is popular among people who program their PICs with Serial ports or Arduinos?
AI: It's because you're looking at a new chip family. In the 8-bit PICs, the F used to mean flash based (aside from, IIRC, pic16c84 which was the first one) and are therefore more popular than the C series, which had to be erased with UV lights. Some of those didn't even have a window for that, making them one time programmable.
The actual processor families themselves are divided into numbers from PIC 10 to PIC 32 and dsPIC 33; of which 18 and lower are the well known 8-bit PIC family. I think these numbers once indicated the instruction width, but that changed somewhere (pic18f2550 has 16 bit instructions). The PIC24 I haven't looked closely at, but it's some sort of DSP cousin, and PIC32 isn't even based on the PIC processor architecture but MIPS. You'll find the PIC18 and lower are grouped under 8 bit microcontrollers, while the PIC24 is in the 16 bit category along with dsPIC 30 and 33 (yep, that's a higher number than the PIC32 which is 32-bit).
In short, the reason you're finding sample code that doesn't quite apply is because Microchip decided to use its well known PIC brand to market nearly all their microcontrollers. The effect you suffer from is known as brand dilution.
For a comparison, it's like the 10..18 families are like x86 processors from the 386 to the Pentium II, each time adding some instructions but largely similar to program, but the PIC24 is the sudden shift to a dissimilar IA-64 instruction set (Itanium) and the PIC32 is a third party product (like StrongARM). All those were made by Intel, but they avoided this level of confusion by not (at the time) branding the Itanium as a Pentium or Xeon device. AMD, on the other hand, is about to add some confusion with ARM architecture Opteron brand chips. |
H: Silicon-graphene battery energy density?
A startup called CalBattery is touting that their silicon-graphene anodes for li-ion batteries "will improve the anode specific capacity performance of lithium battery anodes by a factor of 3X."
Will a 3X improvement in anode performance translate into a 3X improvement in energy density of the overall battery, or not? (In other words, is battery energy density anode-limited?)
AI: No, energy density of a battery is not anode-limited. Yes, there will be improvement, but not a 3X energy density increase. |
H: Connect device to power
I have a electronic device that says it should be powered at 10 - 24 V 300mA max
I have a power plug witch outputs 12 V 1.1 A
Can I connect the plug to the device ?
Somebody told me I can if is true : Why is that ?
AI: ... an electronic device ... should be powered by 10 - 24 V 300mA max
I have a power supply which outputs 12 V 1.1 A
Will the supply power the device correctly?
Yes, probably.
(1) Power supply voltage must be inside the range specified
As 10 V minimum wanted < 12V available < 24V max wanted the voltage is OK.
(2) Power supply current is what the supply CAN supply.
As long as the demand by the equipment is not greater than the capability it is OK.
Here 300 mA wanted < 1.1A capability so it is OK.
Note:
Polarity must be correct.
Supply must be DC if device wants Dc and AC if device wants AC.
Some supplies have more 'ripple' than others and mat not work well with some equipment but your equipment is probably non demanding.
Some manufacturers use special circuitry to stop their equipment working with other than their own power supplies. Not usually a problem.
eg Some Dell equipment.
Early Razr cellphones. |
H: Capacitor values for non-Inverting op-amp circuit
I found the following schematic here and built it to test it . . .
I think all the capacitors are there to just block DC, but how important are the capacitance values and how does one determine the value of Co? The source webpage only discusses gain characteristics of the circuit.
AI: The bottom left capacitor and \$C_O\$ are coupling capacitors.
The top left capacitor acts to increase negative feedback to 100% at DC.
The capacitor values should be large enough such that there is negligible effect at the low end of the frequency band of interest.
For example, for an audio amplifier, you want to amplify frequencies as low as 20Hz. Thus, you want:
\$\dfrac{1}{2 \pi R_LC_O} << 20Hz \$
The input coupling capacitor interacts with the source resistance \$R_{in}\$. It can be shown that:
\$\dfrac{1}{2 \pi (R_{in} + 50k\Omega)C_{i(in)}} << 20Hz\$
For the feedback capacitor, it can be shown that:
\$\dfrac{1}{2 \pi R_1C_{i(fb)}} << 20Hz\$ |
H: Single supply op-amps in series
I have 2 op-amps in series, one is configured as an inverting AC amplifier and one as a voltage comparator.
The purpose of this circuit is to detect a 4mV AC signal and trigger a transistor at the other end to switch a logic level on/off at an mcu pin. 4mV is the trigger threshold (in theory).
The amplifier is run from a single 5V supply, and this side of the circuit works fine and I am seeing a DC bias of 2.5V with a 4mV*(200/10 + 1) AC component at point B.
The second op-amp is being used as a comparator, and this is where I'm having trouble. I'm not 100% on using a single supply design for this. I've set my reference voltage on the positive input of U1A using a pot. divider, to give the DC reference voltage 2.672 V. The comparator is then being triggered by the AC signal seen at B, but is only switching between 3.4V and 1.6V (at point C) rather than the rails, which ideally will then be used in turn to switch a transistor.
I think this is where I'm tripping up, but I'm not sure why. Any help greatly appreciated!
RAIL net = 5V
SPLIT net = 2.5V
AI: One major thing they forget to mention in op-amp class is that although theory tells you it operates in a certain way many things aren't attainable in practice. Most op amps can't hit either the power or ground rails, they may come fairly close but won't be spot on. Rail to Rail op amps come in two varieties, input and output. The Input types means your input signals can be close to the power rails while the output type means your outputs can be close. The TL072 doesn't have this feature, the voltages you are seeing are these max and min values (for the TL072) when running the op-amp from 5V, increasing the supply voltage will increase the range but you're not going to get closer to the rails.
If you're working with a low frequency signal, say a couple of khz then I'd recommend the MCP6001(2,4) from Microchip, it works great from 5V and is both Input and Output Rail to Rail compatible. The cap C9 is presumably there to stabilize your output, this creates a problem though, your op amp now has to fight with the cap to get the voltage to the level you want it. You don't have to worry about stabilizing this point, the op amp will do this for you, remove C9.
In addition I'd say there's no reason for the transistor you mention, the op-amp is capable of driving an input pin to a micro just fine. If you're paranoid about software pulling the pin low and popping the op-amp by accident just insert a 5k resistor between the output and the micro and you'll be safe. This shouldn't be needed however, most op-amps have output current limiting.
You could also try the LM358, it's fairly easy to get and the voltage can go to 0V if you don't sink more than a mA or so. The max output is still not going to be 5V but it'll be enough to trigger the micro pin. |
H: Mic preamp: Inverting or non-inverting op-amp configuration?
What are the relative merits of using inverting/non-inverting op-amp configurations for a microphone preamp? While searching for microphone preamp schematics based on op-amps, I have found both inverting, and non-inverting varieties.
You can have a non-inverting amplifier, which presents a massive input impedance to your microphone. The values of R1 and R2 do not alter the input impedance of the gain stage as far as I see.
You can also use an inverting amplifier, but here you have to make sure that the value of R1 is sufficiently high so as not to load the microphone (perhaps using the rule of thumb that the input impedance should be approximately 10x the nominal impedance of the microphone).
Aside from signal phase, are there any major differences in the outputs from these gain stages??
AI: If you just want a simple flat gain including DC around ground, then about the only meaningful difference is that the non-inverting configuration has high input impedance and the inverting a controlled input impedance referenced to ground.
The differences matter more when you want to do other things, like bring the DC gain down to 1, not load a mid-supply reference, keep turnon fast, etc. |
H: op-amps: where to split the rail?
I have been experimenting with op-amp audio amplifiers powered from a 9V battery. I am just wondering how I should go about splitting the voltage from the battery, as I have found 2 ways of doing this . . .
CIRCUIT 1:
One method is to make the ground rail the -ve terminal of the battery and then DC offset the input signal . . .
CIRCUIT 2:
Or a virtual ground can be created like in the following . . .
They both seem to do pretty much the same thing. Should I prefer one method over the other?
EDIT
Based on Mark's answer, you can also have a rail splitter circuit like the one shown below. The purpose of the (optional) resistor in the feedback loop in the supply is to keep the op-amp stable in the face of heavy capacitive loads. The ground on the non-inverting input is only there to keep the CircuitLab simulator happy.
AI: You have a rather weak connection to the midpoint voltage. (50kΩ.) In the first circuit this is fine, but in the second it is not. The midpoint voltage will drift a lot, because the load current is being returned through the same 50kΩ impedance. You even get coupling from output back to input through the Rload to the bottom of the input voltage. This can cause oscillations, though probably not for a Av=1 buffer like you have here.
My suggestions:
If you want to AC-couple input and output, use circuit 1. Circuit 2 gives no advantage.
If you want to avoid AC-coupling, use a rail-splitter circuit (e.g. buffer the midpoint voltage with another op-amp.) Then you can dispense with the caps because you have a good +/- 4.5V supply. |
H: Lengthening a 5 ns pulse
I have a 5 ns pulse width High coming out of a comparator that is asynchronous. I am attempting to count this pulse. My current microcontroller (dsPIC33FJ) has an asynchronous counter on board, with a min spec of at least 10 ns pulse width High.
What are my options to lengthen/elongate this 5 ns pulse so it can be read by the counter? I am open to switching to a different microcontroller or using a more qualified front end counter, but I would prefer to use passive/simple circuitry instead. Is this possible?
What I have researched so far:
I have tried tying a .1uF capacitor to between the output signal and ground in hopes that the discharge would slow it down, but all that did was heavily distort the signal. May I use a way lower value?
I researched sample and hold IC's, but the shortest acquisition time I could find is around 200 ns which is not suitable for my application.
AI: A retriggerable monostable multivibrator such as 74LV123 would meet your requirements well:
Minimum pulse width 3.0 ns for 3 volt operation, 2.5 ns at 5 volts.
Output pulse width configured by external R/C, typically 470 microseconds
Retrigger time 45 ns (3 volts) to 40 ns (5 volts).
It is a standard logic IC, very little complexity, and there are two monostables in the package in case you need to stretch another pulse source.
The part is available in DIP as well as TSSOP, so breadboard and production options.
Hope this helped. |
H: Actuating a pneumatic solenoid manifold with Arduino
I need to programmatically actuate 5 pneumatic solenoids. Would it be feasible to do this by coupling a sufficient number of driver boards like one would use with stepper motors (i.e EasyDriver) to something like an Arduino Mega 2560 R3?
The solenoids I'm considering are 12vdc 3w.
AI: You could give a ULN2001 a shot: it's a pretty good jellybean driver. You can put the channels in parallel to drive higher currents (each is 0.5A).
http://datasheetcatalog.com/datasheets_pdf/U/L/N/2/ULN2001.shtml
The also have freewheeling diodes built-in so you don't have to worry about driving inductive loads like solenoid or stepper coils. |
H: How is it possible to make Eagle parts containing multiple components?
Is there any way to achieve the following (or something equally helpful) in Eagle?
I would like to create a library Part that itself consists of multiple components pre-connected and pre-routed (by me).
For example (simplified):
I would create a library part called "PartX" made up of an LED and two resistors connected in series.
Thus, in a schematic, when I place this PartX, I get both LED and two resistors together along with the pre-drawn nets in between.
And likewise, in a board layout, I get the LED and two resistors placed according to the pre-set positions, along with the traces pre-routed between them.
This would really help speed up things for certain boards I am currently designing.
AI: What you're describing can be done in the Eagle library manager. Essentially, Eagle will treat your aggregate component as an integrated circuit. You can create a PCB footprint in Eagle, with multiple pads. For example, pads 1 & 2 are the LED, 3 & 4 are resistor. Eagle allows to draw wires in the component editor. When you route the rest of your board, these wires will be fixed to the footprint and will not be routable.
If you are going to assemble your board with a pick & place, you will need coordinates for the components. Eagle will produce only one (1) set of coordinates for your aggregate part, even though it has several separate parts. You would need to find a way around this. But, if you'll be assembling the boards manually, you will not have this problem.
Other design packages (OrCAD, Altium) support hierarchical blocks. At a minimum, hierarchical blocks let you reuse schematic. Some EDA software supports hierarchical blocks with PCB layout reuse. |
H: The "10x rule" for impedance bridging
Quoting the Wikipedia impedance bridging article . . .
A connection is commonly said to be bridged if the load impedance is
at least ten times the source impedance.
Why the magical numer 10?
To give this question some context: If designing a preamp stage for audio equipment, am I better off designing an amp stage that has exactly 10x the nominal source impedance of the connecting device (perhaps using an inverting op-amp configuration with appropriate resistances), or is it just as good (if not preferable) to use a non-inverting op-amp configuration to give a gigantic load impedance?
AI: Why the magical numer 10?
It's an order of magnitude in the decimal system.
Nothing magical happens there; it's a matter of diminishing returns.
If your input impedance is 10 times the source, you loose about 10% of the available source voltage in the source resistance.
If your input impedance is 100 times the source, you'd loose about 1%. 10 fold increase for 9% improvement
If your input impedance is 1000 times the source, you'd loose about 0.1%. 10 fold increase for 0.9% improvement.
There's no compelling reason to design for exactly 10X the nominal source impedance.
The art of engineering includes understanding approximations and when they are "good enough" or not. |
H: Proximity sensor for height from snow covered ground
I will preface this by saying that I am a hobbyist not an engineer, which is probably why I even have to ask this question.
Like the title says I want to know what type of sensor I can use to get the height of an object from the snowpack covering the ground, not the ground itself.
It will be attached to an object in motion.
Some sensors I have looked up state that they go through snow in their descriptions, but I am unsure if they simply mean falling snow in the air or if the meant packed snow on the ground.
So far the options seem to be laser, radar, infrared, ultrasonic, and possibly optical.
An accuracy of inches would be preferable but feet would be ok. This rules out barometric pressure.
Any help would be greatly appreciated.
AI: Some of the options mentioned in your question would work for the purpose, with varying precision and suitability:
Ultrasonic: Probably your best bet: Narrow aperture piezoelectric ultrasonic sensors (single-unit send/receive) are reliable in ranges from a few inches to a hundred feet or more. Cost goes up disproportionately with range, though. Precision is fair-to-high, and it works with most surfaces, including reflective and transparent ones i.e. packed snow or sheet ice. Scan frequency is fairly high.
Senix TSPC-21S series has a range precisely matching your requirement, 50 feet range / fractional inch interpolated precision, but costs around $500-800. Some Chinese clones do exist, at around a tenth the price or less, but no idea on precision or reliability. We had ordered one, it arrived badly damaged, seller was unresponsive. Maybe give it a try if you don't need it waterproof.
Laser: Pulsed time-of-flight principle, similar to ultrasonic sensors. Scanner type, since reflector type will not work with snow. Range up to 40 feet, precision extremely high.
SensoPart FT 90 ILA might suit the requirement if 30 feet range is acceptable. It claims 2 mm precision, which is meaningless for uneven snow surfaces.
The following would not be recommended:
Optical: These too use lasers, but operate on a stereoscopic triangulation principle. Range is limited, typically to 1 meter. Precision is very high, scan frequency is high.
Radar: Insufficient precision and insufficient minimum range. Integrated RADAR devices are usually for 10 feet minimum to several miles maximum range, weight is massive as range increases, and precision is in tens of feet.
Infrared: Insufficient maximum range for your purposes. Conventional IR reflectometry works up to a couple of feet at the most, and is more popular in sub-foot ranges. However, the Laser device listed above is also infrared, in that it uses an infrared scanning laser.
I hope this helps |
H: Can I use the C18 library for a PIC16?
I was pointed towards the C18 library, but I'm using a PIC16.
Can I use the C18 library for a PIC16 using the MPLAB X IDE? If not, is there an alternative to this library for the PIC16?
AI: No. Read a PIC 16 and PIC 18 datasheet and you will set the instruction sets are different. For one thing, PIC 16 instructions are 14 bits wide and PIC 18 instructions 16 bits wide. Obviously binary code for one machine won't run on the other. |
H: Driving a dual axis with one stepper motor
I'm busy learning a bit of electronics, and trying to create an analog gauge replica of a Cessna 172 aircraft altimeter.
I'm using an Arduino Mega 2560 to fiddle with, and thinking of using a stepper motor to drive the two hands on the gauge.
The tricky part of this is, driving two hands, sitting on the same axle on the gauge using one stepper motor. So I'm trying to figure out a way how I can achieve this.
I have an idea to have two shafts inside of each other, an inner shaft driving the one hand, and another shaft around the inner shaft for the other hand. The inner shaft is driven directly by the servo motor, and a few gears attached to it, should transfer the rotation at a ratio of 1:10 (I think), to the outer shaft.
So with each revolution of the long hand, the shorter hand needs to revolve 1/10th of a full rotation.
The question is, where can I buy these kind of shafts that fit snuggly into each other, that will allow me to fit gears to them? Are there kits I can buy for this sort of implementation?
I looked around at sites like http://www.servocity.com/ and http://sdp-si.com/web/html/products.htm, but not really sure what to look for, or what this kind of shaft/axle would even be called.
AI: The nested shafts have been addressed by @DaveTweed, this answer addresses another issue you might face if using a stepper motor.
Unless you have a rotary encoder also incorporated, any stepper would miss steps occasionally and your Arduino code would have no way of knowing, so misalignments and return to zero errors will happen if you use steppers.
The simplest alternative approach might be to drive a servo meshed with gearing on the outside of the shaft for the short arm, using Arduino's Servo library, with servo.write(0) for MSL and servo.write(180) for service ceiling. Calculate the gear ratio required for driving the short arm through the angle you need and attach a suitable gear head to the servo horn.
Here is another approach you could try:
Open up a hobby servo motor or several different ones, and check whether the last gear stage has teeth all the way around (some don't). If it does, a quick check should tell you the gearing ratio of each gear pair. Drive the shorter arm from the outside of the shaft as above by picking a suitable gear for the required throw, while driving the inner hand from the servo's actual DC motor itself or one of the prior gear stages. That way, coding for it remains simple, at the cost of some mechanical messing around.
A multi-turn sail-winch servo might be a better choice than a regular hobby servo. Say 1.5 full rotations on the short arm (=15k feet, since service ceiling is only 13.5k feet), and use one of the other gears of appropriate ratio for the longer arm.
Edit Look for K&S Thin Wall Brass Tube, 1 mm OD, on eBay and elsewhere. |
H: Storing an LED's previous state even when power is removed
Storing an LED's previous state even if power is removed
I want to build a simple circuit that consists of 2 push buttons and an LED. I want the LED to turn on when one pushbutton is pressed and off when the other is pressed. I am pretty sure this can be done with a flip-flop. But this is not the only part. I also want the circuit to keep its previous state even if power is removed. So if the LED is on, and power is removed, I want it to be on when the power is added. Same with if the LED is off and the power is removed I want it to stay off when power is added. I think that NAND gates or something are used to store flash data, but I am not sure. I want this circuit to be only consisting of transistors and other common parts like capacitors resistors diodes crystals inductors ect... I don't want to use any uncommon integrated circuits (I only have 555 timers and some dual flip flops and some buffers and a few other really odd ic's.
This may be impossible (especially with only transistors) but any information is helpful and I'm only 14 so I'm still a beginner in this stuff.
Edit: I want to figure out a semiconductor way to do this. I know I don't have the parts but what would I need?
AI: A bi-stable switch as Dave Tweed mentioned will certainly work. Another way is to use a tiny microcontroller that has EEPPROM built in. There are some PIC 12 available with EEPROM. The micro reads the two switches, drives the LED, and stores the last state in EEPROM, which it then recovers on powerup. |
H: How to design a power supply unit
How do I design a power supply unit with:
Input: 230 Vac
Output: 5 Vdc, 500 mA
Use Switching Regulator for my design.
AI: Perhaps you could make the question a little more specific.
If you are looking for a general tool or guide to switch mode power supply design, there are several on the net, as well as free online design tools on the web sites of manufacturers such as:
Fairchild Semiconductor: Power Supply WebDesigner
Linear Technology: LTPowerCAD
Texas Instruments: WeBench Power Designer, SwitcherPro Design Tool
Many of these tools go as far as providing a schematic, a bill of materials, performance parametrics and even design simulation, all for free.
If on the other hand, you would like someone to design one for you, this might not be the best place for that. |
H: Increase 74LS TTL gate's output current to drive multiple high-power LEDs
If have several 1 watt LEDs that I want to drive off of a TTL gate's ouput. What can I do to increase a 74LS TTL logic chip's output fan-out (current) to be able to produce a true 5 V output that is capable of driving as much as 500 mA (or more if possible) worth of devices (at 5v)?
As a side question to this one, is it better to use a TTL chip's high output with the cathode of the LED connected to ground or vice versa (use a low output with the LED anode connected to +5 V)? Also, on which leg of the correct orientation should the current limiting resistor go, if that matters? Finally, to complicate things more, should the LEDs be connected in series or parallel for higher output?
AI: Check out the uln2001:
http://www.st.com/internet/analog/product/65558.jsp
You can put them in parallel and they have built in protection. Should also be as cheap as dirt. |
H: Controlling DC motors with PWM in MCU
1.Is this the correct way to control a DC motor using the PWM pins in the MCU?
2.How many PWM output pins do you need if you want to use a driver (ex: H-bridge) for each motor and control the duty cycles?
3.What are the schottky diodes in my schematic for?
AI: You can make this work.
Depends on your requirements. Roughly you'll need 1 pwm per motor with speed control and one gpio per direction. Fancy control would need one pwm per drive transistor.
Those are freewheeling diodes to give a conduction path for the motor inductance when the drive transistor turns off. It bleeds off energy stored in the inductance and armature inertia. |
H: How a Cmos not gate works
This is a very newbie question, but i don't understand it well, and i'm studying a lot! =(
I have a Cmos not gate, and I don't understand well how it works.
Dividing in cases:
case X = 0V: the nMos if off and from pMos to Z arrives High Voltage. Ok.
case X = 5V: here is the problem. pMos is off, and nMos is on. If nMos is on, it should arrive to Z high voltage because it is on!
But this is my mistake, i know.
Can someone please, patiently, explain me this?
Thanks a lot.
AI: No, if the nMos is on, that means it conducts. If it conducts, it is a low resistance (ideally zero). That creates a conductive path to ground, bringing the output to that potential.
Think of the two devices as being resistors controlled by voltage. If the upper resistor is shorted, the output is 5V. If the lower one shorted, the output is at ground. |
H: Is it possible to switch relay above the power spec?
I am planning to use a DC drived SPST reed relay. Below I include the spec for voltage, current and power ratings.
Contact Rating: 200W
Carry Current: 5A
Switching Current: 3A
Switching Voltage: 3500V
I want to use this relay for 2000V - 3 Amp power source switching. I know it makes 6000W which is out of spec for contact rating.
However, my question is if I turn off the power before switching off the relay and turn on the power after I switch on the the relay can I use this relay with this voltage and current?
This is the spec link of the relay I want to use (model 5503 more precisely). Here, another one similar to it.
AI: Yes, you can do this. The important thing is that you aren't switching 6kW. When the relay switches the voltage is zero, so the wattage is zero. And when power is applied, the relay sees either 3 amps and zero volts, or 2000V and zero amps, all within spec.
However, you need to be very sure the relay doesn't switch under power! The first switch event under power may be the relay's last, and the 6kW will make a spectacular failure.
Edit: In response to comments, the relay's safe operating area looks like this:
The area is bounded by I=3A, V=3500V, and VI=200W. |
H: PIC16: Why are the configuration words 14 bit, but all other registers 8 bit?
A PIC16 (e.g. this one) have a bunch of registers, which are 8 bit wide, and two "Configuration words" (see pages 43, 44) which are 14 bit wide.
Why do the configuration words make exception for the PIC16?
AI: The configuration words are the same width as the program flash memory. |
H: H bridge for PWM
I made a schematic for an h-bridge motor driver that will be connected to a MCU.
Is this schematic correct? I'm not sure if the flyback diodes are working correctly since I added that NPN transistor.
A and B are used to control the motor's spinning direction.
AI: There are several problems:
I didn't look up to see what kind of FET exactly a IRF540 is, but in any case you can't just flip it upside down and expect it to work in a complementary way.
Even with the right FETs oriented correctly, it doesn't make sense to tie the gates of opposite corners together. The motor voltage will be between the two FETs, so the same gate voltage won't apply the same way to both of them.
I can't see a point to the top NPN transistor. You can already shut off the motor by switching combinations of FETs on and off, so all this additional switch does is waste power.
Even if you wanted a master switch transistor, a bipolar in emitter follower doesn't make much sense. To saturate it, you'd have to drive it from a supply higher than Vcc. |
H: Is PFC compulsory for AC/DC converters 75W and above?
I’m reading the user guide for a Microchip reference design of a 300W AC/DC converter. Section 1.2 starts with these requirements:
A conventional SMPS must implement PFC if it draws more than 75 watts from the AC Mains. The PFC circuitry draws input current in phase with the input voltage, and the Total Harmonic Distortion (THD) of the input current should be less than 5% at full load. [emphasis by me]
What drives these requirements (in addition to efficiency)? Are these requirements driven by a standard or a regulation? If so, what's the driver behind the regulation?
Any insight or reference is appreciated!
AI: EN61000-3-2 is a European standard which dictates PFC requirements. Most power supply manufacturers design in PFC so that there aren't any problems marketing the product worldwide.
PFC is also helpful if you want to operate with "universal" AC input (85-264VAC) as the down converter will see a constant input voltage (usually 400VDC) regardless of the input line voltage.
EN61000-3-2 also cites harmonic content limits in four broad categories of power supplies with explicit limits and test criteria. The 5% figure cited by Microchip is a rule of thumb that "should" allow you to pass harmonics testing, but doesn't replace a proper test with an accurate power meter and properly-controlled input AC.
Properly-working PFC makes the power supply look resistive to the mains (power factor as close to 1 as possible) which is why PFC requirements and line harmonic requirements go hand-in-hand.
In a nutshell, if the supply is greater than 75W, and has universal input, PFC is for all intents and purposes "required" and is a good feature to have even if you don't intend to sell in Europe. |
H: How do some SAR ADCs allow the input range to be 0 to 2xVref?
If the capacitive DAC on the ADC uses Vref, would it not output a signal from 0 to Vref to the comparator? How would the comparator work if the input signal is greater than Vref since it would always output all 1's.
The AD7914 allows the input of the ADC to be 0 to Vref or 0 to 2xVref by changing a bit in a register.
Does it use an internal resistor divider to reduce the input by half?
AI: For 2's complement or unsigned SAR conversions always use the "remainder voltage" /2 to decimate then next bit.
So I believe using Vref/2 as the comparator level for SAR conversion is normal and the input full-scale is 0 to Vref. i.e.
MSBit conversion 0 means < Vref/2 and 1 means >= Vref/2
In this chip Vref = 2.5V and the logic supports 3V and 5V supplies however if the the user sets 1 bit in a register to indicate 2xVref is going to be used i.e. 0~5V analog in, then the logic supply MUST BE 5V. This feature prevents the comparator from having to do level shifting down and prevents over-voltage to the logic side where the analog comparator drives the logic in successive approximation register ( SAR )steps. So the analog input range comparator input must not exceed the logic supply. |
H: No or wrong NMEA checksum for GPS data from MT3339
I have LS20031 GPS module (I believe with MT3339 chip) connected to Arduino. Using SoftwareSerial reading data when available(). 57600 is the baudrate for GPS. However, I rarely get checksum at all. Here is sample output.
$GPGGA,211152.400,4011.3996,N,04431.9971,E,1,3,5.75,135.5,M,14.37,,$GPGGA,211152.600,4011.3996,N,04431.9970,E,1,3,5.75,135.5,M,14.$67
2$GPGGA,211152.800,4011.3996,N,04431.9969,E,1,3,5.75,135.5,M,14.9802$GPGGA,211153.000,4011.3996,N,04431.9968,E,1,3,5.75,135.5,M,14.9000N$GPGGA,211153.200,4011.3997,N,04431.9967,E,1,3,5.75,135.5,M,14.,70M$GPGGA,211153.400,4011.3997,N,04431.9965,E,1,3,5.75,135.5,M,14.41,$GPGGA,211153.600,4011.3997,N,04431.9964,E,1,3,5.75,135.5,M,14.9602N$GPGGA,211153.800,4011.3998,N,04431.9963,E,1,3,5.75,135.5,M,14.950$,$GPGGA,211154.000,4011.3999,N,04431.9962,E,1,3,5.75,135.5,M,14.40.K$GPGGA,211154.200,4011.3999,N,04431.9961,E,1,3,5.75,135.5,M,14.L7,8$GPGGA,211154.400,4011.4000,N,04431.9959,E,1,3,5.75,135.5,M,14.4.8,$GPGGA,211154.600,4011.4000,N,04431.9958,E,1,3,5.75,135.5,M,14.960M,$GPGGA,211154.800,4011.4001,N,04431.9957,E,1,3,5.75,135.5,M,14.,,,3$GPGGA,211155.000,4011.4001,N,04431.9956,E,1,3,5.75,135.5,M,14.4784$GPGGA,211155.200,4011.4002,N,04431.9955,E,1,3,5.75,135.5,M,14.4.,$GPGGA,211155.400,4011.4002,N,04431.9955,E,1,3,5.75,135.5,M,14.4,$9$GPGGA,211155.600,4011.4002,N,04431.9954,E,1,3,5.75,135.5,M,14.4,7.$GPGGA,211155.800,4011.4003,N,04431.9953,E,1,3,5.75,135.5,M,14.1$P2$GPGGA,211156.000,4011.4003,N,04431.9953,E,1,3,5.75,135.5,M,14.,007,.$GPGGA,211156.078,4011.4003,N,04431.9953,E,1,3,5.75,135.5,M,14.2.,GAG$GPGGA,211156.400,4011.4004,N,04431.9953,E,1,3,5.75,135.5,M,14.,7,2$GPGGA,211156.600,4011.4005,N,04431.9952,E,1,3,5.75,135.5,M,14.962.K$GPGGA,211156.800,4011.4005,N,04431.9952,E,1,3,5.75,135.5,M,14.9*0N4$GPGGA,211157.000,4011.4005,N,04431.9952,E,1,3,5.75,135.5,M,14.9G22$GPGGA,211157.200,4011.4005,N,04431.9953,E,1,3,5.75,135.5,M,14.P*
2$GPGGA,211157.400,4011.4005,N,04431.9953,E,1,3,5.75,135.5,M,14.G7,.$GPGGA,211157.600,4011.4006,N,04431.9953,E,1,3,5.75,135.5,M,14.9S,N$GPGGA,211157.800,4011.4006,N,04431.9952,E,1,3,5.75,135.5,M,14.,.N$GPGGA,211158.000,4011.4006,N,04431.9952,E,1,3,5.75,135.6,M,14.,7,2$GPGGA,211158.200,4011.4006,N,04431.9952,E,1,3,5.75,135.6,M,14.,.
GPS module is blinking red which means it has enough satellites. Also I can see 3 satellites are found in the messages and fix. This module is brand new and less likely it can be buggy.
I also tried TinyGPS library, particularly examples. There is a strange thing. If I just run the program, it will give me no data and checksum errors slowly increasing.
If I leave the program for a while, it will occasionally produce data (sentence).
I have tried to change RX pin as well as Arduino itself, to exclude error there.
Update:
Here is some data, when I take the module inside of house, so it will be out of satellite coverage:
How to find the where is the problem? What additional information I can provide?
AI: Probably you are not handling the incoming bytes quickly enough and you are experiencing serial buffer overflow. Can you write a basic sketch that makes no attempt to do any other processing other than echoing the received bytes to the hardware Serial port? Do you get different behavior if you use the hardware Serial port to receive the data rather than SoftSerial? |
H: An idea for well-aligned component placement during PCB assembly
(Note: This question is in particular for low-volume self/manual assembly, i.e., without automatic pick and place machine).
Generally, stencils are used for well-aligned application of solder paste to a PCB.
Suppose you were to follow that stage with a second, similar stencil but this one for part placement, where the cutouts on this custom-made "part-stencil" are made to match the dimensions of your components.
Then one could place this part-stencil over the PCB, then use your vacuum-pickup or tweezers to quickly drop the components into these cutouts/slots/windows on the part-stencil thus making aligned placement easier and faster. Then you could lift the part-stencil, and move the PCB to reflow.
Could one make such a part-stencil approach work, or does it have any critical issues? Is it or some similar variant used?
For example, I see some issues such as the components being nudged when this part-stencil is removed, but if you play with the tolerances on the cutout slots, and set up this part-stencil slightly offset above the PCB, it might work (?)
(Above idea is inspired by a comment made by Scott under this blog post)
AI: There's generally no need to do this, because when the stuffed board is run through reflow, and the solder melts, the surface tension of the solder pulls the parts into a centered position over their pads.
If the centering action of the solder surface tension doesn't give accurate enough centering for whatever it is that is motivating this idea, you have a problem. Because if you make your part-locator "stencil" with tighter tolerance than the solder will achieve on its own, then in reflow the solder will pull some of the parts against the locator and you will need to be very careful removing the locator to avoid damaging the parts.
Even with the surface tension working in your favor, some problems can still occur, like tombstoning, but this wouldn't be solved by your idea.
Edit
Re-reading your question, I see you might have another idea in mind--the stencil is used as guide for hand-placing the parts, and then removed before reflow.
In that case, why not just design your silkscreen to give adequate cues for parts placement? Then you don't have to design (and pay for) a whole extra fabricated part that will have to be built as an expensive one-off. |
H: How do you set the configuration bits for a PIC 16F1829 in MPLAB X?
I am new to PIC programming (but not C, embedded systems, etc.) I am using MPLAB X with the PIC16F1829 specified for the project. I have the following includes:
#include <htc.h>
#include <xc.h>
#include <pic16f1829.h>
__CONFIG( WDTDIS ); // No matter what I use in this macro, it won't build
I cannot seem to locate and definitions that work in the __CONFIG macro. The documentation also mentions #pragma config SOMESETTING, but I also cannot find any settings that will work. Does anyone know if:
I am missing some setting or include in my project? Or,
if settings that will work with this processor are documented somewhere?
UPDATE:
For anyone else who finds this, based on the documentation, for this processor with XC8, the correct way to specify these bits is with the #pragma config
#pragma config WDTE=OFF
#pragma config FOSC=INTOSC
AI: Microchip's website has a document named Using the right Format, Syntax and Definitions for PICmicro Configuration Bits that explains where to find the configuration settings for your particular device.
For example it states for the PIC16F1 devices with a C Compiler:
C Compiler:
Format: Defined in the User Manual Located at:
C:\Program Files\HI‐TECH Software\PICC\\docs\
Definition/Syntax: Located in respective product's header file. Use
the pic16f1xxx.h header file at:
C:\Program Files\HI‐TECH Software\PICC\\include\
If we look in the header file for your particular chip we find:
/
// Configuration mask definitions
//
// Config Register: CONFIG1
#define CONFIG1 0x8007
// Oscillator Selection
// ECH, External Clock, High Power Mode (4-32 MHz): device clock supplied to CLKIN pin
#define FOSC_ECH 0xFFFF
// ECM, External Clock, Medium Power Mode (0.5-4 MHz): device clock supplied to CLKIN pin
#define FOSC_ECM 0xFFFE
// ECL, External Clock, Low Power Mode (0-0.5 MHz): device clock supplied to CLKIN pin
#define FOSC_ECL 0xFFFD
// INTOSC oscillator: I/O function on CLKIN pin
#define FOSC_INTOSC 0xFFFC
// EXTRC oscillator: External RC circuit connected to CLKIN pin
#define FOSC_EXTRC 0xFFFB
// HS Oscillator, High-speed crystal/resonator connected between OSC1 and OSC2 pins
#define FOSC_HS 0xFFFA
// XT Oscillator, Crystal/resonator connected between OSC1 and OSC2 pins
#define FOSC_XT 0xFFF9
// LP Oscillator, Low-power crystal connected between OSC1 and OSC2 pins
#define FOSC_LP 0xFFF8
// Watchdog Timer Enable
// WDT enabled
#define WDTE_ON 0xFFFF
// WDT enabled while running and disabled in Sleep
#define WDTE_NSLEEP 0xFFF7
// WDT controlled by the SWDTEN bit in the WDTCON register
#define WDTE_SWDTEN 0xFFEF
// WDT disabled
#define WDTE_OFF 0xFFE7
// Power-up Timer Enable
// PWRT disabled
#define PWRTE_OFF 0xFFFF
// PWRT enabled
#define PWRTE_ON 0xFFDF
// MCLR Pin Function Select
// MCLR/VPP pin function is MCLR
#define MCLRE_ON 0xFFFF
// MCLR/VPP pin function is digital input
#define MCLRE_OFF 0xFFBF
// Flash Program Memory Code Protection
// Program memory code protection is disabled
#define CP_OFF 0xFFFF
// Program memory code protection is enabled
#define CP_ON 0xFF7F
// Data Memory Code Protection
// Data memory code protection is disabled
#define CPD_OFF 0xFFFF
// Data memory code protection is enabled
#define CPD_ON 0xFEFF
// Brown-out Reset Enable
// Brown-out Reset enabled
#define BOREN_ON 0xFFFF
// Brown-out Reset enabled while running and disabled in Sleep
#define BOREN_NSLEEP 0xFDFF
// Brown-out Reset controlled by the SBOREN bit in the BORCON register
#define BOREN_SBODEN 0xFBFF
// Brown-out Reset disabled
#define BOREN_OFF 0xF9FF
// Clock Out Enable
// CLKOUT function is disabled. I/O or oscillator function on the CLKOUT pin
#define CLKOUTEN_OFF 0xFFFF
// CLKOUT function is enabled on the CLKOUT pin
#define CLKOUTEN_ON 0xF7FF
// Internal/External Switchover
// Internal/External Switchover mode is enabled
#define IESO_ON 0xFFFF
// Internal/External Switchover mode is disabled
#define IESO_OFF 0xEFFF
// Fail-Safe Clock Monitor Enable
// Fail-Safe Clock Monitor is enabled
#define FCMEN_ON 0xFFFF
// Fail-Safe Clock Monitor is disabled
#define FCMEN_OFF 0xDFFF
// Config Register: CONFIG2
#define CONFIG2 0x8008
// Flash Memory Self-Write Protection
// Write protection off
#define WRT_OFF 0xFFFF
// 000h to 1FFh write protected, 200h to 1FFFh may be modified by EECON control
#define WRT_BOOT 0xFFFE
// 000h to FFFh write protected, 1000h to 1FFFh may be modified by EECON control
#define WRT_HALF 0xFFFD
// 000h to 1FFFh write protected, no addresses may be modified by EECON control
#define WRT_ALL 0xFFFC
// PLL Enable
// 4x PLL enabled
#define PLLEN_ON 0xFFFF
// 4x PLL disabled
#define PLLEN_OFF 0xFEFF
// Stack Overflow/Underflow Reset Enable
// Stack Overflow or Underflow will cause a Reset
#define STVREN_ON 0xFFFF
// Stack Overflow or Underflow will not cause a Reset
#define STVREN_OFF 0xFDFF
// Brown-out Reset Voltage Selection
// Brown-out Reset Voltage (VBOR) set to 1.9V
#define BORV_LO 0xFFFF
// Brown-out Reset Voltage (VBOR) set to 2.7V
#define BORV_HI 0xFBFF
// Low-Voltage Programming Enable
// Low-voltage programming enabled
#define LVP_ON 0xFFFF
// High-voltage on MCLR/VPP must be used for programming
#define LVP_OFF 0xDFFF
An example in the previously quoted document is:
__CONFIG(FOSC_INTOSC &WDTE_OFF & PWRTE_OFF & MCLRE_ON& CP_OFF & BOREN_OFF & CLKOUTEN_ON & IESO_OFF & FCMEN_OFF);
__CONFIG(WRT_OFF & VCAPEN_OFF & PLLEN_OFF & STVREN_OFF & LVP_OFF);
Comparing this with the above header file you can see what each configuration macro will enable/disable. |
H: Getting a large number of (~100) digital output signals from Arduino
I would like to be able to control around 100 independent LEDs using an Arduino. The problem is that the Arduino does not have nearly enough pins that can be configured for this. What would be a way to solve this problem? Is there a chip that can demux a more complex signal from the Arduino that could then control the LEDs? Or is there another solution?
AI: First off, an Arduino cannot directly drive 100 LEDs, as the combined current that the device must source or sink will far exceed both the microcontroller, and the voltage regulator on the Arduino board. A custom Arduino Shield with its own power source and regulation might fit the bill, though.
There are several easy approaches, the simplest approach is detailed below:
TLC5940 constant-current LED driver in cascaded configuration:
The TLC5940 drives 16 LEDs per IC, controlled by serial input through a slight variant of an SPI interface. Up to 40 TLC5940 devices can be cascaded, but 7 of them will be sufficient to drive the 100 LEDs in the question.
There are at least a couple of Arduino libraries (1, 2) for the TLC5940.
Suggested clock rates to send from the Arduino, and corresponding refresh rate:
1 MHz GSClk using code in this thread.
330 KHz SCLK (serial data clock)
Thereby, LED data refresh rate 244 Hz
This is based on the formulas from the datasheet:
f(GSCLK) = 4096 * f(update)
f(SCLK) = 193 * f(update) * n
where:
f(GSCLK): minimum frequency needed for GSCLK
f(SCLK): minimum frequency needed for SCLK and SIN
f(update): update rate of whole cascading system
n: number cascaded of TLC5940 devices
The TLC5940 is a constant current sink, so the anodes of the LEDs would be tied to a voltage a couple of volts greater than the LED Vf, or around 7 volts, whichever is lower, powered independently of the Arduino's power pins. This voltage source needs to be capable of supplying 100 * (whatever current you run the LEDs at), but can be an unregulated source.
The LED cathodes go to the drive lines of the respective TLC5940 ICs.
The TLC5940 itself consumes up to Icc = 60 mA per device during data write, so powering 7 of them from the Arduino won't work, it will require an independent 3.3 to 5 volt regulated Vcc to be provided, ideally the same value as the Vcc of the Arduino being used, and the ground traces need to connect back to the Arduino's ground, of course. Operating the TLC parts at a different voltage than the Arduino would bring in a need for level conversion of the serial signal, hence best avoided.
Several YouTube videos demonstrate using Arduino with cascaded TLC5940 ICs.
MAX7219 (serial) / MAX7221 (SPI) 8-Digit LED Display Drivers:
Although these ICs were designed for driving 7-segment numeric LED displays, they provide individual LED control, so can be used for up to 64 LEDs per IC. Two of them can be cascaded to drive the 100 LEDs required. Page 13 of the datasheet shows a cascade configuration.
The LEDs would have to be electrically connected as groups of up to 8 LEDs each sharing one cathode line (common cathode), for this design.
The MAX7219/7221 are multiplexing LED drivers, hence maximum brightness of LEDs will be lower than for a static LED driver like the previous section.
Here is a useful LED matrix library and guide using the MAX7219.
Some relevant YouTube videos (1, 2) may be of interest.
Charlieplexing: SPI LED drivers, MAX6950 / MAX6951
Again, these ICs were designed for driving 7-segment numeric LED displays, they provide individual LED control, so can be used for up to 40 / 64 LEDs per IC. Two / three of them can be hooked up on an Arduino SPI bus to drive the 100 LEDs required.
Design notes remain the same as the previous section. Also, individual LED maximum brightness would be lower than for the straight multiplex design of the MAX7219.
There are some YouTube videos that might be of interest.
Discrete component designs, shift registers, IO expanders, cuttable LED strips with individual controllers, and many more...
These are all approaches that have been used with varying levels of simplicity and success. They are more complex implementations than the 3 approaches above, hence not detailed any further. Searching the web would yield useful guides for these approaches, if needed.
One key irritant with such designs is the need for current control resistors on every LED or LED string. Devices specifically designed for LED driving typically do not need this.
I don't have personal experience with this last set of options, so cannot help much.
Footnote: After responding to this question, I found an older question, that has answers detailing and discussing several of the approaches in my last section. That thread makes interesting "further reading as homework". |
H: TS jack to XLR?
I made my own cable to connect iPhone 4S to mixer. An iPhone TRRS jack has 4 poles (tip, ring, ring, sleeve) for (left, right, ground, mic ) respectively. I used a TS plug instead, connecting pin 2 in XLR to tip ( hot ) and pin 1 to ring ( sleeve or ground ), pin 3 unused...
The technician saw this wire and told me it will make an electrical short and damage the iPhone because it shorts the right speaker to ground with mic. TRRS ---> TS
Is that true?
AI: Technically, yes, it is true... with caveats.
A TS will, in fact, short across the Right, Mic, and Ground connections. However, it is extremely unlikely (although possible if they made them in an absolutely idiotic way), that it would severely damage your phone. The reason it is doubtful is that it is making a connection to the ground, not just the mic, which means that the signal is not feeding from the right channel to the mic input, but, rather, both are shunted directly to ground. However, because of that shorting, your cable may actually work.
That said, it won't work very well. If i understand correctly, you are wanting to feed the signal into an audio mixing console, or something similar. The problem is that the phone provides a headphone-level signal (amplified), and your console is expecting a mic or line level signal (essentially unamplified, possibly buffered) through that XLR input. If you turn the volume way down on your phone, and your console is decent, it will likely work, in that aspect. If your cable length is very long, though, you'll be picking up quite a bit of noise in the wire, as your design defeats the noise-cancelling balancing typically utilized in that scenario.
To make the proper cable, you would be better off using an actual 1/8" TRRS connector (readily available), and wire the Right and Left signals (as well as the ground, obviously) to 2 1/4" TS plugs. Most audio mixers will handle a much hotter signal on their 1/4" inputs. A Direct Box could even be used to take advantage of the balancing available on a XLR cable, and, since most Direct Boxes have a pad switch, it may even match the level, as well as the impedance.
Update:
i should add that i don't have an iPhone 4S... just an old 3G... i have long switched to an Android phone. So, i cannot do any tests or measurements on your exact phone model. But, i, and many others, have used TRS connectors on the 3G, which shorts from mic to ground, with no problems - it is designed for that. And, it is impossible to create feedback with a TS connector, since they are all shorted to ground. i will advise, however, that you not use the TS connector for long periods, as some testing of the 3G at higher volumes indicates that the current on the shorted output might be enough to cause overheating. i recommend using a TRS connector, at minimum. The ring contact on the connector should be left unconnected to the cable.
Update, referencing the equipment being used:
The Fohhn Software does not transfer audio, nor does it directly process any audio. It is merely a control network, according to the Fohhn website and technical documents.
The signal chain in your installation is, likely, like this (simplified):
iPhone --> Allen&Heath mixer --> Fohhn Amplification System
The Fohhn Software controls the EQ settings (among other things) for the system as a whole.
You should be using a 1/4" plug, as i previously suggested, plugged into one of the 1/4" channel inputs on the mixer. Although, the XLR on that mixer should also work, as per my recommendations and caveats above. Start with the iPhone volume reduced, and bring up as necessary. If a lot of noise is produced, try unplugging the iPhone from it's charger. If that doesn't get rid of the noise, it is most likely that your cable is the culprit.
Use the EQ settings on the mixer, itself, to "tweak" the settings, if it is even necessary.
It reads like you might be trying to make EQ changes within the Fohhn software before the event, offsite (not while actually using the sound system). That won't work, because the Fohhn software doesn't actually process audio. It is possible to make an EQ scene for the Fohhn system, specifically with your sound file in mind, but i don't recommend that approach, as it is a systemic change to the entire system, not just that particular source.
If there is EQing that MUST be done beforehand, use audio editing software (like "Audacity" which is free) on the audio file itself. But, i highly doubt that would be necessary, as the channel EQ on the mixer should be far more than adequate, and, if frequently needed, the settings can be reproduced in a matter of seconds.
Your last comment/description also reads like you might be trying to play a sound file through the system, so that you can create an EQ setting that will work well with your IMAM's vocal microphone. If so, you can certainly use this to get in the ballpark, but keep in mind that your recording is likely to be compressed, and of limited frequency bandwidth. i would still advise using the mixer's channel EQ if there are other sources being used, other than the one vocal microphone.
With either situation, the cable should work as i described above, and a TRS connector into the iPhone is recommended. Is your question satisfactorily answered?
If you have need of more assistance on the equipment, please be sure to list the exact model numbers of the equipment you are using, not just the manufacturers. |
H: FT245R transmit buffer filling up, repeated IOCTL_SERIAL_WAIT_ON_MASK messages
I'm stress testing the FT245R chip using a basic CPLD to negotiate reading and writing with the chip and PC as the USB host.
Basically I have programmed up the CPLD to read in 8 bit words from the USB host, store these data and then when I have two words stored, request to write them back.
I am testing with realterm. I use the Send tab to send some ASCII characters i.e. 'abcdef'. This works fine with 1 repeat, 10 repeats but at 100 repeats, I get some inconsistent counts. If I push it all the way and use thousands of repeats, something interesting happens - the TXE signal of the FTDI chip goes high and stays high (from the datasheet: "When low, data can be written into the FIFO. When high, do not write data into the FIFO"). Nothing else will happen, the RXD indicator in realterm stays solid.
Is the FTDI chip indicating I can't write because the USB host i.e. realterm is not reading from the FIFO transmit buffer? The only way to exit this state seems to be to close the COM connection... should it be this easy to crash a communication session? How can I mitigate that risk from the CPLD side of things? Perhaps reset the module when it detects TXE is high for too long?
The datasheet is rather unclear but here it is for reference. I'll be really grateful if you can shed some light on what's happening and how to proceed.
--
Some more information on what's happening, now I've spied on the port messages with Portmon:
IRP_MJ_WRITE Length: 12
IRP_MJ_WRITE Length: 90
IRP_MJ_WRITE Length: 180
IRP_MJ_WRITE Length: 198
IRP_MJ_WRITE Length: 204
IOCTL_SERIAL_WAIT_ON_MASK SUCCESS
IRP_MJ_WRITE Length: 198
IRP_MJ_WRITE Length: 204
...
Inbetween these writes as you can see above we get a WAIT_ON_MASK request. From what I understand this is an instructino from realterm to the FTDI driver to wait for the FTDI chip to do any of the set wait masks, namely:
IOCTL_SERIAL_SET_WAIT_MASK Mask: RXCHAR CTS DSR RLSD BRK ERR RING
BUT what is happening to me is, after I have sent a huge number of WRITEs, (in amongst these wait messages), I get into a state where I simply get repeated IOCTL_SERIAL_WAIT_ON_MASK messages. This goes on and on, and I cannot stop this unless I close the port (whereupon IOCTL_SERIAL_PURGE messages are sent successfully).
I can hence reopen the port and the connection is fine, i.e. with a smaller burst of writing I get all the data echoed back (as I have configured the CPLD controlling the FTDI chip to do).
IT is probably worth noting also that in this state where after I have sent LOTS of write commands, at the point it starts to hang the FTDI chip indicates no ability to write (i.e. TXE remains high, the datasheet is not clear but I think this means the FIFO write buffer is full). If I disconnect during the long sequence of WAIT messages I note an:
IRP_MJ_WRITE CANCELLED
message of usually quite a long length.
--
Datasheet:
http://www.ftdichip.com/Support/Documents/DataSheets/ICs/DS_FT245R.pdf
CPLD Code (VHDL):
----------------------------------------------------------------------------------
LIBRARY IEEE;
USE IEEE.STD_LOGIC_1164.ALL;
ENTITY main IS
PORT ( clk : IN STD_LOGIC; -- 8 MHz, 125 ns osc
rst : IN STD_LOGIC; -- reset (ACTIVE LOW)
usb0_rxf_led : OUT STD_LOGIC; -- usb activity, illuminate with logic 0
usb1_rxf_led : OUT STD_LOGIC; -- unused, illuminate with logic 0
max_temp_log_led : OUT STD_LOGIC; -- overtemp, illuminate with logic 0
one_wire_bus : INOUT STD_LOGIC; -- 1-wire bus with thermometer
-- usb ctrl
usb_rd : OUT STD_LOGIC;
usb_wr : OUT STD_LOGIC;
usb_rxf : IN STD_LOGIC;
usb_txe : IN STD_LOGIC;
-- usb databus ports
usb_db0 : INOUT STD_LOGIC;
usb_db1 : INOUT STD_LOGIC;
usb_db2 : INOUT STD_LOGIC;
usb_db3 : INOUT STD_LOGIC;
usb_db4 : INOUT STD_LOGIC;
usb_db5 : INOUT STD_LOGIC;
usb_db6 : INOUT STD_LOGIC;
usb_db7 : INOUT STD_LOGIC;
-- plel databus ports
plel_db0 : INOUT STD_LOGIC;
plel_db1 : INOUT STD_LOGIC;
plel_db2 : INOUT STD_LOGIC;
plel_db3 : INOUT STD_LOGIC;
plel_db4 : INOUT STD_LOGIC;
plel_db5 : INOUT STD_LOGIC;
plel_db6 : INOUT STD_LOGIC;
plel_db7 : INOUT STD_LOGIC;
plel_db8 : INOUT STD_LOGIC;
plel_db9 : INOUT STD_LOGIC;
plel_db10 : INOUT STD_LOGIC;
plel_db11 : INOUT STD_LOGIC;
plel_db12 : INOUT STD_LOGIC;
plel_db13 : INOUT STD_LOGIC;
plel_db14 : INOUT STD_LOGIC;
plel_db15 : INOUT STD_LOGIC
);
END main;
ARCHITECTURE Behavioral OF main IS
-- define states (in terms of ftdi chip, i.e. reading from usb host, writing to usb host)
TYPE usb_state_type IS
(idle, read_ready, reading, read_done, write_req, writing, write_complete, inout_initialise);
SIGNAL next_state : usb_state_type;
-- constants
CONSTANT fsm_delay_const : INTEGER := 1; -- 1/const = delay factor
CONSTANT write_timeout_const : INTEGER := 80000; -- clock cycles (125 ns) : 80,000 = 10 ms
--signals
SIGNAL read_store : STD_LOGIC_VECTOR (15 DOWNTO 0) := "0000000000000000";
SIGNAL write_waiting : STD_LOGIC := '0';
SIGNAL counter : INTEGER RANGE fsm_delay_const DOWNTO 0;
SIGNAL write_wait_counter : INTEGER RANGE write_timeout_const DOWNTO 0;
SIGNAL fsm_enable : STD_LOGIC;
SIGNAL word_half_rd : STD_LOGIC;
SIGNAL word_half_wr : STD_LOGIC;
SIGNAL usb_rxf_d0 : STD_LOGIC;
SIGNAL usb_rxf_d1 : STD_LOGIC;
SIGNAL usb_txe_d0 : STD_LOGIC;
SIGNAL usb_txe_d1 : STD_LOGIC;
BEGIN
run:
PROCESS(clk)
BEGIN
IF RISING_EDGE(clk) THEN
IF(rst = '0') THEN
-- Reset states
next_state <= idle;
usb_rd <= '1';
usb_wr <= '0';
usb_db0 <= 'Z';
usb_db1 <= 'Z';
usb_db2 <= 'Z';
usb_db3 <= 'Z';
usb_db4 <= 'Z';
usb_db5 <= 'Z';
usb_db6 <= 'Z';
usb_db7 <= 'Z';
plel_db0 <= 'Z';
plel_db1 <= 'Z';
plel_db2 <= 'Z';
plel_db3 <= 'Z';
plel_db4 <= 'Z';
plel_db5 <= 'Z';
plel_db6 <= 'Z';
plel_db7 <= 'Z';
plel_db8 <= 'Z';
plel_db9 <= 'Z';
plel_db10 <= 'Z';
plel_db11 <= 'Z';
plel_db12 <= 'Z';
plel_db13 <= 'Z';
plel_db14 <= 'Z';
plel_db15 <= 'Z';
one_wire_bus <= 'Z';
max_temp_log_led <= '1';
--usb1_rxf_led <= '1';
write_waiting <= '0';
word_half_rd <= '0';
word_half_wr <= '0';
ELSIF fsm_enable = '1' THEN
usb_rd <= '1';
usb_wr <= '0';
CASE next_state IS
WHEN idle =>
IF (write_waiting = '1') THEN
next_state <= write_req;
ELSIF (usb_rxf_d1 = '0') THEN
next_state <= read_ready;
ELSE
next_state <= idle;
END IF;
WHEN read_ready =>
-- rxf low, data available. set rd# low
usb_rd <= '0';
next_state <= reading;
WHEN reading =>
-- valid data within 20-50 ns. one period is 125 ns so valid data should definitely be
-- available by now.
-- read and store with valid data. set rd# high again
usb_rd <= '1';
CASE word_half_rd IS
WHEN '0' =>
read_store(0) <= usb_db0;
read_store(1) <= usb_db1;
read_store(2) <= usb_db2;
read_store(3) <= usb_db3;
read_store(4) <= usb_db4;
read_store(5) <= usb_db5;
read_store(6) <= usb_db6;
read_store(7) <= usb_db7;
word_half_rd <= '1';
WHEN '1' =>
read_store(8) <= usb_db0;
read_store(9) <= usb_db1;
read_store(10) <= usb_db2;
read_store(11) <= usb_db3;
read_store(12) <= usb_db4;
read_store(13) <= usb_db5;
read_store(14) <= usb_db6;
read_store(15) <= usb_db7;
word_half_rd <= '0';
write_waiting <= '1';
WHEN OTHERS =>
END CASE;
next_state <= read_done;
WHEN read_done =>
next_state <= idle;
WHEN write_req =>
IF (usb_txe_d1 = '0') THEN
-- pull wr high, with valid data on d0-7
usb_wr <= '1';
CASE word_half_wr IS
WHEN '0' =>
usb_db0 <= read_store(0);
usb_db1 <= read_store(1);
usb_db2 <= read_store(2);
usb_db3 <= read_store(3);
usb_db4 <= read_store(4);
usb_db5 <= read_store(5);
usb_db6 <= read_store(6);
usb_db7 <= read_store(7);
word_half_wr <= '1';
WHEN '1' =>
usb_db0 <= read_store(8);
usb_db1 <= read_store(9);
usb_db2 <= read_store(10);
usb_db3 <= read_store(11);
usb_db4 <= read_store(12);
usb_db5 <= read_store(13);
usb_db6 <= read_store(14);
usb_db7 <= read_store(15);
word_half_wr <= '0';
write_waiting <= '0';
WHEN OTHERS =>
END CASE;
next_state <= writing;
ELSIF (write_wait_counter > 0) THEN
-- cannot write this time! should we timeout?
write_wait_counter <= write_wait_counter - 1;
next_state <= write_req;
ELSE
-- cannot write, we have waited long enough. abort the write.
write_wait_counter <= write_timeout_const;
write_waiting <= '0';
next_state <= inout_initialise;
END IF;
WHEN writing =>
-- drop wr low, data is written to FIFO when txe drops
usb_wr <= '0';
next_state <= write_complete;
WHEN write_complete =>
-- stay in this state until ft254r has accepted the write into fifo
next_state <= inout_initialise;
WHEN inout_initialise =>
usb_db0 <= 'Z';
usb_db1 <= 'Z';
usb_db2 <= 'Z';
usb_db3 <= 'Z';
usb_db4 <= 'Z';
usb_db5 <= 'Z';
usb_db6 <= 'Z';
usb_db7 <= 'Z';
next_state <= idle;
WHEN OTHERS =>
next_state <= idle;
END CASE;
END IF; -- enable
END IF; -- clock
END PROCESS;
delay_proc:
PROCESS (clk)
BEGIN
IF RISING_EDGE(clk) THEN
IF rst = '0' THEN
--DO RESET LOGIC HERE...
fsm_enable <= '0';
counter <= fsm_delay_const;
ELSE
fsm_enable <= '0';
IF counter = 0 THEN
fsm_enable <= '1';
counter <= fsm_delay_const;
ELSE
counter <= counter - 1;
END IF;
END IF; --ELSE IF rst = '1' THEN
END IF; --IF RISING_EDGE(clk) THEN
END PROCESS;
activity_led:
PROCESS (usb_rxf)
BEGIN
usb0_rxf_led <= usb_rxf;
usb1_rxf_led <= usb_txe;
END PROCESS;
anti_meta:
PROCESS (clk)
BEGIN
IF RISING_EDGE(clk) THEN
IF rst = '0' THEN
usb_rxf_d0 <= '1';
usb_rxf_d1 <= '1';
usb_txe_d0 <= '1';
usb_txe_d1 <= '1';
ELSE
usb_rxf_d0 <= usb_rxf;
usb_rxf_d1 <= usb_rxf_d0;
usb_txe_d0 <= usb_txe;
usb_txe_d1 <= usb_txe_d0;
END IF;
END IF;
END PROCESS;
END Behavioral;
AI: Yes, you are indeed filling up the FT245R's 256-byte transmit buffer.
Remember, USB is fundamentally a half-duplex communications protocol. If you send hundreds of bytes to a device in a burst, there's no opportunity to receive bytes back from the device until the burst is over.
Your CPLD is having no trouble accepting data from the 128-byte receive buffer, keeping it from filling up, at least until the transmit buffer fills up. But with a total transmit capacity of 256 + 2 bytes of buffering, any burst over 258 bytes is likely to fail.
There is some "randomness" in the results with hundreds of bytes because of the fact that Windows polls the device status every 1-2 ms. If it happens to poll the device in the middle of a large burst, before the FIFO has filled up, it will drain the available data from transmit FIFO, making room for another 258 bytes before it fails. But at a peak transfer rate of 1 MBps, any transfer longer than about 500 bytes is pretty much guaranteed to fail.
Bottom line is, if you need to transfer large amounts of data in bursts, you need to have sufficient memory for buffering those bursts outside the FT245R.
If you can use your CPLD to set up a 2-KB data FIFO (perhaps using an external chip), your stress test will work perfectly with any amount of data. |
H: PIC16: How do I modify the configuration words?
As I understand, the configuration words are different to the standard 8 bit registers. They are 14 bit wide, and they can only be accessed in "programming mode".
From reading the datasheet I do not understand how to enter programming mode and then modify the configuration word. Can I modify the programming word from my C code (e.g. within the main function), or should I somehow instruct my programmer (PICKIT 3) to do some magic before the main function is reached?
AI: I do not quite understand how I'm meant to enter programming mode and then modify the configuration word? Can I modify the programming word in my C code (e.g. within the main function)?
The configuration words are mapped in program/instruction memory. They are mapped at an address location which is not accessible during normal device operation (it can be accessed only during programming mode). These configuration bits specify some of the modes of the device, and are programmed by a device programmer, or by using the In-Circuit Serial Programming (ICSP) feature of the midrange devices. So you should set these configuration bits in your code, but outside of any functions, using a compiler specific #pragma or macro.
From the XC8 User Guide:
The configuration bits for baseline and mid-range devices can be set with the
__CONFIG macro which was supported in HI-TECH C, for example:
#include <xc.h>
__CONFIG(WDTDIS & HS & UNPROTECT);
To use this macro, ensure you include in your source file. For
devices that have more than one configuration word, each subsequent
invocation of __CONFIG() will modify the next configuration word in
sequence. Typically this might look like:
#include <xc.h>
__CONFIG(WDTDIS & XT & UNPROTECT); // Program config. word 1
__CONFIG(FCMEN);
The easiest way to set your device's configuration bits is through MPLAB X. Instructions taken from here:
From the main menu select Window ▶ PIC Memory Views ▶ Configuration Bits
In the configuration bits window, click on any value in the Option column and it will turn into a combo box that will allow you to select the value you desire.
Click on the Generate Source Code to Output button
The IDE will automatically generate the code necessary to initialize all the configuration bits to the settings you specified in the window. This code may now be copied and pasted into one of your source files, or you may save it to its own file and add it to your project. To save the file, right click anywhere in the output window and select Save As from the popup menu.
Further reading:
MPLAB XC8 C Compiler User’s Guide
PICmicro MID-RANGE MCU FAMILY: Section 27. Device Configuration Bits
MPLAB X Wiki |
H: How to measure RSSI of bluetooth devices on PC
I'm a student in highschool doing research for a science project. I want to measure the RSSI of bluetooth devices on my Windows PC. I've searched on the internet for around 3 days but found no success.
The only method seems to be using a software called Bennett. However, it doesn't give me the signal strength. I contacted the company and they said Windows doesn't support such measurements. They told me to install Bluesoleil to run their software. However, Blueleil seemed to be not working on Windows10 and their website seemed quite sketchy.
I also heard that I could measure bluetooth signal strength on Mac OS. However, when I tried the same thing shown on online tutorial with my friend's mac, it didn't work. It seems like Apple removed the feature as time passed.
So I've thought about getting an Arduino and a HC-05 sensor and use some methods discussed on this website to get RSSI. But it would take some time to order the parts and get that thing working. I'm in a hurry as the deadline for my project is incoming, and I've got basically nothing done.
AI: "Signal Strength" != RSSI.
RSSI is an indicator for how well receivable a receiver considers a signal – that's typically not inherently dominated by the signal strength, but by factors like noise and interference.
Thus, it's a device-specific estimate for how well the bluetooth device is able to receive someone else. Nothing more, nothing less. Be careful in your report not to completely conflate it with signal strength. If everything else stays constant (mainly: the other things using the 2.4 GHz band), then, however, RSSI will at least for the most part be proportional with some unknowable factor to received signal strength.
Bluetooth interface devices communicate with the host computer through a protocol called HCI. That's pretty standard, and it even offers a command to read the RSSI of a logical bluetooth connection.
I'm thus very surprised it should be hard under Windows or OS X to get an RSSI estimate using "on-board tools"; but then again, I'm an engineer and never use Windows for anything technical...
Under Linux, it'd be trivial to get the RSSI after connecting to a pairing partner device:
hcitool rssi AA:BB:CC:DD:EE..
where you of course replace the AA:.. string with the bt address of your connection.
hcitool is super handy. Quite possibly hcitool scan already contains all you want; hcitool lescan if you want to work with Bluetooth Low Energy beacons; hcidump --raw will simply print out all the packets flying by after triggering a scan, including info about RSSI.
(You can get a live USB Linux image that you don't have to install to anything; you'd just write it to a USB stick and boot your PC/laptop from it, and then would have a working Linux system without touching your main system.) |
H: VCO circuit Analysis
can you help me with the basic comprehension of this Voltage Controlled Oscillator scheme (it was used in a PLL)?
I do not understand why there are two varactors instead of one, and the role of the variable capacitance CT.
Reference: http://mwl.diet.uniroma1.it/people/pisa/RFELSYS/L03_VCO_PLL_Phase%20noise.pdf
AI: There is no VCO 'reason' to have two varactors, they are functionally in parallel.
We therefore need to guess why the system found it convenient to provide two varactors.
The labelling of the tune lines to the varactors gives us a clue. \$V_T\$ is probably a 'tune' line, used to set the varactor to a coarse setting, static, as there is no t parameter. \$e_v(t)\$ is probably an error voltage back from the PLL, varying in time.
The relative weight of these two varactors can be set by the values of \$C_{D1}\$ and \$C_{D2}\$. A value larger than the varactor capacitance allows more or less the full varactor variation to affect the loop. A value much small than the varactor value attenuates the effective varactor swing at the PLL.
Why make \$C_T\$ a manually adjusted variable? It might be for a coarse pre-setting of the centre frequency of the VCO. However that type of VCO needs a particular range of capacitor ratios to actually oscillate. Perhaps the FET used has large enough parasitic variations that each one needs to be tuned after manufacture.
Noise in a VCO is a parameter that's particularly difficult to guess at from just a circuit diagram. There's a wide range of applications for PLLs, some of which require exquisitely low noise, others of which don't. That might have driven the separation of the varactors, rather than use a single varactor with a composite drive, and a manual adjuster control to 'peak up' the VCO, who knows? |
H: STM32 (SWD) printf not working
I'm new using STM32 microcontrollers. I have been trying to use the printf tracing in my code without success, nothing is printed on the console. I can start a debug session, I can place breakpoints on my code, inspect variables and all works as expected but not the printf.
My setup:
I have reimplemented the _write method:
int _write(int32_t file, uint8_t *ptr, int32_t len)
{
/* Implement your write code here, this is used by puts and printf for example */
int i=0;
for(i=0 ; i<len ; i++)
ITM_SendChar((*ptr++));
return len;
}
And placed a breakpoint on:
__STATIC_INLINE uint32_t ITM_SendChar (uint32_t ch)
{
if (((ITM->TCR & ITM_TCR_ITMENA_Msk) != 0UL) && /* ITM enabled */
((ITM->TER & 1UL ) != 0UL) ) /* ITM Port #0 enabled */
{
while (ITM->PORT[0U].u32 == 0UL)
{
__NOP();
}
ITM->PORT[0U].u8 = (uint8_t)ch;
}
return (ch);
}
ITM->PORT[0U].u8 = (uint8_t)ch; is being executed, but there is no printf ouput on the console.
AI: There are three extra magic steps to get this working:
Serial Wire View (SWV) tracing must be enabled. You haven't specified, but the IDE you're using looks similar to Atollic TrueSTUDIO. In that IDE, you enable SWV in the Debug configuration by enabling the checkbox shown in this image:
You must "Start Trace" during every new debug session. In your screenshot it looks like you've already done it by clicking the red round button in the SWV ITM Data Console pane, but to make sure have another look around for a "SWV Console" window and click the red round button.
And you must connect the SWV pin. SWD only requires GND, SWCLK and SWDIO for debugging. If you also want Trace functionality you need to connect the SWV pin. Confusingly, the SWV pin is often called the SWO pin. It's usually shared with the JTDO JTAG pin. Should be pin 39 (PB3) on the STM32F103 Blue Pill. |
H: Testing and safety requirements for selling homemade electricals
I am currently researching and designing electrical audio equipment, example devices:
Tube and solid state guitar amplifiers
Guitar effects pedals
Mixing / filtering units
Synthesizers
Some of these devices will be mains powered and some low voltage.
For context I am in the UK and hold a Masters' degree in Electrical and Electronic Engineering.
I have had friends, relatives etc approach me to ask if they can buy some of my products.
At present I do not plan to make a business out of this but it could be a possible future consideration.
The price I would be selling the equipment at would not warrant £1000's of test certification, as I do not have the money for this I would prefer not to sell if test houses are the only option.
My primary concerns are safety and liability.
What safety standards do I need to comply with and can I self certify?
Can I remove / reduce liability by selling as a kit product / prototype?
I notice people online selling amplifier kits, presumably they are not liable for incorrect wiring / use.
AI: For compliance to EU requirements and to carry the 'CE' marking you can self-certify without using a testing agency, and to do so you need to create a declaration of conformity, which authorities can request at any time, and maintain a technical file which documents your evaluation of the design and manufacturing process' ability to maintain compliance - so that'd include some quality plan to periodically check production capabilities, and individual item testing if justified. It's up to you to determine all the requirements that are relevant to your particular application.
I'd follow suggestions to use an off-the-shelf power supply that someone else has assumed the responsibility and liability risk for, and maybe just add in some further conditioning and filtering if you're using if for a low noise application. One big reason for this is that demonstrating EMC compliance might be expensive in itself, and an off-the-shelf PSU will likely have the input suppression sorted for compliance. |
H: Component identification: SMD: 120C, F mark
What is this component? When I search on internet, I get a lot of thermal protection components, but they do not look like this.
I got it as a batch from someone, so I don't know the usage.
The dimensions are 7.5 mm x 5.7mm, it has two legs (one on the other side), which extend to the bottom (thus it must be an SMD component).
(sorry for the white spots, the camera lens was dirty).
AI: The "LF" means a Littelfuse Part. The casing is SMC, meaning it is likely a Transient Voltage Suppressor (TVS). They make an SMC part with the number SMCJ120CA, which seems like a safe bet as to what this is. The 120C is a bidirectional 120V part.
The job of this part is to limit the voltage on the line it is connected to. In normal operation, it does not conduct, but above a certain threshold, it turns on, effectively clamping the voltage between the terminals like a diode. In this case, it is meant to connect to a line that is nominally between +/- 120V, starts conducting at +/- 133, and will limit its voltage to +/- 193V. Usually the other terminal is ground, but you can also find them providing differential protection, like between cells of a battery charger.
These are typically found near connectors to prevent electrical nastiness from going inside your board and burning something sensitive. |
H: Supercapacitor based lightning-harvester
Could lightning discharges be harvested and stored in supercapacitor banks? Could supercapacitors withstand and collect lightning?
Lightning usually lasts for about 10 micro seconds and reaches potentials of hundred thousand volts. However, the energy levels of lightning are quite high: Several million Joules of energy.
If lightning harvesting is not practical on ground level, could aeroplanes benefit from lightning harvesters to collect electricity?
AI: No, supercapacitors could not withstand lightning. Very few things can, actually. You're dealing with millions of volts here; supercapacitors are usually rated for less than three volts, and even the highest-rated capacitors on the general market are rated for a few tens of kilovolts.
Additionally, there really wouldn't be any point in this, for the same reason it's not practical to generate energy from the wind in a hurricane: you're relying on an inherently random event occurring in a specific location where you've set up your infrastructure. Lightning happens more often than hurricanes, sure, but consider the cost of setting up a lightning-attracting structure (expensive) and a massive bank of capacitors (very expensive), and the buck converter to get that into a usable form (also very expensive), only to get maybe a few dozen lightning strikes a year.
While trying to find information on how much energy a lightning strike contains, I found that wikipedia actually has an article specifically on this topic. It seems there has actually been some research in this direction with, surprisingly, some success in laboratory conditions, but not anything too promising. Stick with solar power. |
H: Can a solar inverter be damaged if installed capacity is much larger than demand?
I had a dispute with my fellow. In his opinion, a power inverter can be damaged if the load is much lower (e.g 100W) than installed capacity (e.g. 10kW) of the solar system.
I am of the opinion that even in case of zero load, the inverter will not be damaged. Because as far as I know, power is "pulled" from the system and the current is not "pushed" from PV panels to inverter. The lower the load on the power inverter, the lower the load will be on PV panels. Right?
AI: An inverter can indeed supply a lower current than the solar panel rating without any system damage to the system.
If an inverter is not supplying as much power as the panels can deliver it will simply draw less current from the solar panel. If you follow the IV-curve of the solar panel you will see that lower current from the panel allows the voltage to increase toward the panels open circuit voltage.
The solar panel is not damaged by sypplying no current, and providing the inverter can withstand the maximum ("open circuit") voltage the panels produce it will not be damaged.
Image taken from this question
The solar panel output voltage varies both with load current an temperature. The colder the panels, the higher is the output voltage. But in a good design the panels should be chosen and connected to the inverter in a way that they can never exceed the maximum voltage rating of the inverter. |
H: Create new component based on existing one in Eagle 9
How can I create a new component in Eagle 9 based on an already existing one?
It used to be a relatively straightforward endeavor in all the previous versions prior to v9.0 but the process seems to have changed. There are plenty of tutorials explaining how to create a component from scratch, but so far I've found none that walks through the process of creating a new component based on an existing one.
AI: It’s fairly simple. You force a symbol duplication and it asks you for a new name. You give it a new name and save it. Then you edit and save the symbol. Ditto the device and device name then delete the old symbol in the new device and install the new symbol. Then you may need to do the same with the footprint(s).
Finally, in the device editor reconcile symbol pin names with footprint numbers and you’re good to go. |
H: Dangers of overloading a 2.5A rated plug
Got an old soviet samovar (tea kettle) and wanted to put a new plug on it as the sovet one doesn't plug into proper EU sockets.
I have a 2.5 A / 255v ungrounded plug, which I can use, but an curious as to how much current these plugs can actually take.
Likly the samovar is 2kW, so there will be short periods of 8ish amps boi going through it. And so far I haven't noticed it heating up.
Do you suspose that the plug is save?
I opened the kettle itself and the inside is clearly more scary and dangerous than the plug sovet safety standards and age of the I insulation , but I'm curious to know if the plug can handle the load, as I'm sure it's rated at 2.5 but it's got more metal than the wire itself.
AI: The risk is if the plug (or its contacts) heat up too much, they can cause a fire in the wall of your house.
I'd go buy a correctly rated plug rather than take that risk.
Also, if the wiring inside the appliance is "scary", you'd be wise to use a grounded plug and ground all user-accessible metal parts, to reduce the risk of shock.
Of course, to really reduce the risk of shock and fire, you'd be better off cutting the cord off this thing and displaying it on a shelf, while buying a new kettle with proper safety marks to make tea with. |
H: Can an isoSPI interface work without isolation?
Ive got a LTC6820 that I will be communicating with a LTC6811 and they both use isoSPI but all the example diagrams show the connections going through a transformers and twisted wire like this:
But in that example the wire between was 100m long, but I'm only going 8m tops and it will be in a shielded cable in a low noise environment, so I can't help but wonder if it would work to just have them wired like this:
simulate this circuit – Schematic created using CircuitLab
AI: I suspect, but cannot confirm that the current regulated driver won't work properly in a direct wiring scheme. Instead, see Figure 18 in the datasheet for a cheap solution vetted to work using capacitive isolation instead.
From LTC6820 Datasheet. |
H: Transistors' Scattering Parameters
I have some doubts about the Scattering Matrix of a transistor seen as a 3 port devices. Precisely, I read (for instance here) that we do not have 9 independent S parameters since there is this relation (6 equations):
So there are only 4 independent S parameters, and this is correct because generally transistors are described as 2 port networks. But I do not understand the proof of these relations. It is shown in these pictures:
First question: is the fact that the sum of current = 0 always verified? Is it a sort of Kirchoff Current Law?
Second question: we are applying equal voltages to the ports, why should this procedure be general, valid for each case?
Third question: why applying equal voltages = each current is 0 ?
AI: is the fact that the sum of current = 0 always verified? Is it a sort of Kirchoff Current Law?
Yes. One version of Kirchhoff's Current law says if you consider any surface that divides the circuit into two parts (such as a ball surrounding the transistor), then the net current through that surface is 0.
we are applying equal voltages to the ports, why should this procedure be general, valid for each case?
We consider this test case to find out some relation between the S-parameters.
But the S-parameters don't change (so long as we operate in a linear regime) when we apply a different set of sources, so the relations between the S-parameters don't change either.
why applying equal voltages = each current is 0 ?
If you apply the same voltage gate, drain, and source, then there is no potential difference between any pair of terminals, so no reason for current to flow. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.