text
stringlengths 83
79.5k
|
---|
H: Optocoupler with phototransistor base lead
I'm thinking about using 4N25 optocoupler - it has a separate lead for base of phototransistor. How do I use it? I suppose I can't leave it floating?
AI: The base terminal of certain phototransistor optocouplers is exposed to address specific design requirements, such as below. If those requirements do not exist, a part without the base pin might be a better choice - the latter are typically 4 or 6 pin parts as opposed to (usually) 8-pin parts incorporating the base pin: Usually cheaper, less space needed on the board, and less routing too.
Faster switching on trailing edge of pulsed signal:
For this purpose, a resistor is connected between base and emitter (or ground), of value calculated as per specific transistor and required switching time.
For a quick & dirty general value, just stick in a 220k to 470k resistor there.
Impulse noise immunity (or reduction) at output:
This is required when input current suffers brief spikes or sharp extraneous rise / fall, such as due to poor power regulation. A capacitor is connected between base and emitter of the phototransistor. This acts in effect like a low pass filter, adding some smoothing to the input signal, and bypassing sharp spikes. It does reduce signal sensitivity and introduce a delay, though.
For a quick and dirty value, use a 0.1 nF capacitor, though it is worth trying higher and lower capacitances, depending on adverse effects if any.
Current transfer ratio matching:
This third function applies when multiple optocouplers are used in parallel for a design. There will always be some difference in performance between parts, even from a single batch. If matching them up is critical to the application, various approaches to provide appropriate bias to the base are used.
No quick and dirty approach in this case.
To conclude: No, the base should not be left floating, or it will act as an antenna, picking up EMI noise and superimposing it on the output. |
H: Looking for a Constant Voltage/ Constant Current power supply schematic
I would like to create as an hobbistic project a power supply circuit allowing to switch between a Constant Voltage mode and a Costant Current one. When Voltage Mode is on, Current regulation should act as an upper limit as well as voltage regulator should act as a limit in costant current mode. I know how to create two separate circuit, but no idea on how to merge them in a smart way.
AI: Produce a constant current circuit.
Feed its output into a constant voltage circuit.
Can be done with 2 x LM317 or equivalent.
As long as the voltage taken by the load of the CV circuit is less than the CC setting the system will provide CV. When the load tries to draw more than the CC setting the system automatically transitions into CC mode.
To run purely as CV set CC control to max.
To run purely as CC set CV control to max.
Added:
@Felice - A single high power driver is about "how" not "what".
ie work out what you want to achieve and THEN see what circuit elements are required to do it. Olin has effectively answered your question in general terms.
Here is a simple way of doing it with linear components and a single "pass element".
Supply power via an N-Channel MoSFET - Vin to Drain, Vout from source.
Place a current sense resistor in series either twixt drain and supply or source and load.
Voltage sense Vout at the most negative point of this combination.
Convert sensed current and voltage to ground referenced voltages.
Compare these sense voltages to adjustable references and allow output voltage to rise (eg pullup on FET gate) until either of the sensed parameters is at its limit.
Limit voltage maximum using whatever senor comparator has reached its limit at any given moment.
If CV limit is reached first then the supply is a CV supply.
IOf CC limit is reached 1st supply is a CC supply.
If you turn up a reference that is the limiting one to the extent that the other non-varying sensor reaches its limit then the supply transitions smoothly CC-CV or CV-CC.
You can use the variable comparators to operate a SMPS instead of a linear supply with the same result. The SMPS can "think" that it is a Voltage controlled voltage source and it is of no "importance to it" that it is being voltage limited so that a CC condition is met. |
H: CAN controller in a CPLD
As I cannot manage to find it done on internet, I wonder if it is possible to program a CAN controller in a CPLD ? It's look like it is going to require a least an FPGA.
AI: There is a CAN Protocol controller on OpenCores. It has a size of 930 flip-flops. You can usually estimate 1 flip-flop per CPLD macrocell. Though as The Photon mentions in his answer to this question:
Finally, though the estimate of 1 flip-flop per macrocell is accurate
for classical CPLDs like the one you linked to, some vendors (Altera &
Lattice come to mind) have taken a major architectural excursion in
their newest CPLD families. These devices are more like mini-FPGAs
than like the classical CPLD, and I'm not sure that they calculate
their "macrocell-equivalent" sizes according to this formula. The new
devices are likely to have more flip-flops per device, but not allow
very wide fan-ins to the logic in each cell.
If you filter your search on Digikey to just CPLDs that have greater than 930 macrocells and that are in stock, it returns 168 results, all Altera and Lattice. So, that CAN core should fit in CPLDs of a certain architecture. |
H: How can an imported graphic be deleted?
I imported a graphic into Eagle, and what it did was make a ton of little tiny lines to get the image. I want to now delete all of that. I tried selecting the group, and then using the DELETE command. How can I delete this stuff?
AI: Here is how to delete a group:
To select the whole graphic and move it/delete it etc you use the group cmd to highlight all the mini-rectangles it makes, then select your tool (move,delete etc.) and then CTRL+right-click to execute that tool on the whole group.
Here is an additional tip on working with bitmaps in Eagle:
The import-bmp.ulp automatically puts your graphic at the origin. So before I run it I generally move my entire board away from the origin so that I can cleanly select the graphic group after importing it.
If you end up moving it in the middle of your board and then decide you don't like it, you can hide all layers except for the layer you put the graphic on and then the group command won't grab a bunch of stuff you don't want it to. |
H: Is hot glue a good insulator?
I need to mount some relays that I have soldered wires to. If I place them on a non-conductive surface and use a generous amount of standard glue from a hot glue gun, will that be relatively safe? I'll be running mains level voltage through the relays.
According to this aricle hot glue melts somewhere between 121 °C and 193 °C which I hope is much hotter than the relays would ever get.
Is there a better way to mount these relays? Obviously using a PCB would be best, but the cost is a bit prohibitive for a custom designed PCB.
AI: There are a variety of hot glue adhesives, and there's no blanket statement that could be made to cover all of them.
However, I has seen industry use (ie, on the assembly line) of hot glue around the capacitors of the high voltage section in a CRT for vibration purposes. The glue came into contact with many of the leads and PCB tracks in that area of the PCB, so I know that there are hot glues which are suitable for electrical use, and appropriate even for high voltage insulation, though insulation was not the primary goal in this case.
You can test your hot glue with a mega-ohmmeter if you have concerns about the particular formulation you are using.
Is there a better way to mount these relays?
There are relay mounts and sockets for many styles of relays. You can also get relay connectors and relays with mounting tabs. These are preferable to adhesives for many applications.
When I've needed to mount relays in a chassis I've used zip ties and hot glue for short term and light duty usage, and metal brackets for heavy duty or long term usage.
I don't typically use hot glue on the bare wires and terminals themselves, and if I do I use heat shrink tubing to insulate the wires and terminals first. |
H: UART Communication Issues
I am using a UART to communicate with RS232 on a Roving Networks RN-42 SM bluetooth module. I have the transmitter and receiver connected to a logic analyzer.
The issue that I am having is that my when i connect my uC's TX to the Roving networks RS232 RX, the logic analyzer shows that the TX line of the TX is 0'd. When I disconnect the RX of the roving networks module, it once again starts transferring data.
The images included in the links below.
Here is my transmit code:
while(1)
{
PORTC ^= 0xFF;
transmitStr((unsigned char *)CMDMODE);
_delay_ms(1000);
}
No connection to TX
Connection to TX
AI: RS-232 and microcontroller logic level UART signals are not the same thing. Generally the logic level signals are inverted for one thing. The logic level line idle level is typically high. The voltage levels are also considerably different. The logic level signals are of course at normal logic levels, which are usually 0-3.3V or 0-5V. RS-232 is below -5 V for line idle (space) and above +5 V for active (mark).
This is a common problem, so there are chips that do this conversion for you. Look up "MAX232" and you will find lots of variants by different manufacturers for logic to RS-232 conversion chips. |
H: Is noise a random process?
I have some confusion in noise signals and their nature. Can any one explain how the nature of noise signals is. Is noise a random process.
AI: Adding to @Kaz's answer, noise is normally modeled as a random process. Even an interfering RF carrier or hum can be modeled as a random process (random phase sinusoid).
The theory of random processes is very elegant and allows for simple analysis of systems with "noise".
Moreover, even deterministic components such as quantization or rounding errors are modeled as random processes (independent of the actual signal) in order to study system performance. And these approximations are quite good in general. |
H: Drawing complex shapes in Eagle
I have two parallel lines intersecting a circle. Is there a command that will break the drawing up into separate pieces (2) at the intersection points? I want to send up with what's in (3).
AI: Unlike AutoCAD or SolidWorks, there is no command in Eagle, which would break or trim lines at intersections.
Your shape isn't very complex. There are several options.
Find/calculate the coordinates of the intersection points. Then draw 2 separate arcs and 2 separate lines.
Draw a rectangle. Then change the Curve property of the sides, which will make them into arcs. |
H: Logic Levels between 5(V) and 3.3(V) devices
I am using a 5V microcontroller to communicate with a Bluetooth module operating at 3.3V.
I have regulated the output from the 5V microcontroller rail to 3.3V rail for the Bluetooth module.
Since I am using a UART, I need to use a TX pin to go to the RX. The issue here I found is that the pins to the Bluetooth module aren't tolerable to 5V. So I decided to use a voltage divider to get 3.3V on the output.
Now, I got the UART TX working on the microcontroller side. Connecting to the RX of the Bluetooth, I see a logic 1 at the output.
After some debugging I found that infact the logic level is shifting between 2.3V for logic 1 and 1.79V for logic 0 (but this doesn't register as a 0). I presume 1.79V. Looking at the schematics of the Bluetooth Module, I found that the RX pin seems to be in tri-state between 2 resistors to VCC and GND. I need a 0V or lower than a certain tolerance for logic 0.
What can I use to get the proper logic level on the output for proper serial communication?
AI: The workhorses of level shifting I use are the TXB010X and TXS010X from Texas instruments. Here, the X may be 2, 4 or 8 and represents the number of ports provided. Both are bidirectional, sense automatically who's input and who's output (and they can be mixed) and don't need external components other than a pair of decoupling caps. The TXB is the 'standard' and the TXS is an open-drain version (for GPIO and SPI, use the TXB; for I2C, use the TXS).
They are a bit expensive, but I never found a good alternative; NXP has an equivalent family, but it requires a pair of resistors per line, which complicates considerably the design. |
H: What resistor to use with this RGB LED?
i have this led, and im not sure what resistor to use to drop the 5v current to an appropriate voltage and produce the appropriate current.
the LED is rated at 200mA, but the data sheet says i should apply 150mA through it. my micro-controller outputs 5v i think, but im not sure as i do not have a multimeter, but i apply 5v to the vcc of the micro-controller.
my questions are:
what resistor should i use with this led? (i got 33 ohms as the
answer, making me thing i dont need a resistor).
if i do need a resistor, would a 1/2 watt rated resistor work? the lowest value i have is 100 ohm, is that close enough?
the data sheet does not explain how to solder the LED- do i just connect the b- and r- points to ground and the b+ and r+ to micro-controller outs, and if i want blue i do low r+ and high b+?
Sorry about the extensive questions, i never had any formal education or experience in this field. thanks!
AI: You should use 3 different resistors, one for each color, although the blue and green have the same specs.
At 150mA the forward voltage for the red is 2.2v, green is 3.5v and blue is 3.5v. So you should use a 22ohm 1watt resistor for the red, and 10ohm .5watt resistor for the green and blue. You have a bit of wiggle room on these figures, and if you don't have a resistors that can handle that wattage you can use more than one in parallel just make sure you calculate the correct resistance between them.
Also I doubt your microcontroller can provide 150mA (it's probably more like 20mA,) so you will probably need to use a transistor on each color so that they can pull enough power. Take a look at this image for how to hook up the transistor to your system. Although ignore the 12v and multiple LEDs.
You may also want to have each color driven by a PWM pin, so that you can alter the brightness of each color to change the overall color at will. |
H: High wattage speaker using low wattage amplifier
If I have a 250W amplifier and I want to use a set of speakers:
subwoofer x 1, 4 ohms x 1
mid-rage x 1, 4 ohms x 1
tweeters x 2, 8 ohms x 2
with a combined handeling wattage that surpasses 250W. will this work?
This is for a yeah 12 electronics Major Work and I need help
AI: Yes, it is possible but how well it works will depend on the specifics.
Power dissipation is a linear functional which means that the power across several loads does not depend on how they are configured.
So if you have 10 loads each dissipating 10W the total dissipation is 100W regardless of how they are connected. (although different typologies could result in different dissipation per load).
In your case though, the answer is more difficult because tweeters do not dissipate nearly as much power as sub-woofers. It might require a 200W subwoofer or more to "soak" up all the amplifier power. You run a real risk of burning up the speakers in your specific case.
That is, you can't expect the power to be evenly divided among your speakers.
You could simulate the circuits by using filters and resistive or even inductive loads for the speakers to get a better approximation or you could wire them up appropriately(so that the total load does not exceed the amps specs and and use a smaller amplifier(or lower volume) and measure the power dissipation in each device. Raise the power some and measure again. This will be the empirical way to make sure no speaker is using more power than it is rated.
Obviously if each speaker can handle 1000W then the answer is moot... since you did not provide the power dissipation capabilities of the speakers it is impossible to even give a rough estimate.
You say the total combined wattage is 250W but it really doesn't help in any way. 250/3 ~= 83.3 watts. Each speaker could be destroyed. If one speaker = 260W and the other's 5W each then one speaker will surely survive. |
H: Why are they called breadboards?
Why are solderless protoboards called "breadboards"? I've used the term for decades but couldn't answer a student's question about the name.
AI: This terminology goes waaaaay back to the days of vacuum tubes.
Generally, you would mount a number of tube-sockets on standoffs to a piece of wood (the actual "breadboard"), and do all the wiring with point-point wire and the components just hanging between the various devices.
If you needed additional connection points, you would use a solder-lug terminal strip.
Image credit: Random googling.
The story goes that an engineer had an idea for a vacuum tube device late one night. Looking around the house, the only base for his prototype that he found was indeed his wife's breadboard, from the breadbox.
Now, I'm not endorsing actually using a real breadboard. It's your marital strife if you do.
I've actually constructed a tube project using the breadboard technique. It works very well. |
H: Can you pass resistance through analog mux?
I have a digital potentiometer that I want to calibrate by sending in my commands and then measuring what the actual resistance is. However, the resistance from the digital pot is (obviously) connected to other bits of the circuit and I'd need to isolate it to get an accurate measurement.
My question is, if I use this analog mux or something similar, can I feed my "resistance" through it ?
I do believe that the analog mux is really just a "switch" and there isn't anything fancy about them and that this would work but I'd like to make sure before I go ahead any further with it.
I appreciate your time and look forward to your opinions.
Thanks!
AI: The data sheet says that it has a resistance of 0.2 ohms with an analog signal of -5.5V to +5.5V. If the output of your variable potentiometer falls between that voltage range I see no reason why it wouldn't work. You are not really feeding "resistance" through it but current, no matter how small, but as long as your voltage and current are within the specs of the device it should work.
When you are "calibrating" the device you are sending a current through it and measuring the voltage drop to get at the resistance. |
H: 2-layer USB 2.0 High-Speed routing
First off:
This is for a one-off (or two-off) hobby project, nothing more serious. If this were a commercial design, I would go 4-layer at once (though I wouldn't be designing such a project in the first place).
Going 4-layer is acceptable only if TRULY necessary; such boards cost at least twice as much in these quantities, and the 2-layer PCB still costs more than the components combined.
The goal is to pass the USB 2.0 signal, mostly unharmed, between two connectors (USB-B to USB-A, both female), nothing more; my PCB does not actually use the signal.
(If these points moves the post into "too narrow" territory, feel free to ignore them :-)
So, the question is: is this possible, with acceptable results? The main goal is, of course, to allow High-Speed (480 Mbit/s) communications.
According to the USB specification, the differential pair should have a differential impedance of 90 ohm, and a to-ground characteristic impedance of 30 ohm. However, USB appears to tolerate a fair bit of abuse; an SMSC app note (PDF) where they discuss 2-layer USB 2.0 PCB layout mentions that the single-ended impedance isn't as critical as the differential, and that a "45 to 80 ohm" range is acceptable.
The board specs are 1 oz copper, with 63 mil FR-4 in between.
According to a few impedance calculators, such as this one (which, unless I misunderstand something, doesn't display the single-ended impedance as well), it appears that 50 mil traces with 10 mil spacing gives ~90 ohm differential and ~80 ohm Z0.
(Those values are from the Saturn PCB Toolkit calculator which is free, but requires download.)
The traces would be on the order of 3 inches long, and likely go in an upside-down U shape to go near the board edges, so that I have space to route everything else (sub-MHz signals only) without breaking the ground plane under the USB traces.
I do of course realize that the entire endeavor is a bit insane; however, again, it's for a hobby board, and it appears to have been done by serious companies as well.
High-speed is really still a bit beyond me, but the rest of the project is simple; I just need to get this signal across the PCB and everything else is a piece of cake.
If you missed it, the main question is: is this possible, with acceptable results?
If there are better 2-layer routing methods (for example, this short article uses coplanar waveguide routing for this purpose), please do tell. I can't find much information (that is both detailed and understandable, but with no details or equation/calculator mentions) about this at all.
AI: Summarizing comment trail as an answer:
The requirement is for a PCB layout for a pass-through between USB2.0 A and B connectors on a PCB. The rest of the circuit on the PCB does not interact with the USB signal path.
Suggested solution:
By changing the physical arrangement of the two sockets to be close together rather than at opposite sides of the board as originally envisaged, the signal trace length and transmission effect concerns are alleviated.
Further, by setting the two connectors at right angles to each other, at one corner of the board area, the need to leave space between them to allow cables to be plugged in, is addressed: The cables would be connected along different edges of the board and would not touch each other.
This allows simplification of routing as well:
The recommendation for equal length signal paths is inherently addressed
The arrangement does not interfere with rest of PCB layout, as it is off in a corner
With the indicated small trace length, transmission line and antenna effects are negligible for USB 2.0 High-Speed transmissions
(as posted by OP).
Concerns that may need addressing:
Physical robustness of PCB to cope with stresses of repeated cable insertions - A mounting bolt at the corner between the connectors should address this.
Effective total length of USB cable, adding up the A-side and B-side cables, may exceed USB maximum cable length. The very short PCB section would act merely as an extension of the cable.
Creative solutions needed for suitably boxing the board with connectors at the corner. |
H: Establish connection between analog and GSM modem
I want to know if I can call a GSM modem (a SIEMENS MC55) from a normal analog (PSTN) modem. If so, how do I have to configure the GSM and the analog device? I've read about the +FCLASS and +CSNS commands but the connection doesn't work - I'm getting a BUSY or NO CARRIER. Are there other requirements?
AI: After extending the initialization string of the GSM modem with 'AT+CSNS=4' the device was able to connect with analog modems. |
H: Use a 12 volt bulb in 110 AC socket?
If I were go get this light bulb (with the following specs). Would there be a way to use it in a standard U.S. light socket?
Specifications:
Interface type: E27
Input voltage: 12V
Power: 3W
I am interested in even the weird solutions, though they may be of only intellectual benefit.
AI: The easiest way is probably to use an AC to DC adapter that you may already have. Like the one you use to power your router and/or modem, just make sure it has 12 VDC output and can provide at least: $$ 3W/12V = 250 mA $$ which almost surely is the case, but you need to check it to make sure (the output voltage and current capacity should be on a sticker).
If the bulb doesn't turn on at the first try, flip the polarity and try again.
If you want to make it permanent you could get a light socket and wire it to the AC adaptor (instead of directly to mains). |
H: computing shunt resistence for a microammeter
Let's suppose I have a dc microammeter with a range of 100 ua that claim to have an internal resistence of 1Kohm.
I want to use this instrument to measure a range of 1A. I'm assuming I need a shunt resistence producing a voltage drop makinga 100 ua current flowing in the instrument:
i*Ri=I*Rshunt
where i is the instrument range, Ri the internal resistence RShunt the unknown shunt resistence and I is the desired range. For a range of 1A this yield a resistence of 0.1ohm, am I wrong ?
AI: The calculation is correct.
If the micrommeter has a full-scale deflection at 100 microamperes, across an internal (coil) resistance of 1 kilo Ohm, then it deflects fully when a voltage of 0.1 volts develops across it.
To generate that voltage against a 1 Ampere current, the resistance (shunt) required is 0.1 Ohms. The parallel resistance of 1 kOhm is negligible in this situation due to a 4 order of magnitude difference between them.
For lower current measurement, such that the shunt resistance would be within an order or two of magnitude of the coil resistance, the parallel resistance network comprising of the shunt and the coil must be taken into account. |
H: Half-H bridge or low-side MOSFET for PWM motor control
I'm driving a DC motor (12 V, approx. 4 A) and I need to control the speed by PWM but I need one direction only and braking is not required.
My question is: is there any advantage to using a half-H bridge over using a simple low-side N-channel MOSFET (e.g. a IRLS3034-7PPbF)?
I'll be using a MOSFET driver (IXDN404 or similar) in order to switch fast enough and provide enough current to the gate and the PWM will be generated by an MCU.
AI: If this is a simple brushed DC motor with just two connections, then yes, you can tie one lead to power and use a low side switching element on the other. Don't forget to put a reverse Schottky diode accross the motor else the switch will get destroyed from the high voltage pulses.
At only 12 V, you can find N channel FETs that will switch well enough directly from a digital signal. These are often called "logicl level" FETs. In that case you don't need a FET driver.
Another possibility is a NPN as the switch. That is easy to drive from low voltage logic, but turning off a saturated bipolar is always a bit tricky. It depends on how fast you want to go. For a normal motor drive PWM frequency of about 25 kHz, it should be fine. However, unless you are using unusually low logic levels or the micro has a weak output drive, I'd look at logical level N channel FETs first. |
H: Testpoints: Vias versus pads
I was fixing an ultra cheap home router few days ago and noticed that it had vias marked TP_12V, TP_3V3, TP_GND and similar. The problem turned out to be leaky electrolytic crapacitors in the buck converter and the vias really helped debugging that, but that's not the main point of this question.
What I really wanted to ask is in general is there any reason why not to use vias as test points? All test points I've previously seen were exposed copper pads which were helpful, but were a bit difficult to use because I'd need to connect the scope probe to a flat surface. Here vias were just the right diameter to hold the tip of standard multimeter or scope probe in place without need for any external tools.
I suspect that vias would be a little bit more expensive than normal copper test points (but again, this was found on a sub $15 unit) and that they would be less durable than simple pads.
I suspect that the bed of nails devices used for production testing would need to be a bit more precise for this to work nicely, but I don't know how big problem that would be.
So did I miss any reason why to use copper pads instead of vias for test points?
AI: I actually prefer vias as testpoints for just the reasons you mentioned. I think it makes using a multimeter or a scope probe much easier. Which, after all, is the main use of testpoints.
Where possible/practical, I like to size my vias large enough or use small plated through holes so that 30 gauge wire can easily be soldered in. Then I can clip a scope probe to the wire and have my hands completely free to operate a computer or other test equipment.
The reason not to use vias and especially not to tack wires on is the additional inductance and capacitance that such features would add to the trace and therefore distort your signal. This is of great importance when you're trying to measure high speed signals. Here is a good article on calculating via inductance.
$$L_1 = \dfrac{\mu}{2\pi}2h\cdot ln\dfrac{s}{r}$$
Where:
\$\mu = 4\pi\cdot10^{-7} H/m\$ - the magnetic permeability of free space
\$x\$ - the radial distance in meters away from the signal via
\$s\$ - the separation between vias, center-to-center
\$h\$ - the separation between planes 2 and 3
\$r\$ - the radius of the via holes
Keep in mind that this formula makes some assumptions that the author notes and is therefore just an approximation:
This formula for L? is a gross approximation that glosses over the
position of the returning current path, a simplification I greatly
regret not making more clear in the book. It makes the crude
assumption that the return path is approximately coaxial and located
at a distance s=2eh, where e is the base used for natural logarithms.
When the inductance really matters, a more accurate approximation is
needed.
However, the article Test Pads on High-Speed Nets points out the problems that that form of instrumentation can cause.
If the signal is on an outer layer, it’s not possible to place a 35
mil test pad directly on a 5 mil wide trace without creating a PCB
routing nightmare. Differential signals are intended to be closely
coupled, and the radius of the test pad will create additional routing
constraints where they are already likely to be over-constrained:
Instead they recommend using non-intrusive technologies when trying to measure high speed signals. Which leads me to believe that, on signals that can handle the additional inductance and capacitance of a via, there is no reason to use a test pad given the benefits a via gives to using a meter or a probe. |
H: Will a BigEasy driver handle 14 amps?
I'm getting some conflicting information regarding the BigEasy stepper driver. I have a 24VDC 14.6A electromagnet that I need to toggle. I have a few Arduino Mega's and a box full of BigEasy stepper drivers that I would like to utilize to accomplish this as I'm extremely short on time.
I know the BigEasy can take the 24VDC but what about the 14.6 amps?
AI: The Big Easy driver is based on the Allegro A4983 chip, which can handle only up to 2 A per phase. So no, it will definitely not handle 14 A (even if you use both of the internal H-bridges in parallel), and the chip's built-in overcurrent protection circuitry will prevent you from consuming anywhere near that much current.
But for your situation, a stepper motor controller is way overkill for toggling solenoids. A mechanical relay, an SSR, or even a MOSFET of sufficient current capability will be more than adequate to control the electromagnet.
Are you sure you have a 24 VDC solenoid that consumes 14.6 A? That would mean that the coil resistance is only 1.64 ohms, which seems really low to me. |
H: Using lots of slide potentiometer for computer control
I want to mount a bunch (say 16+) slide potentiometers in a long project box (or other housing that can sit on a desk) that I can use to interact with software on my computer, specifically lighting software, which I would program.
How could I get the output of these slide potentiometers into my computer so software could read the values? I'm thinking using a USB input.
Keep in mind I'm a beginner at electronics (but I can do software).
AI: You need some kind of analog I/O board ( that basically contains ADC converters to communicate with the PC ) there is also multiple channels available. You need a channel for each potentiometer ( unless you want to do some multiplexing ). Here some examples. |
H: To "ground fill"or not to "ground fill"?
I have been reading up on the EMI issues in Electromagnetic Compatibility
Engineering by Henry Ott. (wonderful book btw).
One of the topics "PCB Layout and Stackup" (aka Ch 16) there is section about ground fill (16.3.6).
Basically what it states, that to minimize the "return current path" filling the areas between connector pads with ground fill should be done. Quite understandable, however in the same section at the end it states "Although often used with analog circuits on double-sided boards, copper fill is not recommended for high-speed digital circuits, because it can cause impedance discontinuities, which can lead to possible functional problems.".
That last part confused me a bit, since I would expect that for high frequency signals (that try and follow the signal trace) a longer path would be decremental.
Can anyone explain why this remark is made?
AI: Sure, lets take the common case of a microstrip. Its impedance is a combination of itself and its return path (and the dielectric but lets keep it simple). In a microstrip's case this will be the reference plane underneath.
Now if you go and throw a piece of grounded copper right next to that microstrip, its impedance is now a combination of itself, its reference plane and that grounded copper next to it. You usually can't get a 100% symmetrical fill around the microstrip, because of vias, other lines or just going into a pin on a package. So in short anywhere you have this copper fill changing your impedance you are going to get discontinuities or changes in impedance.
For example in the image below there'd be a discontinuity for the main trace where the flood is interrupted by a via.
To be fair though there is a type of transmission line we sometimes use called a co-planar wave guide which essentially looks like a trace with two wide copper fills along its sides (symmetrically along its sides). |
H: Creating a keyboard with a microcontroller, do I need an input pin for each key?
I am planning to implement V-USB with an ATMega8 microcontroller. I am interested in implementing an HID device; more specifically, I want to try and make my own simple 26 key keyboard (each corresponding to a letter of the English alphabet).
This may be a stupid question, but do I need an input pin for each key I implement? In other words, will I need to use a microcontroller that has at least 26 I/O pins? Or is there another way to do this?
AI: The idea to use a matrix is certainly the way to go. Your matrix could be organized in another way with eight input rows and four output lines for support of up to 32 switches. Since you only need to excite one input row at a time you could use a simple common 3-8 decoder to drive the input rows like shown below. This reduces the total microcontroller pin count to 7 lines!!
Note that with use of a 74HC138 type of 3-8 decoder it is necessary to flip the logic so that the output columns have pullup resistors, the diode direction is inverted and the software will see lows (0's) on the output lines where detected switches are seen.
Many thanks to tcrosley for borrowing some of his key matrix graphics and to Philips Semiconductors for the logic symbol image of their 74HC138 part. |
H: Power from battery when primary source fails
I'm attempting to design a circuit that will be powered from a 12V primary source but if the power fails then a relay switch to battery (which is maintained charged by an UC3906).
The idea is that if primary source is present the MOSFET is on, activating the relay. When primary source fails the MOSFET is off and the relay go to the position showed in the schematic, the application is now powered by the battery.
Do yo see this reliable?
Update:
I wish to ensure that no current is drawn from the battery if primary power is present and I prefer to not put the primary voltage above the battery voltage (which is already slightly above 12V), with the two diodes solution I added a pMOSFET to get it (may be D1 is not necessary now?).
AI: This circuit idea is OK if the "application" can live with a momentary dropout of its supply voltage during the changeover. There are two things that cause this. First the 12V primary power must drop to less than about 2V or so before the 2N7000 N-FET will turn off. Secondly the relay contact switch over time will take a millisecond or two.
If you want uninterrupted power to the "application" during the changeover then you could consider several alternatives.
1) Add a comparator circuit that detects when the primary 12V has only dropped a small amount (such as to 11.4V) and switch the relay before the primary rail fails. Some charge storage capacitors on the "application side" can minimize the voltage droop there while the relay contacts are switching over.
2) Use a pair of power MOSFETs to switch the voltage instead of the relay. These would switch much faster than the relay and the "application side" hold up capacitors can be much smaller.
3) Use just two power Schottky diodes to OR the two power sources to the application. No switch over control logic required but you do lose some voltage from the sources to the application power rail.
NOTE: In your schematic you need to add a back biased diode across the relay coil so that at the time the the 2N7000 FET turns off the inductive kick of the coil will not take out the FET.
Tino proposed to change his circuit to use the two diode approach as follows:
He questioned as to whether the Diode D1 would still be needed. Unfortunately the diode would still be needed because of you look closely at the data sheet for the IRFU9024 you will note the body diode of the MOSFET....
You can quickly see the problem! |
H: How to determine the units when reading a multimeter?
Say for instance I am trying to measure the current. The units around the edge of the multimeter is 2000u, 200m, 20m, 10A, etc.
Does this mean that the reading displayed on the multimeter is in that particular unit? For example, if I set it to 20m and the reading stated "0.5", does this mean it is 0.5 * 20mA = 10mA = 0.01A?
AI: No the 'units' around the outside you are referring to are not units but ranges. If you set it to 20m, then the highest current you can measure its 20mA. If you are on 20mA and it says 0.5, that probably means you are measuring 0.5mA.
There exist auto-ranging multimeters which you simply set to current mode and you don't have to worry about picking a range. |
H: Circuit review: Impedance bridging for microphones
I have a pair of specialist condenser mics with a nominal output impedance of 3.6k Ohm that I would like to interface with mic preamps with nominal input impedance of 2.2k Ohm. Does this impedance bridging circuit look ok? I have breadboarded it and it seems to work, but I'm very open to suggestions for improvement.
The op amp I am using at the moment is the AD8646 ...
http://www.analog.com/static/imported-files/data_sheets/AD8646_8647_8648.pdf
Thanks
AI: Ref Voltage Issues
An unbypassed voltage divider for generating the + terminal reference voltage is not okay. That is to say, the bottom resistor needs to be shunted by a capacitor. Without this, the reference voltage neatly mirrors any stray signals in the power supply. The output of the circuit interacts with the power supply, and so you have a positive feedback loop.
But, you cannot just add a bypass cap in your circuit, because you will kill the input impedance! The way you have it, your voltage-reference-generating devices (the 100K:100K divider) also determine the input impedances of your stages, which are 50K. (It is 50K because from the point of view of alternating current, both the voltage source and the ground are AC grounds. Your input AC signal flows across the capacitor and dissipates across both 100K resistors in parallel into the power supply.)
This is why we cannot simply bypass the bottom 100K resistor with a cap. That cap will create a zero impedance path to ground for audio signals, oops!
The simplest way to address this issue is to regard the voltage reference divider as a separate device which provides a service to your circuit: a voltage level. Then at the place where you need the reference voltage (+ inputs of the op-amp stages), you convey that voltage there through a resistor, rather than directly, as you have it now. That resistor then will determine the input impedance: the input drops across that resistor, to the voltage reference, where it has about zero ohms to AC ground.
Think about what the circuit would look like if you had a dual voltage supply. Would you connect + directly to ground? No, it would be through a resistor. In single-supply op-amp circuits, the reference voltage plays the role which ground plays in dual supply. You would not rely on ground to give you an input impedance, because that would only show that your ground is poor!
Also, you can use the same voltage reference for both op-amps; there is no need to replicate two voltage dividers. You can also use an additional op-amp to generate a superior voltage reference. I have found an nice document about single supply voltage reference generation for op-amp circuits. Take a look at http://www.analog.com/library/analogDialogue/archives/41-08/amplifier_circuits.html
In this document they show how an active filter can generate a nice voltage reference with much smaller capacitors, yet better roll off starting at a lower frequency.
Variable Input Impedance
You could give your amplifiers variable input impedance (for instance with a rheostat for the input shunt resistor, instead of a fixed resistor). That way you could "tune" them to the microphones. Some commercial mic preamps have a variable input impedance. It's seems to be a fashionable feature nowadays which gives musicians one more tone-influencing knob to play with, and more flexibility for handling a wide range of mics. |
H: MPLAB XC16 compiler outputting 8-bit HEX files for PIC24?
I am trying to understand a HEX file I compiled with Microchip MPLAB X IDE using the Microchip MPLAB XC16 Compiler.
Concerning the MCU, I am targeting the PIC24EP512GU814. However the scope of this question should at least apply to all PIC24 MCUs.
To compile the example HEX below, during the "New Project" wizard, I selected Samples > Microchip Embedded > PIC24 C Template and picked the XC16_24EP512GU814 configuration.
According to the PIC24EP / dsPIC33 Datasheet section 4.1.1 page 48, The memory is segmented into 16-bit words, such that each position (0x0000, 0x0001, ...) contains 16 bits. On the same page of the datasheet, program instructions are said to be 24-bit and span 2 words, such that the most significant byte of the most significant word is zero (00000000b).
This does not appear to be consistent with the compiled HEX file. Here are the first 5 lines of the file, numbered and with the different parts spaced out according to the Intel HEX specifications.
1. :02 0000 04 0000 fa
2. :08 0000 00 0002040000000000 f2
3. :02 0000 04 0000 fa
4. :10 0008 00 c8020000ce020000e4020000d4020000 92
5. :10 0018 00 da020000e8020000ec020000e0020000 42
Consider lines 4 and 5. The first field correctly counts 0x10 (16) bytes in the data field. However, the second field which denotes location in the memory jumps from 0x0008 to 0x0018, or 0x0010 (16) positions.
From my interpretation, this means that this particular HEX file is 8-bit instead of 16-bit because each position is occupied by one byte.
Is there a way to make the compiler output a 16-bit file?
Is this file still valid for a 16-bit MCU? How can I interpret the HEX file so that I can manually flash the MCU?
AI: Intel HEX files are always byte-addressed. This does not mean they can't handle information for other word sizes, only that there needs to be a convention about how those words are mapped to the bytes of the HEX file.
Just like with all the other non-byte addressed PICs (PIC 10, 12, and 16), the addresses are doubled in the HEX file. PIC programmer software knows this and interprets the HEX file addresses accordingly. This is of course all well documented in the programming spec for whatever part you want to program.
You say you want to make your own programmer. That's fine as long as you understand this will take way more time and frustration than just getting a known working one. If the point is the experience and learning of making your own, then fine, but otherwise go buy one.
If you really do want to make your own, you should look at the code for my PIC programmers. All the host code and firmware is open and available in the Development Software release at http://www.embedinc.com/picprg/sw.htm. By looking thru the host source code, you can see how there are flags indicating whether HEX file addresses are doubled for various parts of the PIC's memory.
If you make your programmer compatible with my PIC programmers protocol, then you can make use of all my host-side tools. This could be very helpful when bringing up your system since you have known working code on the other side. The protocol spec may look intimidating at first, but look carefully and you will see much of it is optional, especially if you plan to only support a single PIC. |
H: Future-proofing home network cabling in a building with poor WiFi performance
I have a very frustrating home WiFi network.
The building in which I live is very (over 300 years) old and was long-ago extended on one side so that the (15"-thick) formerly-external wall is now internal; owing to layout, the radio must often penetrate this thick wall with as much as 70° incidence (i.e. direct line passes through 1114mm of solid brick; since 2.4GHz has a wavelength of approximately 125mm, this is almost 9 wavelengths!).
Therefore the only surprising thing is that I get any coverage at all on the other side of the extension from the access point (which I put down to reflection off surfaces around doorways).
I have tried power line communication, but the electrical wiring is also pretty old and not of particularly great quality: connections can be even less reliable than WiFi.
It strikes me that this is a perfect use case for an additional access point or wireless extender, which would normally be my next consideration.
However, since we are about to take up floorboards in a couple of rooms and move some other wiring around, it is a very good opportunity to install some data network cabling (which, whilst perhaps not needed, could provide some good future-proofing against unforeseeable needs over the next 20 years: increased home automation, media distribution, etc).
I want to maintain full WiFi coverage throughout, so will end up connecting at least one additional access point to any new cabling. Devices that remain fixed can switch to being fully cabled rather than using up the existing WiFi.
My questions are:
I'm thinking two cables to each of sitting room/study/bedroom and a single cable to the kitchen, which would total about 100m in aggregate. Of course it's hard to say without knowing what requirements I may have in the future, but does that seem adequate to accomodate 20 years of growth (the last thing I want is to pull up floorboards again)?
Cat6 seems like an absolute minimum requirement for adequate tolerance to any future requirements, but for only 100m of cabling it seems churlish to hold back from a higher quality cable whilst undertaking all of this work.
Should I stick with copper, but go all-out with Cat7A (I estimate the additional cost over Cat6 to be maybe £100, which is completely affordable)? Or would fibre make more sense for true future-proofing (I have no grasp on what the extra cost would be, especially given that media converters will be required at each end of every connection for the time being)?
Is this all overkill for fairly mundane household needs (albeit increasingly streaming video etc over the data network)?
AI: IT industry is very keen on getting things to work on UTP cabling because it is cheap, robust and has a huge installed base. So the answer is CAT6 or better.
Fiber cabling on the other hand is expensive, connectors are sensitive to dust and without careful handling it will break sooner or later.
20 years in IT is an extremely long time, 20 years ago we had totally different types of networking technology (Token Ring, Decnet, ...) and Ethernet was based on thick or thin coax. Your best bet is to install empty pipes in which you can run new cables whenever you require them. 'Loze leiding' that is what we call it in Dutch, don't know the proper English word for it. |
H: Wireless bridge for embedded ethernet switch
I'm building a robot which has an embedded 8 port ethernet switch on it (using a KS8997 controller IC). The reason for that is, that some components like the motor controllers are controlled via ethernet. So there is a CAT5 cable hanging from the robot that connects to my laptop.
I'm wondering if there is a simple solution to turn the wired robot into a wireless one using WiFi. Is it possible to connect a cheap "RJ45 to WiFi Bridge" to the uplink port on the switch?
Thanks for any hints!
AI: Yes, you only need two wireless router/access points that can work as bridges. The cheapest ones have typically only one wireless interface and one wired interface, and they can be configured to just forward between the two interfaces (i.e. bridge them).
After configuring both (this is often called "wireless adapter mode" in the manufacturer's software & manuals), you connect one access point to the switch on the robot, the other to your laptop/home switch, and you're done.
The trick is to find access points that can work off low power, e.g. USB. (You don't want to replace the Ethernet cable with a power one after all ;) I myself have had success with the Asus WL-330 from Amazon. A colleague bought a TP-LINK Portable Wireless N Router last week and he says it has the same "bridge" functionality as the Asus, in addition to costing only 17EUR and using so little power that his Kill-a-watt can't measure it.
Hope that helps. Good luck! |
H: Sending audio over ethernet
I am trying to send audio from a microphone such as this over Ethernet to a computer. My first idea was to connect the mic to an arduino's ADC and send the data using an ethernet module such as the ENC28J60 but some people say that the micro controller can only send about 5kb/s.
Has anyone tried a similar setup where raw data is sent from an analog pin and measured the throughput?
(any ideas on a better way to send the data are also welcome)
AI: Before I get into details, let me say that I have probably designed more professional-audio over Ethernet hardware than anyone else-- both in terms of number of different PCB designs as well as number of PCBs manufactured and shipped to end customers. Odds are very high that you have heard products where I have designed the audio over ethernet circuitry in them. (This is pro-audio only, and does not include VOIP or other non-pro products.)
Let's start with the issues:
Software: The hardware is honestly the easy part. The software is difficult. The closer you want to pro-audio performance the harder it is. Your application doesn't sound like pro-audio, but the software task is still not trivial.
Audio Clocking: Transmitting the audio data from point A to point B is relatively easy. Doing it in a way that the two devices have a synchronized audio clock is difficult. Non-pro applications solve this by doing sample rate conversion or just simple drop/duplicate samples as the audio clocks drift. There are difficulties and side effects of both of these, which increases the software difficulty immensely. Just saving the data to a file on the PC side of things is easy-- using it in a real-time way is hard.
Low-latency: How long it takes the audio to go from the Mic, over the network to the PC, and then used by the PC is called latency. The shorter the latency the harder things are. Just saving audio data to a file is a good example of super-long latency, and is one reason why that is also the easiest thing to do. A latency of <2.5 mS is damn hard to do correctly an robustly. The shorter the latency, the less issues there are with things like audio echo and stuff.
Bandwidth: Sending telephone quality audio with high latency is the easiest. Pro-audio quality with low latency is super hard. Using the mic, MCU, and Ethernet interface that you proposed is going to put you into the telephone quality side of things. There are many cases where raw bits-per-second of the Ethernet interface is not the only problem. Other issues like IRQ rate, packet transmit/receive time (not just overall bandwidth), and sometimes packet timing are super important.
Network Topology: As the audio quality goes up (and latency goes down) your network topology becomes really important. I am talking about the number of Ethernet switches, the type of switches, how they are connected, and the number/type of non-audio ethernet devices also on the network. For you this probably wouldn't be an issue, but you never know.
I think that your proposed solution would work for telephone audio quality with a high latency. You'll probably have to do sample dropping/repeating to deal with non-synchronized audio clocks. And it won't be all that great. You might be quite underwhelmed by the audio. I also think that you'll have a lot of software to write on the PC side of things. That being said, I would not do the project with that.
If I were doing the project, I would look at one of the new-ish ARM Cortex-M3 or M4 devices by TI or Freescale that includes a 100 mbps or gigabit ethernet controllers. Many of these things are less than US$10 each and can run at up to 100 MHz. The amount of RAM and Flash makes the task of writing software much easier.
For amusement, my current Audio Over Ethernet project uses an 800 MHz ARM Cortex-A8 with dual gigabit Ethernet ports and runs a customized version of Linux. The system as a whole (not just this Cortex-A8 device) can handle over 2048 audio channels at 48KHz, 32 bit, with an overall system latency of just 2.5 mS (including ADC, DAC, two times over the network, and lots of processing). Audio devices on the network have their sample clocks sync'd to less than 1 uS, even if there are 8+ switch hops in the middle. |
H: What makes an "rf transistor" different from an ordinary transistor?
I have been looking at various types of transistors that can switch at higher speeds than my clunky but powerful IGBT, and I came across these things called "rf transistors" or "rf mosfets" which can switch at speeds anywhere from a few mhz to a few ghz. Here is an example datasheet. I was wondering what makes these things so fast. I tried some googling, but all I could find was products--no details on what exactly makes these devices different.
Also, is there anything I should watch out for when driving one of these devices? I have gotten fairly comfortable driving large IGBTs and other power devices, but I definitely experienced a learning curve. For example, it took some time and a fair amount of burned out transistors to realize I had to isolate the voltage that drives the gate from source-drain voltage. I also learned that although a resistor connected to the gate is not necessary, a small one helps get you a cleaner signal (I suspect it prevents ringing between the secondary of a gate drive transformer and the effective capacitance between the gate and source). Finally, I found that for fast switching, it helps to actively pull the gate voltage below zero rather than just let it drain across a diode. So given that these are some things I learned to watch out for when driving power transistors, are there any new caveats I should watch out for when working with rf transistors?
AI: RF transistors are operated in their linear mode (for analog signals, going into saturation or full cut off will 'slow them down' dramatically), whereas the transistors you refer to are operating as a switch (either fully saturated or fully cut off, they will have an extremely low on-resistance and a high off-resistance). Entirely different modes of operation.
RF transistors can be extremely sensitive to static discharge. |
H: Replacing a component in an Eagle board that has already been routed?
I'm pretty new to eagle so there might be a better way to do this..
There's an error in one of the parts I'm using. It has one of the connections from the schematic to the board going to the wrong I/O pin. The problem is I've already routed the whole thing before I noticed it.
I changed the connection in the library part file but I think I need to update the part in my board somehow? It's still showing up with the old connection. I've tried deleting the part and adding a new one in but I loose all of the routing that I've done. What's the best way to fix this?
AI: Eagle has a command for updating components from their libraries.
update;
(will update all components from their respective libraries).
If you would rather only update components from a specific library, do as follows:
update mylibrary;
This way you'll only have to re-route the pins that have the wrong connection. |
H: RX String on UART not working
I am having some problems with UART communication with the RN-42 SM Bluetooth module. Currently, I am just using polling to get communication going. I have my source files below.
The problems is that I can send properly, however cannot receive. I have been able to receive PARTS of a response, but it seems that the Transmit, sends a command before I can receive the whole buffer.
Note also that I am trying to retrieve a string of values. So for example, if I send a '$$$', I get a 'CMD\r\n' in return. I am trying to retrieve the latter.
SOURCE FILE
DDRC |= 0xFF;
DDRD |= 0xFA;
initUART();
unsigned char pinRTS = 0;
unsigned char buffer[RXBUFSIZE] = {0};
UNSETCTS(PORTD);
while(1)
{
PORTC ^= 0xFF;
pinRTS = GETRTS(PIND);
if(pinRTS == 0x00) { //Receiver is letting us send
SETCTS(PORTD);
transmitStr((unsigned char *)CMDMODE);
UNSETCTS(PORTD);
waitForRcv();
rcvStr(buffer);
SETCTS(PORTD);
transmitStr((unsigned char *)EXITCMD);
UNSETCTS(PORTD);
waitForRcv();
rcvStr(buffer);
}
}
HEADER BELOW
#include "serial.h"
void initUART() {
/* Set baud rate */
UBRR0H = (unsigned char)(UBBRVAL >> 8);
UBRR0L = (unsigned char)UBBRVAL;
/* Enable receiver and transmitter */
UCSR0B = (1<<RXEN0)|(1<<TXEN0);
/* Set frame format: 8 data, 1 stop bit */
UCSR0C = (3<<UCSZ00);
/* Double the speed */
UCSR0A |= (1 << U2X0);
}
void USART_TRANSMIT(unsigned char cmd) {
/* Wait for empty transmit buffer */
while ( !( UCSR0A & (1 << UDRE0)) );
/* Put data into buffer, sends the data */
UDR0 = cmd;
}
void transmitStr(unsigned char *cmd) {
int i;
for(i = 0; cmd[i] != '\0' ;i++) {
USART_TRANSMIT(cmd[i]);
}
}
unsigned char USART_RECEIVE()
{
/* Wait for data to be received */
while ( !(UCSR0A & (1 << RXC0)) );
/* Get and return received data from buffer */
return UDR0;
}
void rcvStr(unsigned char *buffer) {
int i = 0;
while ( UCSR0A & (1 << RXC0) ) {
buffer[i] = UDR0;
i++;
}
UCSR0A |= (1 << RXC0);
}
void waitForRcv()
{
while ( !((UCSR0A >> RXC0) & 0x01) );
}
Thanks for your help. :)
AI: Are you sure you're properly watching to see if the bluetooth module has filled up it's RX buffer? I'm really just not sure you're checking the RTS and CTS flags properly.
You should be checking the RTS and CTS flags every character, not just when you begin to send the whole string! If you fill up the RX buffer on the bluetooth module, currently you'll keep transmitting, even if the RTS or CTS flags change.
You should also check which version of handshaking your module uses:
http://en.wikipedia.org/wiki/Rs232#RTS.2FCTS_handshaking
Last but not least, small nit-pick: Are you actually storing source code in a header? Please don't! Put the source in a separate file and just put the prototypes in the header! |
H: Processor design: turning blocks on/off dynamically to save power?
I was wondering if this is possible and if it is done in current designs. Seemed like an interesting enough idea to me. Here's a little diagram I made to help try and explain:
So let's say I'm clever and I build a bit of hardware that tracks the number of floating-point operations I've done lately. It tells me, hey, you haven't done any FP operations in the last 2000 instructions! And then decides to "power down" the whole floating point pipeline hardware. Of course, when a FP op does come up in the instruction queue, it needs to turn that power back on, maybe with a delay.
Does this make any sense? Can you "power down" specific parts of your chip and extract real power savings? How (physically speaking in terms of circuits) can you power down parts of hardware? And how hard is it to power them back up?
Sorry if this isn't a good traditional question! I know it's not very specific.
Cheers.
AI: Yes, you can power down specific sections of a chip. In general you don't see this in CPUs by shutting down sections of hardware like the excess FP blocks (like you suggested), mainly because this would lead to weird behavioral changes in the logic based on whether or not an instruction used the powered down blocks.
Where you do see it is in two places:
Power-managed CPUs with multiple cores. The operating system can shut down unused cores in periods of low CPU utilization, but then the operating system will decide when to activate the core, and the core will alert the operating system when it is active. In the meantime, the operating system shunts all operations to the active core (or cores).
On microcontrollers you can activate and deactivate certain functionality by providing power to the functional section of the die. So for example: on most chips you can power or choose not to power the analog to digital converter, and not powering it (even when not in use) will save you some small amount of power (which can be important in very low-power applications).
How you "power down" a section of a chip is pretty straightforward: you have a power transistor that controls the positive input rail to all of the transistors in a section of the chip die, and you turn that on and off. |
H: Circuit symbol for ammeter with output
What is the correct symbol for an ammeter that measures 0..200 mA and generates 0..2 V proportional output?
AI: That's the same as a current controlled voltage source, a CCVS. The symbol looks like a diamond with an equation next to it. In your case, V=10A. |
H: Battery voltage not reaching the expected 12.8V
For a few weeks now I have been charing a deep cycle battery using a 80W solar panel on the roof and a charge controller.
The frist few days the battery voltage would settle at 12.8V once the sun went down. Now days it only has a rest charge of 12.6V and I am no longer able to have it settle at 12.8V. Is this common?
I have tried charging the battery on a long and sunny day. The voltage goes above 12.8V easily but at night it settles down to 12.6V and not 12.8V again.
I am worried I am not charging the battery properly. It is often cloudy were I live and the battery is mostly charged quite slowly. I do not have any charging equipement for condition charging the battery using electricity from the wall.
AI: These flooded carbon fibre cells like other lead acid batteries are prone to sulphation which raises internal plate resistance and lowers the capacity. Try to adapt your charger method to rejuvenate the battery. Sulphation can be reversed by pulse charging if the plates are not warped from excess heat and a steady narrow inductive pulses help reducing the buildup. |
H: Ideas for what to use as project enclosures/cases
I have seen myself working on a growing number of projects over the past few months. The one thing I have started to dislike is seeing the circuit board (and often my messy soldering) after I consider my project complete.
I would like to start putting my projects inside small project boxes/enclosures, but have noticed that items dedicated for this purpose are often overpriced for just a plastic box. I was wondering if people here had any tips with regards to what they use to encase their finished work. I am open to constructing simple boxes as well, which have the added advantage of being customizable. Any tips there would be appreciated as well (i.e. what material you use, overview of construction method, etc.)
AI: One popular and traditional hacker enclosure has been the classic metal Altoids peppermint can - to the extent that some products and prototyping PCBs are shaped to precisely fit one.
(Image from Adafruit)
For more examples, see a toy, an amplifier and another, a sound generator, a USB charger, one could go on all day.
A fringe benefit of using a metal can like the Altoids, is EMI / RFI reduction, both emission from poorly designed circuits, and from the outside into the circuit.
For smaller circuits, round metal shoe polish cans are popular, and again qualify as "EMI-Safe Device Enclosure".
(from Wikipedia)
Another "hacker's standard" that has been around for decades is the wooden cigar box. They're sometimes found at garage sales or the scrapyard, in a variety of sizes and designs. My favorite are the ones with a double hinge, and a little metal latch in the front. Back in college, I built myself a bench power supply in a big cigar box, that is still around somewhere.
The fringe benefit of wooden cigar boxes is protection from electrical accidents when working with main line power input to your device.
A third standard go-to option in cases where robustness is not a concern, is the small Pringles or other potato crisps cardboard can. They're especially convenient for cutting holes in, for sockets and connectors. The 2 to 3 inch height and diameter make such boxes useful for circuits with a transformer in them, such as non-switched (good old) power supplies.
Finally, plastic enclosures aren't necessarily expensive: You can sometimes pick up assorted sizes in lots of 5 or 10 from eBay for under 1 US$ a box, and manufacturers offer a variety of standard enclosures starting in the $3 range, probably cheaper if you search around. |
H: Why does this Verilog hog down 30 macrocells and hundreds of product terms?
I have a project that's consuming 34 of a Xilinx Coolrunner II's macrocells. I noticed I had an error and tracked it down to this:
assign rlever = RL[0] ? 3'b000 :
RL[1] ? 3'b001 :
RL[2] ? 3'b010 :
RL[3] ? 3'b011 :
RL[4] ? 3'b100 :
RL[5] ? 3'b101 :
RL[6] ? 3'b110 :
3'b111;
assign llever = LL[0] ? 3'b000 :
LL[1] ? 3'b001 :
LL[2] ? 3'b010 :
LL[3] ? 3'b011 :
LL[4] ? 3'b100 :
LL[5] ? 3'b101 :
3'b110 ;
The error is that rlever and llever are one bit wide, and I need them to be three bits wide. Silly me. I changed the code to be:
wire [2:0] rlever ...
wire [2:0] llever ...
so there were enough bits. However, when I rebuilt the project, this change costed me more than 30 macrocells and hundreds of product terms. Can anyone explain what I have done wrong?
(The good news is that it now simulates correctly... :-P )
EDIT -
I suppose I'm frustrated because about the time I think I start understanding Verilog and the CPLD, something happens which shows I clearly have no understanding.
assign outp[0] = inp[0] | inp[2] | inp[4] | inp[6];
assign outp[1] = inp[1] | inp[2] | inp[5] | inp[6];
assign outp[2] = inp[3] | inp[4] | inp[5] | inp[6];
The logic to implement those three lines occurs twice. That means that each of the 6 lines of Verilog consumes about 6 macrocells and 32 product terms each.
EDIT 2 - As per @ThePhoton's suggestion about the optimization switch, here is information from the summary pages produced by ISE:
Synthesizing Unit <mux1>.
Related source file is "mux1.v".
Found 3-bit 1-of-9 priority encoder for signal <code>.
Unit <mux1> synthesized.
(snip!)
# Priority Encoders : 2
3-bit 1-of-9 priority encoder : 2
So clearly the code was recognized as something special. The design is still consuming tremendous resources, however.
EDIT 3 -
I made a new schematic including only the mux that @thePhoton recommended. Synthesis produced insignificant resource usage. I also synthesized the module recommended by @Michael Karas. This also produced insignificant usage. So some sanity is prevailing.
Clearly, my use of the lever values is causing consternation. More To Come.
Final Edit
The design is no longer insane. I am not sure what happened, however. I made a lot of changes in order to implement new algorithms. One contributing factor was a 'ROM' of 111 15-bit elements. This consumed a modest number of macrocells but a lot of product terms - nearly all of those available on the xc2c64a. I look for this but had not noticed it. I believe my error was hidden by optimization. The 'levers' I'm talking about are used to select values from the ROM. I hypothesize that when I implemented the (busted) 1-bit priority encoder, ISE optimized away some of the ROM. That would be quite a trick, but it's the only explanation I can think of. This optimization reduced the resource usage markedly and lulled me into expecting a certain base-line. When I fixed the priority encoder (as per this thread,) I saw the overhead of the priority encoder and the ROM that had previously been optimized away and attributed this to the former exclusively.
After all this, I was good on macrocells but had depleted my product terms. Half of the ROM was a luxury, really, as it was just the 2's comp of the first half. I removed the negative values, replacing them elsewhere them with a simple calculation. This allowed me to trade macrocells for product terms.
For now, this thing fits into the xc2c64a; I've used 81% and 84% of my macrocells and product terms respectively. Of course, now I have to test it to ensure it does what I want...
Thanks to ThePhoton and Michael Karas for the assist. In addition to the moral support they lent to help me solve this, I've learned from the Xilinx document ThePhoton posted, and I implemented the priority encoder suggest by Michael.
AI: The code you show is essentially a priority encoder.
That is, it has an input of many signals, and its output indicates which of those signals is set, giving priority to the left-most set signal if more than one is set.
However, I see conflicting definitions of the standard behavior for this circuit in the two places I checked.
According to Wikipedia, the standard priority encoder numbers its inputs from 1. That is, if the least significant input bit is set, it outputs 1, not 0. The Wikipedia priority encoder outputs 0 when none of the input bits are set.
Xilinx's XST User Guide (p. 80), however, defines a priority encoder closer to what you coded. The inputs are numbered from 0, so when the input's lsb is set it gives a 0 output. However, the Xilinx definition gives no spec for the output when all input bits are clear (Your code will output 3'd7).
The Xilinx user guide, of course, will determine what the Xilinx synthesis software is expecting. The main point is that a special directive (*priority_extract ="force"*) is required for XST to recognize this structure and generate optimal synthesis results.
Here's Xilinx's recommended form for an 8-to-3 priority encoder:
(* priority_extract="force" *)
module v_priority_encoder_1 (sel, code);
input [7:0] sel;
output [2:0] code;
reg [2:0] code;
always @(sel)
begin
if (sel[0]) code = 3’b000;
else if (sel[1]) code = 3’b001;
else if (sel[2]) code = 3’b010;
else if (sel[3]) code = 3’b011;
else if (sel[4]) code = 3’b100;
else if (sel[5]) code = 3’b101;
else if (sel[6]) code = 3’b110;
else if (sel[7]) code = 3’b111;
else code = 3’bxxx;
end
endmodule
If you can rearrange your surrounding logic to let you use Xilinx's recommended coding style, that's probably the best way to get a better result.
I think you can get this by instantiating the Xilinx encoder module with
v_priority_encoder_1 pe_inst (.sel({~|{RL[6:0]}, RL[6:0]}), .code(rlever));
I've nor'ed together all bits of RL[6:0] to get an 8th input bit that will trigger the 3'b111 output when all RL bits are low.
For the llever logic, you can probably reduce the resource usage by making a modified encoder module, following the Xilinx template, but requiring only 7 input bits (your 6 bits of LL plus an additional bit that goes high when the other 6 are all low).
Using this template assumes the version of ISE you have is using the XST synthesis engine. It seems like they change synthesis tools on every major rev of ISE, so check that the document I linked actually corresponds to your version of ISE. If not, check the recommended style in your documentation to see what your tool expects. |
H: Why output of square wave signal after bypass capacitor is a triangular wave?
I understand square wave contains many sine waves of different frequencies as so does triangular wave.
My impression with bypass capacitor is that the higher the frequencies the better it attenuates those signals. Therefore, I hope to see a fundamental sine wave output for both square wave and triangular wave input. However, in reality, at high frequencies, output from triangular wave is a perfect sine wave ; but output from square wave is a perfect triangular wave.
At medium frequency, output from square wave looks like exponential charging & discharging curve, that one I can understand. But what I don't understand is its output at high frequency.
Why is it so ?
My circuit setup is simple, small amplitude signal fed directly into capacitor to ground. Output is taken from capacitor too.
Here is the circuit setup, very simple:
The above observation can be seen on all capacitor ranges, however, it is easier to see on not so small capacitor like 0.1uF. In short, at high frequency, output from square wave turns into a triangular wave.
AI: The Fourier series for a triangle wave is Odd harmonics shift in phase by 90 deg from a square wave with 12 dB/ odd octave more attenuation.
and the square wave
Both have only odd harmonics but differ in the slope of the peak value for each harmonic. However triangle harmonics are much smaller. As n increases, the amplitude reduces by 1/n², whereas a square wave reduces by 1/n. Triangle waves harmonics also alternate phase (+/-sin) with increasing n.
To simplify my explanation, the capacitive load on a 50Ω gen. gives a frequency response or Transfer Function of;
, which you know gives the exponential time response to a medium square wave where f is near 1/RC .
But for high frequency where RCs>>1 so the transfer fcn reduces to an integrator Hc(s)=1/RCs transfer function.
Applying this filter to the Fourier series of the square wave, its 1/n harmonic attenuation becomes 1/n² slope on harmonics of the triangle wave. Similarily the triangle wave source when filtered, its harmonic attenuation slope of 1/n² becomes 1/n³.
On a scope all you would see is a sine wave, but on a spectrum analyzer log scale you would see the 1/n³ slope of all harmonics ( i.e. 3rd order slope )
side comments added
I believe there is value in the time you spend in the lab to match theory with practise. When it does not match, look at for a better equivalent circuit then verify your assumptions. If you have Java you can play with this programmable signal generator . Have fun ! Spend more time in the lab validating what you learn and bring the lab to your desktop then expand your horizons.
http://www.falstad.com/fourier/ <
use the mouse pointer and left or right click...drag and adjust
Change the phase of the Fourier series and see the effect on a triangle wave
Add a spurious resonance in the amplitude of one harmonics, see the waveform
add a glitch, change the shape anyway you want. (arbitrary waveform)
add a LPF filter, change the frequency, slide the number of terms in the spectrum, see effect
When Integrate a step input and Dump, you get a Sawtooth waveform
Here the mouse is hovering over the fundamental of the Fourier spectrum and the fundamental sinewave amplitude and phase are shown in yellow. Meanwhile I boosted a harmonic to similate a resonance on the sawtooth.
The combinations are "only limited by your imagination" |
H: When abstract logic circuits get translated to the electrical equivilant, how are conversions from 0 to 1 handled?
I've searched around and there's lots of good information out there, but I'm a bit of a n00b when it comes to the precise meanings of words like current, voltage, amplify, resistor, diode etc. So what at first presents itself as a simple explanation quickly turns into a wikipedia tabfest of ever increasing complexity. With that in mind please forgive my probably inaccurate use of these terms in this post.
The basic problem for me is that gates on a logic circuit appear to be creating power from nothing, which is impossible. For example imagine two NOT gates connected in sequence: To my uninitiated mind what seems to be happening is that the first NOT gate cuts the power to the second NOT gate, which responds by magically conjuring new power out of thin air and sending it on it's way. The only explanation I can come up with feels a bit redundant and absurd (That every single gate on the diagram is implied to be directly connected to a power source)
The closest I've come to an answer is something to do with changing the "signal" from "high" to "low" but again, I'm not familiar enough with the language. It still suffers from the same problem, if you've got a low signal how is it that a NOT gate can turn it into a high one without directly drawing on a power source?
To wrap up and present the question in all it's rookie glory:
How do logic gates physically convert 0 to 1 without violating the law of conservation of energy?
AI: Why do you think it is absurd for every gate to be connected to power source? That's exactly how it works. Here is a schematic representation of a CMOS inverter:
When the input is low, P-channel device is conducts, thus pulling the output high. When input is high, N-channel device conducts and brings output low.
You can also have variants with passive pull-up or pull-down, but none of them "make" power. |
H: PCB Design - Polygon pour remove islands or not?
Sometimes a polygon pour (I use Altium, so I am using it's naming reference, for other packages it can be power plane and etc.) makes a dead copper area, and the software gives you the option to remove it or no, but why someone will want to not remove it? The only reason I can think someone will want a dead copper area is to make fabrication faster since there will be less copper to remove, and to make it cheaper since less chemicals will be used.
Is this right? Or there are other options that I cant see?
Thank you!
AI: Certainly not the only reason, but a big one is copper thieving.
When manufacturing a board, it's easier to control consistency when the board has equal copper coverage. It helps avoid over/under-etching, helps balance the board's rigidity, and so on. If you had huge open areas without a copper pour, and let the manufacturer do copper theiving, they might add a pattern of dots or diamond shapes, not connected to any net, to add more copper to the board to balance it.
A reason that you might not want these unconnected pour islands, or the dots/diamonds added by the board house, could be for reasons like controlled impedance or EMI. In this case, you might end up telling the board house to specifically not do copper thieving in certain areas of the board... or you might choose to have those pour islands be tied to ground.
In this case, you'd be leaving the unconnected pours on there yourself, not necessarily telling the manufacturer to add more copper to your board... but it's the same idea. |
H: I want to find \$\frac{\hat{\theta}}{\hat{T}}\$
I have the following block diagram, and I want to find the transfer function \$\frac{\hat{\theta}}{\hat{T}}\$. I am not sure how to do this, I've got the rules of connection in a series or parallel, but I am stuck.
I started with the entrance of \$T\$ but got stuck, can someone please provide me some help?
AI: This kind of block diagram doesn't have anything to do with the rules for parallel and series connections of impedances. It just represents a bunch of complex algebraic equations. Each of the rectangular boxes just produces an output variable by multiplying its input by a constant, given by the text in the box.
For example,
\$ V_m = \gamma(I_{ref}-I_m)\$ comes from the first box at the upper left.
\$ I_m = \dfrac{1}{Ls+R}(V_m - E_{emf})\$ comes from the next box to the right.
You can keep making equations like this for each variable in the diagram.
At that point you should have a complete set of equations that you can reduce to get a relationship between \$\Omega\$ and T.
To do this for a complex system like yours, you may want to polish up your skills in a symbolic math package like Maple or Mathematica. |
H: Selecting the right bridge rectifier
There are a number of schematics I'm trying to interpret that have bridge rectifiers. In the components list, however, they're simply listed as "D1-D4 rectifier unit" without any specific values.
How do I interpret the specific rectifier parameters? Does it need to specifically MATCH the input voltage & amperage of the circuit? or does it just need to exceed it?
Is there any limit to how far the rectifier can exceed the circuit? For instance, I've got a schematic that's drawing 12V/2A. I have a rectifier on hand that's rated for 1000v/10a. If I were use that in my 12V/2A circuit, would anything blow up? I'm guessing not...
Then, if I wanted to make my own rectifier, how do I select the diodes? do I just select four matching diodes with the same parameters as I want the rectifier to have (e.g., 4 12v/4a diodes to make a 12v/4a rectifier)? or is there some other formula for choosing the parts of the rectifier?
AI: For Bridge Rectifier selection: Short-list parts that exceed the required maximum voltage, and the required current, by a fair margin, as described below.
For sine wave output from a transformer, the required voltage would be sqrt(2)=1.4142 times the rated transformer output voltage, as transformers are rated for RMS voltage, not peak. Also, transformers are usually, but not always, rated lower than the actual voltage they produce across the secondary with no load: This drops to the rated voltage when the transformer is carrying the rated full load current. Hence, to be on the safe side, around 2.5 times the transformer rated voltage works well for me.
For current calculation as well, 2.5 times the expected load current is healthy - since you would need the bridge to withstand the initial current surge when any reservoir capacitors following the bridge are charging up after power-on.
Now that you have the voltage and current ratings to look for, listing available parts might show you higher rated parts that are cheaper than those just meeting your requirements - so just go with the higher rated parts.
For instance, in local stores near where I live, a BR68 bridge sells for less than half of a BR36, despite the much higher rating. This is due to economies of scale - the BR68 part is just more commonly used here.
Another consideration, though, is physical size / PCB layout: Higher rated bridges tend to increase in size. Also, sometimes SIP pin-put modules are just more convenient on the PCB, compared to square pin-outs, if vertical space is not an issue.
For discrete diode selection: The same calculations apply as for the bridge. The key advantage of going with discrete parts is that heat dissipation is a bit less bothersome, since each diode has its own surrounding space to dissipate heat.
A minor additional benefit is the facility to indulge in somewhat creative PCB layouts when needed, rather than being forced to give up a specific contiguous area on the board. |
H: Simple radio serial communication
I need a way to transfer small amount of data (4 8bit integers + checksum) over wireless.
I'm struggling to find any information dealing with sending serial transmissions over some sort of radio link. Sending is quite simple, but I have no idea how would the receiving end work, as it needs a clock, which can't be provided over radio.
The second thing is I don't really know which technology to choose for the radio. I'm hoping to build something really really simple and cheap. Range wise i'd be happy with a few meters, say 10, in unobstructed space. Transmission speeds of about 10kbit per second would be sufficient, I think at that speed the bandwidth falls within voice range.
I've built a small FM transmitter before but I have no idea how to make both transmitter and the receiver with a fixed tuning that won't drift when the circuit heats up or the antenna changes shape.
Also I realise that this question is a bit vague, and i'm not looking for finished solution, just some pointers on how to address these problems
Thank you
EDIT: I haven't made up my mind yet. The proposed modules are either more expensive or require more work to set up in the configuration that I want.
What I think i'm going to do in meantime is build a small FM transmitter with two signal generators, each frequency associated with 0 or 1. I can generate the frequency directly from the MCU on the transmitter end. On the receiver I will do a simple freq filter, that should give me 0 or 1 output, I still have to figure out how to clock it though. In the end total parts will definitely be under £1. i'll try to find some material on data transmissions, maybe there is a better way of doing it.
Thanks for the answer Anindo, I will accept if my attempt ends up futile.
AI: For data transmission / reception, one of the less expensive options today is a pre-built module around the nRF24L01+ Transceiver IC. These modules typically offer a built-in PCB-trace antenna, 250 Kbps to 2 MBPS bandwidth before error correction, and are tried and tested.
Most important, they save you time in debugging and antenna tuning. After thousands of people have used these modules, which are built on the manufacturer's reference designs after all, most of the kinks are pretty thoroughly ironed out. Also, being able to tap the experience of many others on the internet who have used such a module, counts for a lot when trying to resolve issues.
For instance, this listing on eBay is for a mere US$2.10 with free international shipping. It uses the 2.4 GHz band, which does not need licensing for low power use in most countries.
Another alternative is this 433 MHz band transmit / receive pair of modules (just 9.6 Kbps though), in case you specifically want to stay with transmit-only and receive-only designs. US$1.99 for the pair makes it pretty attractive.
Of course, in each case, you could as well build your own module starting from the IC manufacturer's reference design, and thus learn while implementing your radio functionality.
It is unlikely that the price advantage of massive volume production can be beaten, though. |
H: Decoupling caps with PICs
I'm working on a project and read that decoupling caps should be connected across the VDD and VSS pins of PIC microcontrollers(or rather all microcontrollers?). I'm using a 9V battery with a 7805 voltage regulator as the source and have two decoupling capacitors connected with the regulator like so:
So do I really require the decoupling capacitors across the VDD and VSS pins or is it okay to not use them?
AI: Why your regulator needs bypass capacitors
Those capacitors are usually there to provide stability to the output of the regulator itself. Linear regulators use a feedback loop to regulate under changing load conditions... the bypass capacitors helps stabilize the feedback loop to prevent oscillations.
Why bypass/decoupling capacitors are required
The general recommendation is to bypass at the point of load for all your ICs which, in this case, would be the Vdd pins on your microcontroller. A small ceramic cap, 0402 or 0603, close to each Vdd pin, with a short via to your ground plane (or to your ground track) of 0.1uF value should suffice nicely.
This is because the power draw from something like a microcontroller is pulsed... not steady. Think about it like this: your microcontroller is running a task very frequently... let's say a single task 20 times a second. If the regulator adjusts to deliver power when the microcontroller is idle, and then your task runs, the voltage is going to sag as the regulator tries to meet the current demand. The bypass capacitors are there to supply power when the regulator can't supply it fast enough. This is due simply to the fact they are capacitors and due to the fact they are placed physically close to the IC... closer than the voltage regulator is.
This is leaving out a lot of stuff, like the signal return path, but generally speaking, you're just trying to make sure that current demands can be met locally without tons of current having to travel all over the board. There's also the issue of reducing noise (I believe because you're reducing the di/dt traveling across your power traces by having current loops stay local to your bypass capacitors) but I don't want to try and explain that because my knowledge isn't that great in that area. :) |
H: When should I use SR, D, JK, or T Flip flops?
In class I've learned about SR, D, JK, and T flip flops. From what I understand, you can construct any design by using any of them. So my question is when making a design, how does one choose which to use? Which one is used more in commercial circuits and why?
AI: In discrete logic (like 74xx series), you use whichever choice lets you design your circuit with smallest number of parts and without violating timing requirements.
In FPGAs, you mostly design in HDL (VHDL or Verilog) and the synthesis tool works out for you what to use. But the underlying technology basically just provides D flip-flops, so the synthesis tool figures out how to implement what you code with D flip-flops.
In ASICs, a high level designer again designs with HDL. But probably (ASICs aren't my area) the ASIC vendor's library may provide other options beyond D flip-flops, and the synthesis tool will figure out how to implement the code using the available library components. It could choose one or the another to optimize either circuit speed or chip area. |
H: Implementing 4-to-16 decoder using 3-to-8 and 2-to-4
This is digital logic question. I think it's alright to post it here.
I'm trying to implement a 4 to 16 decoder using 2 to 4 decoder and 3 to 8 decoder.
What I did, I used 2x of 2-to-4 decoder and 1x 3-to-8 decoder. But I think there is a mistake in the 3-to-8 part. I hope you could point me out to it.
Here is what I did,
Note that I couldn't continue writing the full table.
AI: Q2 and Q3 will never be active at the same time, so it is useless to route them to the same decoder where one acts as enable. |
H: Why use PLC instead of microcontroller?
Why does everyone use PLCs in industrial environments, instead of a microcontroller based solution?
For a longer task, the PLC program is as complicated as a microcontroller program.
A microcontroller based solution may be more customisable, and of lower price.
AI: I'd think a major factor is people. The engineers that can design a microcontroller to run a factory are busy making batches of small devices. Engineers that work on brand name PLCs use standard software packages, they don't have to deal with lower level programming, most problems they encounter someone else has already solved with that hardware (comms to strange devices, IO issues, PIDs). Also the engineers are interchangeable, with a good spec or code commenting you don't need the engineer that built a system there when you need to change the code.
It's also a bit like asking why would someone buy a PC when they could build their own. |
H: Circuit RL simumation explanation
I was playing around with a circuit, and I am not understanding its behaviour, it appears to be wrong.
I am using this circuit.
If you close the switch, the current will flow through the inductor, since it will appear as a wire. But when you open the circuit with the inductor already charged, the current reverses itself which is impossible right? There is no instantaneous change in current in the inductor, right? So how may this be possible?
EDIT: Included circuit images:
open circuit
inductor charged
current reversed when the switch is open
AI: The simulation result isn't totally unrealistic. You didn't show what happens in the transient after the switch is opened, but it should be something like this:
When the switch is open, for a very brief time, current continues to flow "down" through the inductor. It would be trying to flow "up" through the diode arm of the circuit.
Now understanding the diode behavior depends on knowing about a couple of behaviors beyond just that the diode allows current flow in only one direction.
First, the diode has some capacitance associated with it. This capacitance is effectively in parallel with the "ideal diode" whose behavior we normally consider. The value of this parasitic capacitor depends on the diode bias point. This capacitance allows current to flow through the diode in reverse for a brief time, while a large reverse voltage builds up across the diode.
Second, the diode has what's called a "reverse recovery" time. While there are still carriers (electrons and holes) in the pn junction generated during the time current was flowing forward, switch the diode quickly into reverse bias can cause these carriers to flow backwards, and carry a reverse current. But this current only lasts a brief time, until the carriers are swept out of the junction.
Third, after the reverse recovery behavior ends, and the diode capacitance builds up a large reverse voltage, its very likely in a real diode, that the large reverse voltage causes electrical breakdown, which will destroy the diode.
The next key is that the simulator model very probably includes the reverse recovery behavior and the parallel capacitance behavior, but not the breakdown behavior.
So what probably happened in your simulation is, the inductor did in fact continue to conduct in the forward direction for a very short time. This caused a large reverse bias to build up on the diode (because breakdown isn't modelled). This reverse bias means the "bottom" node is at a very high voltage (relative to the "top" node). This voltage causes a proportional di/dt in the inductor, eventually resulting in reversing the current direction through it.
One way to look at this is that you have created a (damped) tank circuit between the inductor and the parasitic capacitance of the diode.
But once the current starts flowing in the counterclockwise direction, the capacitance is mostly shorted out by the diode, so it might never build up enough voltage to reverse the current back in to the clockwise direction.
Meaning, the time taken for the oscillator to reverse current direction again might be much longer than the damping time constant caused by the 100 Ohm resistor, so you never see that behavior. |
H: Gettting hand movements registered and sent to an arduino
I want to control a servo motor attached to an arduino through hand movements. I am just beginning the project and my idea is to attach a couple of accelorometers to each finger and then send that data to the arduino through Xbee . Firstly is this the right approach to doing this , or are there ready made sensors which I can wrap around my hand and send data to the arduino. Secondly I am stumped as to how to attach a Xbee sender to each accelerometer on my hand. Is this how its generally done? Does kinect even use accelerometers. Or is it some other kind of sensor. What would be the right approach to this project?
AI: There are a lot of questions embedded in there! Let's try and unpack them:
The Kinect doesn't actually have anything connected to the user. It functions by sending out a grid of infrared points and measuring how warped the grid is with a camera with an IR filter. It has a lot of resolution for certain applications, but it doesn't work when the objects are very close to the Kinect, and it also can't measure anything which is occluded (i.e. if something is in the way you can't tell what happening behind it).
Getting finger and hand positions is very difficult. You can slap an accelerometer onto each finger and put one on the palm, but interpreting what those accelerometer positions mean will be tricky to do in real-time. On top of that, it'll be very expensive! You can see some previous ideas in hand tracking with the super colorful MIT glove, here's someone using the kinect, and here's tracking fingers with the wiimote. Now note that all of these use a computer to back out the information from a sensor into hand positions, and you'll likely have to do something similar, unless you have more modest requirements for hand tracking.
Don't try and design the wireless component until you have a good method for getting hand positions. A lot of the requirements for your hand tracking will change the requirements for the wireless: how often do you want to know hand positions? How much detail do you need about the hand's position? Once you know these, then you can go look and see what wireless solutions exist and implement something. For example: if you did use 3-axis accelerometers (not saying it's a good idea, but if you did), one per finger, with a 10-bit ADC reading in the result from each finger: this gives 3 axis * 5 fingers * 10 bits = 150 bits per update. That means that if you only used a single zigbee running at 115200 bits per second, you can have 768 updates per second (assuming no overhead, which is unrealistic). But the point is that putting in 5 zigbees would be total overkill! Just put in one radio. And in a similar fashion, whatever solution you pick should be designed after you know what it needs.
Hope that helps! |
H: How do I troubleshoot a broken SAA3004 Remote control transmitter used in a remote control?
I'd like to troubleshoot and fix a broken remote control for a Guldmann ceiling lift that uses the SAA3004 remote control transmitter (documentation below in link). Can someone explain the tools required to do this, and the steps necessary to troubleshoot such a device? I just replaced the 9V battery being used in the remote, which powers the a circuit board (SAA3004). I've used a multi meter and I know the CPU is getting power. I've put the black part of the multi meter on the battery and the red onto Vss (page 10 below), and is showing 8.9V. I can provide additional information if necessary, and some images of the circuit board. And I have a remote control with a functioning circuit board, in case we need to compare with the broken circuit board.
http://www.datasheetcatalog.org/datasheet/philips/SAA3004.pdf
AI: One thing to check is use digital camera or mobile phone camera and see IR output side when pressing the remote buttons, because IR signal is usually visible by digital camera but not by eyes. Then you know if output is there or not. Then check voltage on IR emitter while pressing button. Then you know if controller is sending signal to IR emitter or not. If yes but no IR output then IR led is dead. Work backwards. If old remote, possible that buttons are worn out also. |
H: Is it possible to make illegal clones of an Intel Core i7?
The reason I'm asking is that on http://alibaba.com you can find prices for the Core i7 as low as $20, minimum quantity 1. This looks like impossibly low for a genuine Intel, but then I also can't believe you can clone this kind of CPU. What's the matter here, and what kind of problems can I expect with these cheap CPUs?
AI: There are a lot of different things you can get when you see something like this. For a very new part like this I would assume that since Intel is pretty much the only company with the ability to actually build these CPUs (they use a very small manufacturing process), these are either bricks of lead attached to the correct packaging to look like a CPU, or they're failed CPUs. There's actually a relatively low yield on tiny manufacturing processes like Intel's current generation (22nm is the current size they use). I've been led to believe it's something like a 60% yield (i.e. they produce 100 processors they only get 60 that actually work) and the rest have to be discarded. But I have no real numbers on that, but even if it was a 99.9% yield, that would still mean that 1 in 1000 was bad and had to be disposed of, and Intel produces a lot of processors. And someone is probably interested in cheap, mostly functional CPUs.
What functionality is actually missing in these discarded chips could be very minor. Something like "dividing anything by 3879 never gives the correct answer", but clearly a chip with a flaw like that could never be released without permanently damaging the companies' reputation. So if these $20 i7 chips do function in a core i7 motherboard, I would assume that you would find that each one would have some subset of functionality that misbehaved. Alternatively they could only work if underclocked, or if they were much cooler than the specifications normally allow. Who knows! It's a lottery of functionality.
Another unlikely possibility is that these are some other chips which have the same pinout but do something totally different. See Sparkfun's adventure in counterfeit ATMegas (note that the post I linked has several updates where they learn it's an ON semiconductor part from the 1980s). This is extremely unlikely though, as Intel varies its pinouts frequently, so other manufacturers wouldn't be producing parts which would fit in this generations' sockets.
Something which sometimes happens in China, is that the employees will come into the facilities and run the factory when the managers aren't there, and sell the output as genuine product, even though it hasn't been tested. In general the test equipment and the equipment which marks the packaging with "Genuine __ part!" don't work without the manager's password or something similar. This is normally an issue in places that produce SD cards and similar though, where the process is relatively simple and short. These are called "ghost shift" components because they're produced by a shift of workers who aren't supposed to be there. Intel's chips are probably a bit too complex for something like that, and I think they're mostly produced in America anyway.
So long story short: I don't think there's another entity with the ability to produce 22nm parts as complex as Intel's CPUs right now, so I imagine these are either defective core i7s, or completely fake.
Edit: Or, as Olin noted below, the least interesting answer electronically: they're just stolen chips (I like my schemes to be more elaborate!) |
H: Connecting the Shield of a strain gage cable connector to PCB with ADC
I have a half-bridge strain gage sensor (pre-assembled product) with a 30cm cable, which I am trying to interface with my PCB containing a 24-bit ADC.
The connector at the cable end toward the ADC (i.e., the end away from the strain gage) has the following four pins, based on my reading of the resistances:
Pin 1: V_Excitation
Pin 2: Doesn't seem to be connected to anything
Pin 3: V_signal
Pin 4: Ground
All good so far.
However, in addition, there is the metallic shield constituting the body of the connector.
Being new to strain gages and ADC measurements, I am unsure of the shield's significance -- I presume it has something to do with minimizing interference-based offsets. (Also, I don't want to break open the cable to see what's inside but I'm guessing it is a standard twisted-pair cable.)
Question A: What role exactly does the shield play in a strain gage / ADC application?
Question B: And thus which of the following is good practice to follow with the shield? :
Just isolate shield from GND (i.e., leave shield alone) ?
Or connect shield directly to the Ground plane on my ADC pcb ?
Or place 4.7 nF Capacitor and 1M resistor between shield and Ground, as suggested for USB connector shield in this question ?
Or connect shield to metal chassis of my enclosure only, as suggested in this question ?
AI: As a general guideline, it is preferable to connect any cable shields to the metal chassis (not PCB ground), at just one end. To keep things simple when multiple shielded cables connect out from some central device, the shield connection should be done only at the "hub" device, and left open at the "spoke" devices.
Similarly, for a chain of devices connected by shielded cable, each shield ought to be connected to the chassis of the upstream device, and left open at the downstream end. Yes, this does mean that the shields of different links of such a chain might be at different potentials, depending on how well earthed the individual devices are, but this is generally not a problem.
A basic, inexpensive addition incorporated in many consumer device cables today, is a clamp-on ferrite bead or "split bead" at each end of the cable, close to the connector. This reduces high frequency EMI off the shield with minimal complexity. A good document about such RFI beads is here.
Note that the chassis is usually connected to "earth" of the location, not to ground of your circuit board.
Of course, this is a simplification of a fairly complex subject, but it serves the purpose for designs at frequencies where surface effects do not predominate. As frequency of signals involved rises into GHz, other factors need addressing. |
H: LEDs and weird results from various Arduino pinModes
I'm currently repurposing an old Arduino project - it consisted of several super bright LEDs wired according to the following schematic:
The same configuration is repeated with pins 3, 5, 6 (and not shown to keep things simple).
I was controlling the lights via serial, and managed to PWM them without any issue.
For my current project, I want to work with code uploaded through the Arduino IDE. I kept getting weird results as I was trying to PWM them, and tried to simplify my code until I got to the following three test cases:
void setup() {
pinMode(6, OUTPUT);
}
void loop() {
digitalWrite(6, HIGH);
delay(500);
digitalWrite(6, LOW);
delay(500);
}
Expected result: the lights connected to pin 6 blink.
Actual result: the lights flicker once, and not do anything at all.
void setup() {
/* pinMode(6, OUTPUT); */
}
void loop() {
digitalWrite(6, HIGH);
delay(500);
digitalWrite(6, LOW);
delay(500);
}
Expected result: nothing should happen.
Actual result: nothing happens.
void setup() {
pinMode(3, OUTPUT);
}
void loop() {
digitalWrite(6, HIGH);
delay(500);
digitalWrite(6, LOW);
delay(500);
}
Expected result: nothing should happen.
Actual result: the lights connected to pin 6 blink. Wait, what?
My wiring solution may not be ideal, but it worked when I was sending instructions by serial. Any ideas as to what could cause this behaviour?
AI: On Arduino, digitalWrite serves two different purposes:
If used while pinMode is set to INPUT, using digitalWrite(pin, HIGH) enables the internal weak pull-up resistors (20 k Ohms) on the respective pin.
If used while pinMode is set to OUTPUT, digitalWrite does the obvious, sets the respective pin to high or low as expected.
Thus, not explicitly setting pinMode (as is happening in your second and third test cases) results in one of two possible outcomes, depending on what the pinMode was last set to, or its default value at power-up, INPUT.
So without the pinMode(pin, OUTPUT), your digitalWrite code is enabling and disabling the weak pull-up resistors, thus raising and lowering the voltage at base of the transistors. This is expected behavior, and depending on the transistor parameters and any additional circuitry, the emitter/collector circuit should conduct (or not) based on this.
The critical missing factor here is the basis for the voltage seen by the base of each transistor - this is relative to its emitter, thus for any consistent test case evaluation, the emitter ground in your circuit needs to be connected to the Arduino ground.
If the emitters do not share common ground with the Arduino board, the base voltage is totally arbitrary, and the only relationship that holds true for this design is defined by the presence (and current through) the pull-up resistors.
In the serial data connection use-case where things were working satisfactorily earlier, the most likely reason is that the serial cable (or its shield) itself was providing a ground connection that was common with the ground of the power source: Not an ideal design, but it worked by happenstance. |
H: What is the holding current on a triac?
What does the Holding Current characteristic mean on a triac?
What does this mean for switching loads less than the Holding Current?
For example the Sharp S108T02 has a max 50 mA Holding Current.
AI: To answer this, consider the simpler to understand SCR instead of a triac. A triac is sortof two SCRs back to back and therefore can pass current in both directions. A SCR only works one way but has the same issue of holding current.
Here is a equivalent circuit of a SCR:
SCRs are actually built as one integrated device, but you can conceptualize them as two transistors like this. In fact, you can even make a scr from a NPN and PNP transistor like this if you just want to experiment.
Look at this circuit carefully and see how it works. If somehow a little current were to flow thru one of the transistors, let's say Q1, that causes base current to flow thru Q2, which causes even larger base current thru Q1, which then turns on Q2 even more, etc. Once a little current starts flowing, this circuit latches on.
Now imagine current is flowing and the gate is left open. As long as the current continues, the circuit acts like a switch in the on state. However, below some level of current, the cascading amplifying effect can't be sustained anymore, and the circuit switches off. This minimum level of current so that the device is guaranteed to stay on is the minimum holding current.
This circuit only works with current flowing in one direction whereas triacs work in both directions, but the concept of the minimum current to keep the device on is the same. |
H: How do I identify Pin 1 on a chip with no corner mark
I am trying to identify Pin 1 of MAX3222E, the TSSOP variant (See Page 16 of datasheet), but it doesn't have any corner mark!
Could someone suggest how to identify Pin 1 in this type of situation?
I don't have a high-res camera on me right now, but I do have the chip in front of me, so here's a drawing of everything I see on top (the + sign is just part of the full name MAX3222EEUP+):
AI: If you dig a little deeper on the Maxim website, there's a package drawing for this part.
Pin 1 is clearly indicated.
Note 8 says: "MARKING IS FOR PACKAGE ORIENTATION REFERENCE ONLY", which means AAAA is boilerplate text.
Essentially, if you can read AAAA, pin 1 is lower-left. |
H: How do manufacturers determine LED characteristics?
I have several hundred clear LED's of mixed colour and would like to sort them and determine their characteristics so I can use them. As far as my research tells me, there is no way to determine the forward current of an LED directly, and in order to determine forward voltage you need to know forward current. My question is, how do LED manufacturers determine these values, and is there any way I can do the same?
AI: Just about all LEDs can take at least 20 mA. This is almost certainly true of anything in a discrete leaded case, like T1-3/4 or T1. Some small SMD parts may be rated for less.
I would use a 5V supply with a 330 Ω resistor in series. You are very unlikely to have LEDs that can be damaged by this. This will put at most 10 mA through the LED if you get it in the forwards orientation, or 5 V in reverse accross it for the backwards orientation. Neither should hurt ordinary LEDs. 10 mA will be enough for even inefficient LEDs to light up visibly on the bench (assuming typical indoor conditions).
Rig up a jig to show the voltage across the LED. Since the power voltage and resistor are known, you can calculate the current from this too. This will give you one datapoint for voltage and current, which should be good enough for most purposes.
If you don't see the LED light up in either orientation, then keep in mind it could be IR instead of dead. You can use most digital cameras to determine this because they can see the IR light. |
H: correctly choosing a relay in term of breaking current
I would like tu interrupt a resistive load on AC of about 1 kw at 220 Vac.
I'm looking at this relay, that claim to have a 10A current ( that sounds enought to me )
but the breaking current is just 0.12A at 220 V. What does it exactly mean? Would this relays just guarantee to break without damage a current of 0.12 A ? Which breaking current should I design for a load as described ?
AI: You were applying the DC1 specs to your AC load application by mistake.
The life cycle rating is limited by surge starting current and the breaking switch off current more than the steady state current of 10A. It is the energy dissipated across the contacts that matters or the V*I product during switching.
But in DC1 the curves are significantly derated becuase the breaking current is always the same as the steady current for "pure" resistive loads.
In AC loads with sinusoidal current most of the time it is less than the peak current so the average temperature rise is lower on the contacts, which controls life cycle time.
For conservative design, increase the current rating. |
H: 3.2 Gb/s high speed interface over 50m: copper, fiber, other ideas?
I need to run a 3.2 Gb/s interface over 50m. My client is keen on Cat6e. The lower the price, the better. These are my findings so far:
I'm looking at using a Spartan 6 GTP Tranceiver with copper (Cat6/6a). I've spent most of the past few days digging through Xilinx's documentation on high speed tranceivers (mostly http://www.xilinx.com/publications/archives/books/serialio.pdf), however I'm still a bit unsure about this. The following is what I've found:
The above document mentions that copper is OK for less than 6 Gb/s (GTP max is 3.2 Gb/s, so cool) and for distances less than 20m (I'm looking at 50m or so).
The cat6a specifications are for 100m and 10Gb ethernet (so that's fine?)
So what I'd like to do is maybe use Xilinx 10Gb Ethernet core in the FPGA with the GTP transceiver. (This core: http://www.xilinx.com/support/documentation/ip_documentation/ten_gig_eth_mac_ds201.pdf)
That document mentions that Spartan LXT is compatible with the 10Gb ethernet MAC, however, it doesn't say anything about copper, all the examples are fiber, and I'm assuming that the 10 Gb Ethernet core has a maximum speed of 10 Gb/s, but will work with lower speeds?
ALSO:
Is is possible to use other interfaces (AURORA, XAUI) over Cat6e as long as the specs meet the Cat6e requirements, (and considering that I'm looking at a 3.2 Gb/s interface)? Or do I need to use specific connectors/cables for Aurora/XAUI? (1 channel).
ALSO #2:
How "easy" is a board design/layout for a 3.2 Gb/s tranciever? The xilinx high-speed documentation mentions that special equipment (scopes, etc) is necessary for debugging high-speed interfaces. Since the clock period is 3x bigger than 10 Gb/s, i assume that the tight timing requirements are not as stringent?
I've used Aurora and XAUI before, but always the FPGA HDL design side, never the board design, and we always used high-speed connectors. This is my first high-speed serial board design. A second opinion would be hugely appreciated!
AI: The cat6a specifications are for 100m and 10Gb ethernet (so that's fine?)
I think what you're trying to say with this is that if 10G Ethernet can transmit 100 m over Cat6A cable, then it should be possible to transmit 3.2 Gb/s over 50 m with the same cable.
The difference between what it sounds like you want to do and how 10GbE does things is that the Xilinx serial IO, if I recall correctly, outputs a single 3.2 Gb/s serial data stream over a single pair of wires.
10GbE uses several tricks to get the maximum data rate through the longest copper cable.
First, they use all 4 pairs in the Cat6A cable to transmit the 10 Gb/s. That means that each pair is only transmitting 2.5 Gb/s.
Second, they use pre-emphasis encoding to maximize the usable bandwidth of the cable. Basically they enhance the high frequency portion of the transmitted signal. The transmitted signal then doesn't look like a clean data signal. But when its transmitted through the cable, the high-frequency portion is attenuated, and the received signal is closer to the ideal wave shape.
Third, they use error detecting and error correcting codes to allow error-free data transmission even when the cable degrades the signal enough to cause some errors in the raw bit stream.
Fourth, they use a 16-level pulse-amplitude modulation (PAM), instead of simple on-off coding, to send 4 bits of data for every symbol transmitted over the wire.
These last two methods are possible to improve the data rate due to the Shannon Theorem, which says that the maximum possible data transmission rate through a channel is determined both by the bandwidth of the channel and the signal-to-noise ratio in the channel.
I don't think any of this means that what you're proposing is utterly impossible. For example, the 2.5 Gb/s per pair data rate of 10 GbE actually becomes something like 3.125 Gb/s per pair when you include encoding overhead. But doing the PAM encoding to follow the 10GbE model is likely to require a specialized chip for both the transmitter and receiver, and some detailed design work to get it to work.
One possibility is, can you simply packetize this data up and actually send it over a 10 GbE link? That would allow you to use mostly commodity hardware to keep costs down, and also use a "proven" solution to reduce your risks. Some Xilinx FPGAs include a full Ethernet MAC that should enable this solution, but I don't know if its available at the price point you're trying to work at. |
H: Finding Failed Component in broken florescent lantern circuit
Recently, I burned out the circuitry in a florescent lantern by accidentally reversing the polarity of the volts in. The circuit seems pretty simple, a transformer, 3 resistors, 3 mono capacitors, a 100uf electrolytic capacitor, a 5609 transistor (it exactly says 5609 5C C EBC) and a small diode. I am wondering how I can test the components on this and identify which one to replace. I know the transformer works because I put a power supply on one end and a neon bulb on the other, and the bulb flashed when I added power for a second. I also tested the diode with a digital multimeter and got 620 ohms one way and insulating the other, so i am guessing the diode works. So this leaves the transistor and the capacitors. I am most likely sure that the transistor is the failed component, but I have no idea how to test it, and see what is wrong with it. I am guessing that the transistor is used as an oscillator for the transformer to get the right voltage for the bulbs and thus no oscillation means no light. So how can I test the remaining components (especially the 5609 transistor) so I can see what to buy and replace so I don't have to buy a whole new Lantern.
I know I was stupid messing with it and burning it out, and I should have just kept it to its 6 D battery power supply, but I am only 14 and any information will help!
AI: A good design will have a blocking power Shottky diode to protect the active and polar caps from reverse damage. It looks like your product didn't have one, or possibly you bypassed it inadvertantly with your external DC.
The prefix and suffix to the '5609 are important when you look for a replacement. It is a PNP power switch with linear hFE. Most likely 5A part with 80V rating. The suffix A,B,C are ranked with increased sorted bins of hFE. If not, then no sort.
The transistor can be tested with an ohmmeter as two diodes connected to the base to determine function but sometimes the coil impedance or other circuit loads will affect the result, so removing it is best when in doubt.
Transistors can handle reasonable reverse voltage in fact the Collector-Base is always reverse biased. But the Base-Emitter Veb reverse ratings are much lower.
edit I corrected myself
Emitter−Base , Reverse Voltage, VEB = 5 Vdc absolute max on both the 5609 and my suggested replacement.
High eonough to test on an ohmmeter but dont try much more.
However the design must protect the transistor when the inductive load is switched off so that it does not exceed MAX Vce and Veb ( reverse biase mode).
This is a good way to get experience but breaking and then fixing
them. That's how I did it at your age. ( and sometimes still do it ,
heh!)
Here is one possible replacement part.
http://www.onsemi.com/pub_link/Collateral/MJD44H11-D.PDF Specs
I chose one at a higher current rating same voltage , in stock and < $1 @1pc. Depending on your suffix, a better one might have higher beta or hFE. This one is 40 min @ 4A which is not bad. |
H: Why does working processors harder use more electrical power?
Back in the mists of time when I started coding, at least as far as I'm aware, processors all used a fixed amount of power. There was no such thing as a processor being "idle".
These days there are all sorts of technologies for reducing power usage when the processor is not very busy, mostly by dynamically reducing the clock rate.
My question is why does running at a lower clock rate use less power?
My mental picture of a processor is of a reference voltage (say 5V) representing a binary 1, and 0V representing 0. Therefore I tend to think of of a constant 5V being applied across the entire chip, with the various logic gates disconnecting this voltage when "off", meaning a constant amount of power is being used. The rate at which these gates are turned on and off seems to have no relation to the power used.
I have no doubt this is a hopelessly naive picture, but I am no electrical engineer. Can someone explain what's really going on with frequency scaling, and how it saves power. Are there any other ways that a processor uses more or less power depending on state? eg Does it use more power if more gates are open?
How are mobile / low power processors different from their desktop cousins? Are they just simpler (less transistors?), or is there some other fundamental design difference?
AI: The rate at which these gates are turned on and off seems to have no relation to the power used.
This is where you are wrong. Basically, each gate is a capacitor with an incredibly tiny capacitance. Switching it on and off by "connecting" and "disconnecting" the voltage moves an incredibly tiny electrical charge into or out of the gate - that's what makes it act differently.
And a moving electrical charge is a current, which uses power. All those tiny currents from billions of gates being switched billions of times per second add up quite a bit. |
H: Difference between EEPROM types
I was wondering what the difference between EEPROM types are.
For example 24S128 and 24LC128. My understanding is that typically the later digits, 128 in this case, represent the amount of space available on EEPROM. But what does the 24 and the S/LC/C/AA stand for?
Thanks
AI: First of all: Memory IC nomenclature is not robustly standardized; There is a lot of variation and even conflicting coding between manufacturers, on the order and meaning of the codes making up the part identifier.
That being said, here is an attempt at providing an overview:
The initial 2-digit code is the device family. A leading "24" indicates a I2C serially accessed EEPROM. Some other families are 95 (SPI serial EEPROM), Flash (e.g. 28F, 29F) and "standard" EEPROM (28).
Some manufacturers precede the 2 digits by a letter code, M for memory devices (STMicroelectronics, Atmel and others) optionally followed by an additional letter e.g. MX = Macronix memory.
Thus the device family becomes M24 for these examples.
The next letter or two usually indicates logic family / device voltage, but different manufacturers differ in their use of these codes:
C = 5 Volts
W = 2.7-3.6 Volts (sometimes 2.5 to 5.5 Volts)
V = 3-3.6 Volts
L = 4.5-5.5 Volts
R = 1.8-5.5 Volts (typically STMicro)
AA = 1.8-5.5 Volts (typically MicroChip)
LC = 2.5-5.5 Volts
The digits after this do typically indicate memory capacity, but this is not simply the number of bits or bytes of memory. For instance, 512 = 512 Kilobits 8-bit EEPROM, but 516 = 512 Kilobits 16-bit EEPROM (usually, but not always!)
Some memory devices follow this up with a 2-digit access time code, i.e. access speed of the memory. Here again, 25 = 25 nanoseconds, but 10 = 100 nanoseconds usually.
This may be followed by a single or two-letter package indicator (B = Plastic DIP, N = TSOP, and a variety of other codes).
Last, a single-character (number or letter) device grade code may be added, i.e. various temperature ranges, military-grade, automobile grade, etc.
The only reliable way to interpret a particular memory IC's code, is to look it up in the datasheet, since there are wide variations, and even outright discrepancies, between manufacturers (and I suspect sometimes between production years too).
There are Application Notes for memory nomenclature by STM and several other manufacturers out there. Also, a fair guide to memory ICs, if somewhat incomplete, is here. |
H: How can I emulate the PS/2 protocol without a microcontroller?
I am trying to emulate the PS/2 keyboard protocol with a custom piece of hardware, without using a microcontroller. The said piece of hardware will consist of 13 momentary push buttons.
http://pcbheaven.com/wikipages/The_PS2_protocol/
The keys will be hard mapped to specific ASCII values. My idea is (with intricate trace design), on button press, to fill a shift register with the correct ASCII value + PS/2 bits and shift the bits out as the PS/2 data. I was hoping to control the shift register with a decade counter, opening the the latch and inhibiting the clock to the shift register for one cycle, then waiting for 11 cycles to shift the data out of the shift register.
Is there an simpler more obvious solution or should continue to refine my design? I'm testing the concept with 8 stage shift reg + counter, but will expand later to accommodate the necessary 11 bits if the concept works. Also, no formal training in electrical engineering, I apologize if my question is not appropriate.
AI: You need to be careful: the PS/2 protocol is bidirectional, so you can't just transmit. Once in a while the computer will pull the CLK line low and then drive the DATA signal for a few clocks, and then you need to acknowledge it. Furthermore, your understanding of a keyboard protocol appears to be a bit incomplete. They do not send ASCII values, they send key codes, including separate key-down and key-up events. Also, you need open-drain outputs.
It would be far easier to do this with a microcontroller. Regarding your specific arguments against them in your comments:
Cost: there are lots of microcontrollers with enough I/O to read the key matrix and speak PS/2 that are less than $0.50, like the PIC16F54. You will be hard pressed to get all of your discrete parts for less.
Programming: You can order chips pre-programmed with whatever firmware you provide from a distributor like Digikey, or directly from the manufacturer.
Efficiency (space): A single microcontroller will be much smaller than several discrete chips and usually includes an internal clock, pull-ups, open-drain buffer, etc. (Note that open-drain can be achieved by switching a pin between two states: output 0, or input with pullup enabled.)
Efficiency (power): Microcontrollers have lots of sleep modes available and can be almost completely powered off while no keys are being pressed, or in between scans of the keyboard.
Efficiency (your time): You will likely run into lots of problems besides the protocol issues, like needing to debounce keys, etc. Firmware fixes are going to be a lot faster than having to respin a PCB or order some new chips. |
H: Eagle project wont open, "Error reading file"
I'm working on a board layout with Eagle. I tried to open the file today and get a message "error reading file". No other info besides that and I haven't been able to find anything about this. It does this with both the .sch and .brd files. Any ideas?
AI: If it is a recent Eagle version, you may open the .brd and .sch files with a text viewer, because they are basically xml text files. This may give you a clue of what is happening or a way to fix it.
BTW, eagle also keeps a few backups (exact number is configurable) of the last saves.
For example, .sch backups will look like this:
mysch.s#1
mysch.s#2
...
Similary, .brd backups will look like this:
mybrd.b#1
mybrd.b#2
And even library backups (previous saves) will look as follows:
mylbr.l#1
mylbr.l#2
... |
H: Is this a good circuit to control LED?
I'm taking an intro electronics course, and we recently covered MOSFETs. Would the circuit below work for controlling a 3W LED? Here is the part info. The LED wants about 1A of current. I'm thinking I can use the variable resistor to set \$V_{gs}\$ on the MOSFET so that it allows 1A to flow to the LED. For the 5V supply I have a computer power supply, so I could actually use other wires and get 3, or 12 V.
AI: Yes you can make this work. As tcrosley points out, you'll end up with 1A @ 2.5V across your FET so you need to dissipate 2.5W or so (M1 will need a heatsink).
A more efficient circuit (less heatsinks) would be to use a buck converter and measure the led current with a sense resistor. Then use feedback to set the buck voltage according to the brightness you want.
If you are stuck with the 5V supply then another option is to use two of your leds in series. That way you get some more light. |
H: what is solderless post
I've seen metal "sticks" with a special end that let them fit snugly into a through-hole for when you want a contact but don't want to solder a wire into the hole. What are they called and where can I buy them?
I think they are called "Posts" and are used for prototyping, but searching "electrical post" on Google just doesn't cut it.
AI: You want pogo pins. Solder the non-pointy end into a board and push the receiving board onto the pointy end when you want to use it. Obviously you'll have some pattern of pogo pins and a matching pattern of smaller-than-the-pointy-bit vias (through holes) to mate with. The idea is they allow some wiggle room for mating boards, all the pins don't have to be perfectly the same length.
I use these for test boards. Make a board to match the test points on your device and build your test circuitry onto it. Recently I've started using them for very small programming connectors too, seems to be working pretty well.
EDIT:
The very small Spy-Bi-Wire programming connector I made looks like this on the board
This is the surface pad version on a 1 mm grid, I also made a through hole version of the same size for use if I have the board space on both sides (I suppose a blind via would work, if I didn't care about board cost). The programmer has an identical arrangement, but with through holes for the pogo pins to solder in (but pointing out the bottom of the board). The center is an alignment hole. Until I find a better solution, the programmer side of this connection has a thin pin where the alignment hole is, I stick that through the target board alignment hole and clip the far side so it doesn't slide back out. The surface pad version works fine if I'm not moving the board all around because it can accidentally rotate, though I've found the pogo pins usually stop at the solder mask (the through hole version doesn't have this problem). I'm still trying out other variations, but like I said, this one does seem to be working out quite well. |
H: How can I get a C program to execute Python code that sends commands to an Arduino?
I followed these instructions successfully, so I was able to get the Raspberry Pi to send "HELLO\n" to my Arduino Mega 2560 over USB and print to Serial console.
I have installed Open CV successfully on my Raspberry Pi using these steps and successfully tested camshiftdemo.c with my web camera on the pi.
Now I would like to execute camshiftdemo on the pi and get it to send "TURN LEFT\n" or "TURN RIGHT\n" strings to a 4-wheel rover. The rover is attached to my Arduino Mega 2560.
So basically, Raspberry Pi runs camshiftdemo.c, tracks an random object of user's choosing. Then camshiftdemo draws an ellipse around the chosen object as it is moving. If the object drifts to the left side of the web camera, the Raspberry Pi sends "TURN LEFT\n" to the arduino, causing the wheels of rover to turn left. If the object drifts to the right side of the web camera, the Raspberry Pi sends "TURN RIGHT\n" to the arduino, causing the wheels of the rover to turn right.
The camshiftdemo code is written in C and the first link above shows how to use Python to send simple ASCII commands to an arduino over USB. How do I combine camshiftdemo.c and Python to work together? Specifically, how can I modify "camshiftdemo.c" to execute python code from the C program?
Would greatly appreciatea all / any advise.
AI: You should just send the serial commands from C. No need to embed a Python interpreter. For all the information you might need on the topic, see the excellent Serial Programming Guide for POSIX Operating Systems.
Also, this question is off topic for this particular site. |
H: Designing an inverse polarity and overload (crowbar) protection circuit
There are some great resources on the internet and on this site about designing various protection (crowbar) circuits. For example, Leon's answer to a general circuit protection question.
I'm looking for a little more specific advice on selecting type of components and/or values for my application. I'm a little confused about whether to use a standard fuse or a PTC fuse; whether to employ a Schottky diode or a simple rectifier diode...
Currently my prototype is built on a 2-layer PCB and uses an AMS1117-5.0 voltage regulator (SOT-223 pkg) for 5 volts. It uses about 32mA on average (fluctuates between 22 and 42mA). I'm not sure what the startup current is or how to measure it.
Based on the datasheet for the regulator, with a dropout voltage of between 1.1 and 1.3, I am speccing the device as requiring between 6.3 and 15 volts. (If I use a Schottky, I'll need to increase the minimum accordingly.)
What I would like to accomplish is the following:
Protection against inverse polarity
Protection against overvoltage and overcurrent (exploding parts, fire, etc.)
Typical operation will utilize 6 series AA cells, either NiMH or Alkaline (7.2 to 9V). These have current capacities of 2300-2500 mAH (though I'm not sure if such cells can actually deliver more than 2.3 to 2.5A).
I'd like for polarity reversal to do no damage and not require a fuse replacement. Overvoltage and overcurrent conditions can blow a fuse. I'd also prefer a minimum of parts and cost as another design goal is small size. Surface mount components preferred.
Current schematic with no protection:
So my question is thus:
Of the components: Schottky diode, rectifier diode, "normal" fuse and PTC fuse; what combination of these (or other suggestions) would best serve my requirements?
What criteria should I use to select appropriate values?
It's been suggested here and elsewhere that doubling the normal current use may be a valid starting point for selecting a fuse. I found a Littelfuse 1210L005 resettable PTC which has a hold current of 50mA and a trip current of 150mA, but I am not sure if these are desirable values.
AI: So for polarity reversal causing no damage and requiring no fuse replacement you can use pretty much whatever diode you want and put it in series so that "normal" current flow passes through the diode only if properly plugged in. With the current requirements and voltages that you're working at, this shouldn't be an issue. A simple silicon diode should be fine.
For overvoltage you're going to want a circuit more like what Nick Alexeev suggested in the comment. Essentially a zener diode with a PTC or other type of fuse. The Zener should have a value which is less than the maximum input to your regulator.
So basically, if you reverse batt_in+ and batt_in- the first series diode will prevent any current from flowing and protect your circuit. If batt_in is greater than the breakdown voltage of the zener, it will start pulling down a lot of current, and blow the PTC fuse.
The only extra thing you might do, is to guarantee that the startup current doesn't exceed your PTC's current limit, you can place a resistor on "protected V_IN+" or "protected V_IN-" (in series before the regulator and decoupling capacitor) such that:
(BATT_IN+ - V_forward_diode - Resistor*Maximum_expected_load) >= Vmin_regulator
For the desirability of any specific characteristics for the PTC, the diodes, and everything else, it all depends on your application. In general, I tend to wing it unless I have a real reason to crunch the numbers. I'm also a bit too tired (on my way to bed) to really get into how to calculate what these values should be, but if you need this info ask in a comment and I'll post some tips on getting the numbers.
Though, why not just use a polarized connector for the batteries so that you don't have to worry about whether the connector is plugged in backwards? And in what context are you going to overvolt? Think about these questions too when trying to answer a more complicated design choice (a polarized connector is easier than adding an extra diode, and is less likely to lead to extra design considerations).
Hope that helps! |
H: Will a digital potentiometer work with 230 volts (ac)?
Will a digital potentiometer work in a circuit that uses UK mains power (230vac)?
I want to be able to adjust the voltage digitally.
How could I digitally (or non-manually) control the voltage of a 230vac circuit?
AI: I guess no digital potentiometer will allow you to do what you want. They are tipically used to drive low-voltage electronic circuits. You probably need an adjustable transformer (varivolt) or some kind of switching AC-AC converter to achieve what you want. |
H: Tracking pen within whiteboard surface
(Question in response to the comments.)
I have a fixed flat white rectangular whiteboard of dimensions 1 meter by 0.5 meter and pen. I want to track the position of the tip of the pen within the whiteboard, in real time.
I am allowed to have as many different sensors and processors on the sides of the whiteboard as I want, but there are three main restrictions:
The pen should operate freely; no wires or strings between the pen and the sensors are allowed.
The pen should be low power, ideally powerless.
The position of the tip of the pen should be determined with an accuracy on the order of 1mm.
What electronic setup would allow me to compute the position of the tip of the pen within the whiteboard with the above restrictions?
AI: The technology used by Microsoft Kinect is possibly the most cost-effective solution for the stated requirements.
The approach consists of a digital video camera / webcam at the sensing position, with a field of view covering the area of interest. In order to consistently locate the target object to a 1 cm precision, the camera must be able to capture a minimum resolution of 1 pixel for every 0.5 cm. This translates to 200 pixel resolution for the long edge, and 100 pixels for the short edge, at the bare minimum.
This is comfortably covered by using a 640 x 480 VGA resolution webcam, providing sufficient oversampling for enhanced precision if needed.
Depending on the processing power available to you, sampling precision and position update rates can be changed, to meet your unspecified "real-time update" rate requirement.
Alternatively, the Kinect SDK released by Microsoft (and a Kinect device) would allow a rapid prototyping of the requirement in a matter of hours. Then, depending on performance and price considerations, the final approach can be worked out. |
H: What's a good estimate on how low an alkaline battery voltage can be to still make the battery useful?
Here's a YT video by Duracell about how many batteries declared dead and sent to recycling still have some usable energy. In the beginning of the video there's a sequence where they have a row of batteries and a person quickly touches each with a pair of probes to decide whether a battery is worth anything.
The measurement procedure is not documented, but I'd guess they just measure voltage on the terminals. Batteries have likely been idle for days or weeks before the measurement.
Suppose I want to do a similar project and have a pile of batteries and a voltmeter.
What's a reasonable voltage threshold to decide usable alkaline batteries from useless ones?
AI: A fully discharged alkaline cell (nominal voltage 1.5 Volts) still retains a voltage of 0.9 to 1.0 Volts. Therefore, voltage threshold for measurement can be taken as any value above 1.0 Volts.
Battery energy delivery capacity however would be limited by other factors: Internal resistance / electrode surface deterioration. A cell that has been left unused for a long period would show poor power delivery capability due to this.
One way of evaluating these "depleted" batteries would be to measure current delivered due to a brief pulsed load, i.e. a low resistance across the terminals for a brief duration.
Such a measurement device can be built conveniently by connecting a resistor and a MOSFET in series across the terminals, feeding the MOSFET gate with a series of short pulses, and reading the voltage across the resistor each time the MOSFET is switched on. |
H: How does a TVS absorb voltage?
I cant understand how a TVS might absorb voltage. As far as I can see, when a transient is applied to it, it becomes a very small resistor, so the transient voltage will still be on top of him, but all the current will flow through it.
AI: In an ideal circuit with a perfect voltage source and no parasitic resistance, you would be right -- even if the transient voltage suppressor (TVS) conducts 100 A of current the damaging voltage would still be present on other components.
It's the parasitic effects that let the TVS work. There is resistance and inductance in the traces, vias, and pins, and there is capacitance at various points (bypass capacitors placed on the PCB, internal bypass capacitance on an IC, parasitic capacitance). All of this means that when the voltage is briefly too high at the TVS, it will not immediately be so high at the downstream circuits.
Of course, if you force an overvoltage condition for long enough, it will still damage the circuits, but that would no longer qualify as a "transient voltage" to be suppressed. |
H: How to find the output and input impedance of an amplifier
For example:
Vcc -> GND
capacitors -> wires
NPNs -> hi and current source
The schematic above becomes:
How can you find the output and the input impedance?
The answer in this case should be(output impedance):
I guess hi1=hi2 since it's the same transistor
AI: There are two "tricks" to answering those questions with transistor amplifiers.
The first trick is to understand that the current-transfer ratio (hFE) of a transistor effectivly multiplies the resistance at its emitter. So, to find the impedance looking into the base, you calculate the effective resistance at its emitter, multiply this by hFE, and then add the internal base resistance.
The second trick is to realize that the result of the calculation above is typically orders of magnitude larger than the other resistances connected to the base of the transistor and can therefore be ignored. In other words, the input impedance of a transistor amplifier is usually very close to the impedance of its bias network alone. Indeed, bias networks are very often designed so that this is the case.
The output impedance is a question of how much the output voltage changes with output current: ΔV/ΔI. The transistor itself is essentially a current source, and whatever current it is passing is shared between the various resistances connected to the emitter. Therefore, the output impedance is equal to the net emitter resistance, not including the resistance of the external load. |
H: Connecting RS232 output of Lattice XP2 Brevia Kit to PC USB (virtual COM port over USB) using a FTDI RS232RL based board
I have a Lattice Brevia XP2 Kit (the older one that came out in 2010/2011, and the not the newer version 2). The only PC connectivity it has is through serial (rs232). I have anetbook that does not have the rs232 port, but I regularly use a Sanguino via virtual COM port over USB. I use a FTDI breakout board for this.
I am trying to use this FTDI board to also communciate with the XP2 kit. For this, I have wired the rs232 null modem cable supplied in the XP2 kit to the FTDI board via temporary connections using jumper cables. Here is a pic (apologies for the quality) and the wiring diagram is below it.
RS232 pin assignments on the XP2 Brevia kit:
Wiring diagram:
When I analyze this using the Advanced Serial Port Monitor utility, I see no errors and can send data without errors. I am supposed to see some headers from the Brevia XP2 board but I see nothing (no errors too).
What am I doing wrong?
Rgds,
Sushrut.
AI: From memory, the Brevia happens to have its connector backwards; it has a female connector, like DCE such as modems, but the wiring is in DTE order. The simple solution is to use the included null modem cable (it looks like an extension cable but swaps pins 2 and 3) with a common USB to RS-232 adapter.
The FTDI breakout module uses LVCMOS levels (1=3.3V, 0=0V) rather than RS-232 levels which are a much wider range), and is missing the level shifting part (U3 on the Brevia). You could use it with other general I/Os by changing the pin mappings in the FPGA design. Just edit the pin constraints for your FPGA design and map the RS232_[RT]x_TTL signals elsewhere; I/O pins are equal as far as the FPGA is concerned, aside from a few dedicated to clocks, reset signals or configuration. |
H: Can current be drawn from ground in a SWER transmission setup?
I am almost certain that this is a ridiculous question, but cannot figure out why it wouldn't work.
From what I understand, current from the electrical station is distributed to houses through power lines, then, to complete the circuit, returns to the station through the earth. Is there anything stopping someone from burying two electrodes of a simple, low-impedance element deep enough into the ground that the current will travel through it in its path back to the power station?
Low impedance bulb
|---@@@@---|
| |
| gnd | gnd
_|_ _|_
_ _
- -
AI: No, power is generally not delivered by using the earth as one of the conductors. This has been done in the past, but most of those have been replaced, and I don't think anything new is getting installed like that.
You are however right in that two stakes in the ground in line with the current flow at the right location where the ground is being used as a conductor would exhibit a potential. And, you could extract power from that. The funny thing is you'd actually be doing the electric utility a favor by making the overall ground resistance a tiny bit lower. In other words, the power you would extract would be less than the wasted power it would displace.
There have been cases in the past where these ground currents have causes problems. For example, a pipe coming in one side a house can be at a different potential than the ground at the other side of the house. Under the right conditions people have gotten zapped.
However, things aren't done this way anymore in part because of the problems but also because the loss was high. Where the current went in the ground was unpredictable, and sometimes it got concentrated in inconvenient places where the resulting potential offset would cause trouble. |
H: OR gate from one AND, three NOT?
I'm just starting with digital-logic but I now face a little problem: I learned that AND, OR, NOT were basic gates and that one basic gate could not be made from a combination of two others. How comes that this combination:
produces an OR truth table from only AND and NOT gates?
AI: Whoever told you that was simply wrong. In fact, many logic families use just one kind of gate, especially in the early days. RTL logic families were basically all NOR gates, and DTL and TTL families are basically NAND gates. In either case, you can think of NOT as a single-input gate.
You can build any logic function at all from just NOR gates or just NAND gates. Entire computers have been built this way, including the earlier Cray supercomputers.
And don't forget that !(A + B) == !A & !B and that !(A & B) == !A + !B. Take the first equation and negate both sides, and you end up with your example: A + B == !(!A & !B). |
H: PIC16: Problems with UART receive
I have a PIC16 for which I have the (asynchronous) UART transmit working just fine, but the UART receive producing invalid results.
For example, a gets interpreted as O, b gets interpreted as ', and c gets as N.
Here is my receive function:
char UART_read(void) {
while(!PIR1bits.RCIF) {}
return RCREG;
}
My hypothesis is that the UART polarity is wrong for the receiver, so that in particular the start/stop bits get messed up. I have set the SCKP bit (see page 302) to invert the data on the TX/CK pin but I cannot find an equivalent for the RX/DT pin.
What could be the cause of the UART receive not working? How can I invert the data on the RX/DT pin?
AI: EDIT: This answer has been modified to reflect the comment by the question asker and points out that he is quite right in his diagnosis of the problem, which isn't terribly useful information. The only useful piece of information in the section is the fact that there is no receive invert bit... But perhaps it will help future people diagnose their own UART problems
So let's take a look
a maps to O which means 01100001 maps to 01001111
b maps to ' which means 01100010 maps to 00100111
Let's assume that there's an implicit 1 before each of those and an implicit 0 after (start and stop bits). The RX module receives a continuous low signal, then the stop bit is sent as a high, which will be eaten as an idle signal, then the initial 0 will be consumed as a stop bit. Then the remaining bits will be inverted,
so 'a' == 1 10000110 0 initially (we send least significant bit first)
1 (implicit start bit) and starting 1 are both consumed as idle bits
then the first 0 is treated as a start bit
so received == 00001100 inverted (the extra zeros are the stop bit and idle bits after transmission has ended)
11110011 and reverse it (it was sent LSB first)
11001111 is what the inverted input would look like
01001111 is what's actually received which is super close!
if what you actually sent was "abc" all in a row, then the start bit of the b would make what was received 01001111 which matches exactly
'b' == 1 01000110 0 ==> 10001100 inverted and reversed gives
11001110 is what should have "logically" happened
00100111 actual
So that doesn't quite match, but if we assume that the "abc" is what happened again, we get
01001110 which is close enough (not sure where the shift came from)
Looks like you nailed the diagnosis, unfortunately there is no similar "invert signal" configuration bit in the receiver on the PIC. Though it's not hard to put an inverter on the receive path, which is incidentally what I would recommend doing!
As Olin noted, standard rs-232 signals are from +3V to +15V for a logical '1' and -3V to -15V for a logical '0'. The PIC is designed to operated at "TTL" levels, which means "transistor-transistor logic". The idea is that the PIC is designed to talk to other things which are physically close (i.e. on the same board) and thus the extra transmission distance and noise rejection provided by the full rs-232 levels are not needed for "standard" operation. It's not practical to be able to completely internally generate the positive/negative voltages needed for rs-232 operation completely internally on the PIC, so "normal" rs-232 communication was never really an option.
Since TTL levels are not the standard but instead a derivative of the standard (same protocol for timing, start and stop bits, parity, but different voltages), you don't buy a consumer "rs-232 adapter" for your computer unless it adheres to the standard. They do make TTL-level rs-232 adapters and they're very popular on hobbyist websites! Check out Adafruit's cable or the Sparkfun FTDI breakout. I find that in general, if it goes to a DB9 connector, it's probably a rs-232 level adapter. |
H: Triac datasheet values
I have a Triac that I want to use to control low voltage (~16 V) AC. The data sheet is found here. It specifies that the peak gate voltage is 5 V with a peak current rating of 2 A (which seems quite high to me). The datasheet also lists out the Gate trigger voltage as 0.7 V (typical).
I'll be using this opto-isolator to drive the triac gate, which doesn't seem to have much play in my question (but I could be wrong).
UPDATE: After some additional research it turns out that I was wrong here. The opto-isolator's max current is the determining factor for the gate resistor value. The iosolator used here has a max detector current of 1A. 16VAC has a RMS voltage value of 22.62VAC which leads to a minimum resistor value of 22.6 / 1 = ~22 ohms.
My question is which of these values should I consider when choosing a resistor to place before the triac's gate/opto isolator? I understand how a Triac and it's associated driver works but I just need a little assistance with reading the datasheet and which of the values I should be considering.
Also, are there any good resources for learning how to read datasheets or is this something that just comes with experience?
AI: I think you have to design in term of current, that must be >= to the Gate Trigger current in order to have the device ON. You can use the Gate trigger voltage as a voltage drop when you measure the current flowing in the gate in order to switch the TRIAC. |
H: How to simulate the depression of a push button connected to an Arduino, with another Arduino?
I have an Arduino which uses several push buttons to simulate the keypad of a digital door lock. This microcontroller remembers the last four depressed buttons and turns a LED to green if the code is correct.
Now I would like to crack this lock with another Arduino which would send the De_Bruijn_sequence on the keypad to brute force it open. (See 'Uses' paragraph on this page)
Which component do it need to simulate a depression of a push button on the first circuit ? How fast can it be done ?
AI: The answer to this question depends a lot on the specific circuit that is used to implement the push buttons. Typically push buttons are connected from the MCU input to GND. There is then often a pullup resistor from the MCU input to the VDD of the MCU. If this simple case exists in your situation and the pullup resistor has a value above say 1K ohms then you can safely just connect output pins of the second MCU directly to the MCU inputs of the first board. Remember to also interconnect the GNDs of both boards together.
With the direct connections you need to make sure that you never program the pin directions of both boards to be OUT at the same time or else damage to one or both MCUs could result. Another caution is that if you connect the second MCU whilst the push buttons are still attached then make sure that the switches are normally open type and that you do not push them while the second MCU is connected. It may be best to just temporarily disconnect the push buttons while the second MCU is connected.
Since the first MCU has to deal with real push button switch detection it has to implement switch debounce. The software of this first MCU may also be designed to detect just one switch press at a time. Thus the speed at which the second MCU can be programmed to simulate button presses will have to take the design constraints of the first system into account. You may simply be stuck with having the second MCU able to only operate slightly faster than a human can press the buttons manually. |
H: Thumb Wheel Potentiometer
I know that thumb wheel potentiometers are an outdated technology, everything is moving to rotary encoders. The problem I have is that my company has a large number of legacy products. We have designed rotary encoders into most of our designs but have a few very low volume products that wouldn't be worth a complete redesign. Here is the datasheet for the component currently used(its the 3rd on the datasheet). If anyone knows where to find something similar that would be great. I am also open to other alternatives and ideas anyone may have that would not require a complete redesign. I would like to simply be able to just update the footprint on the PCB to fit a new potentiometer
Note: I proposed the possibility of a knob protruding from the side of the product to control volume but that idea didn't go over very well, the thumb wheel is preferred.
Note: some specs are 10k, single turn, about 12.7mm (0.5") diameter
Discontinuation Notice
AI: You say this is a low volume product. Therefore, just do one last lifetime buy. Even if you could find a drop in replacement, that would likely go obsolete soon too for the same reason. Doing a single lifetime buy will likely be cheaper than the engineering effort to find and then deal with parts that are not quite the same. |
H: Assemble PIC connector from bits
I want to build a custom connector to attach to the PICKIT3 serial pins. I have the black plastic bit and little metal bits (similar to the picture below), and wire.
Out of these components, I would like to build a connector with a small piece of wire sticking out for every hole from the black plastic bit.
What are the steps to assemble the connector? What tools I should use?
AI: First, let's use the right terminology.
The "black plastic bit" is referred to as the housing; the "little metal bits" are the contacts: in this case sockets. The ones in the picture, as SomeHardwareGuy inferred, are crimp type (as opposed to solder cup) contacts. They should be crimped with an appropriate crimping tool.
The tool in the photo is barely adequate and may do an acceptable job if the connector won't be used for anything critical. Do not use pliers! A good quality crimp requires very high pressure applied at the right point of the contact and pliers simply won't do that. A crimper recommended by most manufacturers is unfortunately, rather expensive. The cheapest good one I know of is the ProCrimper from TE Connectivity (formerly Tyco). It costs around $200 but does an amazing job and is well worth the money if you do a lot of crimped connections. This is a Molex page that explains what it takes to make a good crimp. The full document can be found here
There is a fairly low cost crimping tool being sold by a bunch of hobby outlets for anywhere from $20 to $40. I bought this one
from Hansen Hobbies. It does an acceptable job and is far superior to the one in the other answer, and costs a lot less than the ProCrimper shown here |
H: RC time constant in astable multivibrators
I'm having trouble figuring out why exactly \$T=0.693 R C\$ is used for astable multivibrators (and why \$T=1.1 R C\$ for monostable).
At first I assumed this was only used for 555 timers but the same formula is also used with astable multivibrators made with transistors.
Since \$\tau=R C\$, we're basically finding the time it takes to get to 69% of \$\tau\$. The only thing I have figured out is that we are finding the \$T_{1/2}\$ value but I don't understand why. Why is this value used for astable multivibrators?
AI: The time of one half-cycle of the classic two-transistor astable multivibrator is the time that it takes the base end of the capacitor to charge from (VCC (VBE + VCE(SAT))) to +VBE.
For example, at the moment right before the left-hand transistor switches on, the capacitor connected to its collector is charged to (nearly) VCC, with its left end positive. Note that the other end of the capacitor is held one diode drop above ground by the B-E junction of the other transistor. Now, immediately after the left-hand transistor switches on, it is now clamping the left end of that same capacitor to ground (actually, Vce(sat) above ground). Since the voltage across the capacitor can't change instantaneously, that means that the right end of it is initially driven to VCC. This is the starting point of the exponential curve for this half of the timing cycle.
Now, keep in mind that the capacitor is charging "toward" +VCC, but it gets halted by the B-E junction of the transistor at +VBE. This charging is occuring at a rate determined by the time constant C × R, and we're basically interested in the time that it takes to move halfway from its starting value to its final value. This works out to ln(0.5), or 0.693 times the R-C time constant.
For a more complete explanation of this circuit, see the Circuit Cellar "Engineering Quotient" column for issue 262 (April 2012). |
H: Two Port parameters on an Op Amp
I am asked to find the h-harameters for this op amp:
I found the gain to be 1.87*Vi (where Vi = the input source). However I don't know how to do two port parameters with op amps, we've only covered basic circuits (Resistors, inductors, and capacitors.)
How can I find the h-params of the circuit above?
AI: First, you have to define what H parameters you want and exactly what they mean. The H parameters for transistors, for example, don't apply. Hfe stands for "H-forward-emitter" meaning the forward (input to output) characteristic in the common emitter configuration. Obviously that makes no sense for a opamp circuit like you show.
You show a opamp circuit, but ultimately this has only a single connection. Most H parameters don't make any sense for this since you can reduce this circuit to a Thevening voltage source, or equivalently, to a Norton current source.
H parameters are generally the ratio of two characteristics. You could make a case for specifying the H parameter looking backwards into the output (since that's all this circuit presents to the outside world). If you consider the output of this circuit to be a voltage, then this H-reverse parameter would the ratio of the change in output voltage to a small change in the output current. Note that this is in units of Ohms, and is exactly the Norton or Thevenin impedance of the single source this circuit is. This is why, again, it makes more sense to describe this circuit as a Thevenin or Norton source, depending on whether you view it as a voltage or current source, respectively. |
H: Integrating IP core to a project
I'm working on a Lattice board and I'm want to to use IP cores for my project. I have a license to a third party IP core but I have no idea how to integrate the IP to my project. My research shows me that the info available online is specific to different design tools and I haven't found one for Lattice Diamond. My question is, are different IP cores implemented differently or is there a general method to do so?
AI: Ask the vendor of the IP.
To answer your question, IP cores can be implemented differently
An encrypted netlist. This is specific to the vendor, and more often that not the specific series of parts.
A VHDL/Verilog file. This is typically more expensive. This is more common for ASICs. |
H: Using JTAG to "explore" a board without damaging it?
I have one Amontec JTAGKey2 Generic USB JTAG cable interface. What I am looking for is some explanation of how to "explore" a device of which I don't know all exact details, but for which I have a BSDL file that fits almost. I cannot damage the device, which is why I'm trying to be extra-cautious.
Is this even possible or am I looking at the wrong technology for the task below?:
In general my first main interest is to poke around in memory and perhaps change a few bytes.
Next would be flashing a component connected to the JTAG chain.
Right now I am locked out of the board because the "environment" of the (vendor-custom) boot loader is invalid and the boot loader simply ends up segfaulting without letting me into the interactive mode.
The board for which I only have very little documentation of a newer hardware revision (unfortunately under NDA) than I have is from RMI and can be used as a standalone network card or hosted as a PCI-X (not PCI Express!) board. The JTAG connector is a standard MIPS one and according to the vendor complies to the voltage and pinouts documented for MIPS.
The vendor only documents and supports use of particular (and rather expensive) JTAG probes. Amontec's JTAGkey2 isn't one of them.
AI: Quick Answer: You can't do it.
Long Answer: Yyyyyoooouuuu ccccaaaannnn''''ttt dddddooooo iiiittttt.
But seriously, without having a schematic you won't be able to drive the JTAG interface without running some risk of damaging things. JTAG lets you essentially set "most" of the pins on a chip into some sort of GPIO pins, and then lets you read or write their state. If you don't know what they are connected to then you run the risk of setting a pin to an output while some other pin is also driving it. That would create some "bus contention" which could damage the parts. |
H: Why do displays with auto-synchronization function get out of sync? (pixels blur)
I'd like to know why LCD displays that have the "Auto" button need it in the first place. Are they losing sync with the signal because of some special feature or all LCD displays really suffer from this (because I don't remember having that on CRT monitors)?
Or maybe the video card's signal changes?
My desktop PC has its monitor connected via D-Sub port and sometimes the screen gets blurry and I have to press "auto".
On my netbook, there is no "auto" button and the screen doesn't seem to ever blur pixels (I assume there is some kind of special connection between motherboard and display that doesn't have this problem).
AI: You will only find this feature on VGA (analog) monitors. VGA-style signals do not provide a clock signal, and so the monitor has to guess what it is, by looking at other properties of the signal. DVI signals do provide a pixel clock, and therefore there's no more guessing.
The other criterion is that a monitor can be plugged into any computer you choose. The screen on your netbook is dedicated to that computer, so the manufacturer can lock in any necessary adjustments to match it up the display without concern that it would be used anywhere else. |
H: Why is PIC Programming Voltage Higher Than Vsupply
I work with PIC microcontrollers quite a bit and have never understood why Vpp (programming voltage) is higher than the max supply voltage that powers the PIC?
AI: In older (EPROM) PICs the higher voltage was used directly to power the internal EPROM programming hardware. In the newer (FLASH) PICs the FLASH programming voltage is derived internally, and the Vpp is used only to enable the programming mode. Then why use a high voltage at all? This way you can use a single pin for multiple function, so you don't loose a pin exclusively for enabling programing. Note that a lot of PICs have an alternate method of enabling progamming (called LVP), which does dedicate a pin to enabling programming mode. But this can be disabled (so the pin can be used for its normal I/O purpose) by using HVP. Other modern PICs use a 'magical sequence' that must be clocked 'into' the reset pin to enable programming. |
H: Math: Temperature tranform equation
While reading the MAX6605 datasheet, which is an analog temperature sensor, I ran across the following:
The temperature-to-voltage transfer function has an approximately linear positive slope and can be described by the equation:
VOUT = 744mV + (T ✕ 11.9mV/°C)
where T is the MAX6605’s die temperature in °C.
Therefore:
T (°C) = (VOUT - 744mV) / 11.9mV/°C
To account for the small amount of curvature in the transfer function, use the equation below to obtain a more accurate temperature reading:
VOUT = 0.744V + 0.0119V/°C ✕ T(°C) + 1.604 ✕ 10^-6 V/°C^2 ✕ (T(°C))^2
My algebra is terrible. How do I solve for T(°C) from the last equation?
AI: The equation is a quadratic in T which can be written more simply as:
1.604X10^-6T^2 + 0.0119T + (0.744 - VOUT) = 0
where T is in degrees C.
This can be solved using the known formula for quadratic equations but it does become a bit messy. You should probably plot this equation out using Excel or similar software to get a graph of T versus VOUT. Compare it to the linear version to see if the correction is worth the effort over the range of T that you expect in your application. A quick check with a TI-83 calculator shows that the correction is very small. For example, at a temperature of 20C, the linear equation says VOUT would be 0.9820 volts while the quadratic equation says VOUT would be 0.9826 volts. Both equations have VOUT = 0.744 volts at a temperature of 0C. At 50C, VOUT is 1.3350 and 1.3430, respectively. Thus unless you plan on measuring VOUT to better than 1 millivolt, the linear equation should be sufficient. |
H: A decent library of component simulation, schematic and PCB layout?
I am truly a novice in PCB design, so I am new to all aspects of it. What I am having the most trouble with is actually picking suitable components. The trouble I am having is that I am not really able to use most of the components I find from Google or elsewhere.
To use a component on a board, I want to be able to stick it in some PCB design software and be able to use it in a schematic, place it on the PCB and simulate its behavior. However, this seems to be endlessly difficult. The problems I run in to are:
I can't find the part in any component library anywhere
I can't find a simulation (SPICE/IBIS) model for the part
I find a SPICE model, but it is for some different version of SPICE and doesn't work
I find the component in a library, and a simulation model, but it is an outdated component and not recommended for new designs
Everything else is fine, but I can't find the SMD version of the component
The end result is that when going over Farnell component listings, I am forced to pick components based on what I can simulate and find in some library, instead of picking the component that is most suitable for the design. This seems like it should not be so.
Is there any way to actually have a large library of components for which all of these things exist? The best I have come across so far Eagle with component libraries for every manufacturer separately from Farnell community site. But even that is severely lacking as I don't usually find the components I want from the manufacturer in the library - and obviously there are no simulation models for these. Eagle also has the nice DesignLink feature, but that doesn't seem to help me any in this case.
As an example: I am looking for a generic opto-coupler with transistor output, 4 pin SMD package and 100% or more CTR. I'd like to be able to compare a few options and not pick the one option that might be available for both my simulation software and my PCB design software.
Commercial solutions are okay.
AI: You will never find an absolutely complete parts library from any vendor. What you need to do is learn how to use the library editor of your tool. There you create packages and symbols that you can place in your schematic and layout, based on the datasheets from the manufacturer.
As far as simulation goes, there is no complete/unified tool for this. You'll really only find SPICE models for basic parts, such as transistors and diodes, and sometimes for bus drivers (like pins in an fpga). You'll use a SPICE simulator for doing timing and frequency analysis for that kind of thing. For code, you'll use the simulator that usually comes with the development environment of the processor. For VHDL/Verilog, you'll need a simulator such as ModelSim for that. And for simulating transmission lines for signal integrity, there are also separate simulators that take in geometric and materials data, and also the bus driver models I mentioned before.
So the idea of simulating the whole design in one go is not really feasible, unless its scope is very narrow. What you end up doing is simulating each subsystem separately in its own suitable testbech environment, and then join everything in the pcb. Once a prototype has been manufactured, you can test, probe and debug the system as a whole. |
H: What is the difference between 1-phase and 3-phase motors?
I've read the wiki page on AC motors, but it's still unclear to me as to how they work. I'm looking at motors for a project and need them to be able to have their speed controlled by a light dimmer (for various speed settings). While doing this, a lot of the motors were marked as 1-phase or 3-phase.
What is the difference? Does it have anything to do with the possibility of speed variance?
AI: Polyphase AC induction motors work by creating an rotating magnetic field. Creating a rotating magnetic field requires phase-shifted sinusoidal currents. For instance, two that are shifted by ninety degrees (called a quadrature), or three phase.
Single phase motors either use a nonrotating magnetic field (one that pulsates), or else they generate two-phase power internally with the help of a capacitor. Some designs just use capacitors for starting, or a large capacitance for starting, and a smaller one for running. You can see these capacitors: they are the one or two "cans" attached to the sides of a motor.
This page on All About Circuits has notes about single-phase motors: http://www.allaboutcircuits.com/vol_2/chpt_13/9.html
This page introduces AC induction motors:
http://www.allaboutcircuits.com/vol_2/chpt_13/7.html
This is the top page for motor topics: http://www.allaboutcircuits.com/vol_2/chpt_13/1.html
Regarding speed, induction motors develop power through lag between the rotating armature and the rotating magnetic field set up by the stator coils. If the armature rotates at the same speed as the magnetic field, that is called "synchronous speed". A deviation from that speed is called "slip". A motor runs at close to synchronous speed when it is unloaded and does not perform work. When a load is put on it, its speed slips and that causes it to deliver power. The power rises with increasing slip up to a point, and then it drops off. If you block a vacuum cleaner hose, you can hear the motor speed up. The reason for that is that the motor is actually working less hard (not moving air), and so it increases toward synchronous speed.
Controlling the speed of this type of motor is a tricky business because the synchronous speed is related to the frequency of the power line.
http://en.wikipedia.org/wiki/Induction_motor#Speed_control
A triac-based light dimmer doesn't change the frequency. You may have some success regulating speed with a dimmer but it's not going to be very accurate. Basically it will choke off current to the motor, which will cause it to slip more under the same load. |
H: time delay circuit keeping line high
I'd like to create a simple circuit for keeping a line "high" for a few seconds after being triggered high, without any external power.
To specify it in more detail: given three inputs, 3.3V, GND and a processor output line that can be driven high, create a circuit that drives an output line high for 5 seconds after being triggered by the processor output line, even when the 3.3V line goes dead. The timing doesn't need to be exact.
Theoretically, I guess this would be easy by just hooking up a capacitor and a thyristor together. However, suitable thyristors do not seem to be easy to find, and fitting together all the component values seems tricky.
This is also similar to all the power-on / power-off delay circuits, but a little different.
So, I am looking for better ways to do this.
AI: Your solution will need to be based upon a capacitor that stores energy to be used by the output circuit to hold up high level pulse. When the trigger pulse arrives it clocks a state to the circuit that is powered from the capacitor power. This could be a flipflop for example. The captured state enables the five second time delay which when it expires will feedback and clear the capture latch. The timing of 5 seconds could be implemented via an R/C circuit, a timer IC or a small pin count microcontroller.
Here is a sample circuit that would do the job using the CMOS version of the 555 chip. (Do not use the old standard NE555 type part. It is not suitable to this application). In this circuit the hold up capacitor is the 220uF part at C1.
The size of the hold up capacitor may have to increase if there is a load placed on the output pin with the 5 second high pulse.
The following picture shows the waveform behavior that you can expect from this circuit. Note that the sloping down high level of the output pulse is caused by the sag of the voltage on C1. The primary load on the CAP is the bias current of the LMC555 timer chip. The two voltage sources driving the simulation circuit are emulating the high level trigger signal from the MCU pin and the resulting shutdown of the 3.3V supply followed by the loss of the MCU output signal. |
H: How to make any sensor a wireless one
I am try to build a wireless sensor(right now I am using an adxl335 accelerometer with an analog output) but this project should be general for any sensor that outputs analog. The issue is that I have to first convert the analog to digital to transmit it over RF(I have a 12d,12e RF series which is a four channel Rf transmitter with reciever). But the issue is if I need to convert the analog to digital then I need a microcontroller for the CS as well as clock lines. This just adds enormously to the cost of the project as well as the number of hours I would spend assembling them together and a microcontroller for each sensor does not seem sensible at all. I am wondering what is the general route taken to make an accelerometer or any other sensor that outputs anolog wireless.
AI: It is very common to take an analog signal, pass it through and ADC, into a microcontoller, and out a digital radio. There are many wireless microcontrollers with integrated radios and ADCs for just this task. One example is the mc13224v that's on an Econotag.
The other option would be to transmit the analog signal directly with AM or FM. |
H: Properly controlling a 6V servo motor from a microcontroller?
Regular old 5V hobby servos can usually be safely connected directly to a microcontroller without any issues. When it comes to 6V servos (that also might be drawing sizable current), there doesn't seem to be as much information.
I've read that you can simply provide 6V to the + and - pins on the servo from a separate source and then provide the regular 5V control signal, but I doubt that this is the ideal solution.
What's the right way to control a (potentially high current-draw) 6V servo from a 5V microcontroller? Should the 6V supply just come from a voltage regulator and a couple of caps or is it important to have a more sophisticated voltage source?
Thanks!
AI: So in general when you have a noisy actuator and a sensitive you run them on separate supplies and try and keep the two electrically isolated. I use a circuit like this when I try and opto-isolate a transmitter and a receiver:
This will give you a non-inverted output of the input waveform, and will actually work with any voltage on the input and output side so long as you can still turn on the LED (i.e. the input voltage is high enough) and you are within the operating voltage of the output transistor.
Isolating the two supplies is actually good in a lot of ways. It means you don't have to worry about surges in current on the actuator supply causing issues on the microcontroller (fewer decoupling caps, etc), and it also means that if the actuator battery dies, the actuator won't try and run off the input signal from the microcontroller.
Hope that helps! |
H: How does an LED matrix work?
I've wired up a 3x3 matrix as in the attached image. My understanding is that if I apply 3.3 volts to row C and connect column 1 to ground, the electricity should flow through the bottom-left LED (as in the top-right of the image), turning it on. What seems to be happening, though, is that the electricity bypasses the LED and flows directly to the ground, meaning no LEDs light up (as in the bottom part of the image). This makes sense to me since electricity usually follows the path of least resistance. But everything I am reading online seems to indicate that what I am trying should light up the LED. What am I missing here?
I should also note that I have a 100 ohm resistor at the beginning of each row.
AI: In your actual circuit, have you connected the wires and the LED leads at the junctions indicated by the black circles, or have you connected them wherever the lines overlap in your schematic diagram?
The correct reading of the schematic is to only have connections where indicated by the junction indicators (black filled circles). If you do so, then the third scenario in your diagram does not exist - the wires going horizontally and vertically do not actually touch at all.
One way to visualize this: The horizontal wires are all on the plane of your work table, the vertical wires are all in a plane floating an inch above the table, and the LEDs are the only connections between these two sets, and the only connections are the black circles.
You are correct, electricity will follow a path of least resistance to the greatest extent. In the schematic, there is no path of least resistance, i.e. short-circuit, between row and column wires, since no junctions are indicated. If you have interconnected the row and column wires, disconnect them now. Then, as you will see, the only path that allows electricity flow is through the respective diode / LED. |
H: Transmitting a video stream through a microcontroller
I'm working a a project that currently works well but this year we want to expand it by collecting data from it, independent of its current functions. We have set up an iPad App to control an Arduino through Bluetooth. The next step is transmitting video through Bluetooth to the iPad.
With this question I would like to focus on how a microcontroller can send a video stream through Bluetooth. I can't seem to find any way to even start this project.
How do you interface the camera with the microcontroller?
How do you then send that stream over Bluetooth?
AI: Unfortunately in my experience what you'll quickly find is that video is obnoxiously difficult to manipulate without a lot of cpu power. Let's start from the beginning: how much video do you want?
There are a lot of choices here, but start small. Let's say that, for simplicities sake, you wanted a 640x480 frame of 8-bit black and white video, at 24 frames per second.
That's 640*480 pixels = 307,200 * 8 bits per pixel = 307,200 kilobytes per frame * 24 frames per second = 7,372,800 bytes per second or ~7.37 megabytes per second
So that is a baseline for data throughput for a camera outputting raw frames, and that's not including sound or color. Now you have a few paths you can take: you can start encoding the video stream, or you can get a lot of bandwidth. I don't know the throughput of bluetooth, so I can't help you there.
Encoding unfortunately takes one of three things: a lot of processing power, or specialized hardware, or (possibly) FPGA knowledge that I also don't have. Encoding will reduce bandwidth concerns, but at a pretty hefty cost. You would need to research compression and whatnot to figure out whether you could even get this over your interface and still have the arduino do useful work.
If you want to connect a camera to a microcontroller you'll find that even simply taking stills can be a pain based on how the still frames are delivered. There was a sparkfun camera which gave jpeg frames but didn't have a fixed period for how long the encoding took, and then would suddenly start spitting out the encoded frame as fast as it could, and since the frames were too big to fit in RAM on the microcontroller it had to spend all it's time getting the frame and spitting it out over whatever interface they were using to transmit.
tl;dr: you should establish what you need and probably try and and figure out whether using the microcontroller as the go-between is the best choice.
Good luck! I hope that helps. |
H: PIC18F2550 I2C Open Drain?
As far as I have read, the I2C pins are Open Drain or Open collector, but in the PIC18F2550 the datasheet doesnt say anything about those pins, and even says they are a digital output if you select them to be one.
Do I need to add a pullup resistor to the pins so to use them as a digitial output?
If I dont, how do they work in the I2C?
Thanks!
AI: You can do open drain on any digital pin on the PIC yourself, it's easy! I'll show through a quick chunk of example code using RB0.
_TRISB0 = 1; // Set the pin to high impedance
_LATB0 = 0; // Set the output low (this would be _PORTB0 on some pics)
// As long as you're using pin RB0 as a open-drain, don't touch _LATB0
// To output a "low" (drain) do this:
_TRISB0 = 0; // Set the pin to output, it's already low, so it will "drain"
// To output a "high" (open) do this:
_TRISB0 = 1; // Set the pin to high impedance, the pullup resistor will pull high
The I2C module will do something similar to this internally, without you doing anything. In other words: yes! You'll need a pullup resistor!
EDIT: To answer your second question which I did not directly address, the pin does not need a pullup resistor during normal digital output operation. My example was to show you how a normal, fully functioning digital I/O pin could operate as a open-drain without any additional behavior or behaving unexpectedly. I should also note that I have done this exactly what I showed here to do open-drain in real programs, so this isn't a toy example, it's really how you do it! |
H: Using Matlab to draw a step response graph
I've got the next transfer function:
$$ \frac{\hat{\alpha}}{\hat{\alpha_{ref}}} =\frac{w_n^2}{s^2+2w_n \xi s+ w_n^2} $$
Now I want to draw a step response input at height of \$\alpha_{ref}\$, where \$\xi\$ comes with differing values (i.e different graphs on the same axis for different values of \$\xi\$, and the value of \$w_n\$ depends on \$\xi\$).
How to implement this in Matlab?
Thanks in advance.
AI: A not-at-all elegant way to do it is:
zeta=[...]; %your zeta values
wn = ... % calculate your wn values according to your zeta values
figure;
hold('on');
for idx = 1:length(zeta)
% sys = tf([wn(idx)],[1 2*wn(idx)*zeta(idx) wn(idx)^2]); %system's transfer function
% EDIT : numerator corrected
sys = tf([wn(idx)^2],[1 2*wn(idx)*zeta(idx) wn(idx)^2]); %system's transfer function
step(alpharef*sys);
end |
H: Meaning of an arrow in the control scheme
I cannot understand what the arrow that goes through "internal model" block mean? how can I interpret what does it do? What is the difference from any other "normal" arrow?
(source: cam.ac.uk)
AI: A convention is that the normal arrows indicate data flow, and the 'through the box' arrow indicates changing the properties of the box. (A bit like the wiper arrow in a variable resistor or capacitor, or a thermistor (NTC).)
This can of course be seen as just another type of data input, but it is often used to indicate an input that has more 'fundamental' effect, like on-the-fly changing ofPID paramaters, or updating a neural network. |
H: Is it possible to solder the back pins of an Arduino board?
To ensure a more stable connection to the arduino board, would it be possible to directly solder the wires to the pins below the board? Is there any risk of interference between the pins?
It may be an obvious question, but I wouldn't like to ruin an Arduino board :)
AI: Yes, it's a standard through-hole header. You'll want to melt the existing solder to insert your wire. As long as you don't short two pins together it won't cause any problems.
That being said, I can't think of a situation where this should be necessary. Given that you're thinking about this in the first place, I'm going to hazard a guess that you're using a spool of wire and sticking the stripped end into the header. What you really want is some jumper wires with a connector that will fit snugly into the existing header. |
H: Regulator and charging in a portable device
There are quite a few similar posts on this subject but I'm a little confused about the best way to proceed in my specific project. All my previous regulators have been linear types (eg: 7805, LM317 at best) - nice and simple. For me anyway.
The project I'm working on needs 3 voltage outputs from a Lithium (lipo or li-ion) battery - 3.3V, 5V, 12V.
3.3V @ 500mA (estimated) main rail for the ARM based system on module. ARM can be at full power, standby, or off. This requirement doesn't look too onerous. Stackexchange has some good posts in this area.
12V @ 250mA for sensor system A. Switchable from the ARM (or a PIC or some such).
5V @ 2.5A for sensor system B. Switchable from the ARM.
Plus the battery needs to be recharged. I can use one or two cells although it might not be up to me. Two cells might be easier given that I can boost to 12V and derive 3.3V and 5V from the 8.4V line.
I'm not sure about the best way to proceed as there's a blizzard of chips out there. I was hoping someone has used a nicely behaved one that combined charging and regulated outputs. For example, Microchips MCP7383 can charge LiIon fine and a chip like the TPS63020 is a buck/boost regulator to give you 3.3V but other chips combine the charger and the regulator which seems a better idea.
If I use a single cell LiIon I get 3.4/3.5V to 4.2V. Is that too tight for 3.3V, especially given the power draw when I turn on the 5V boot circuit. Should I first boost to 5V and use that to get 3.3V? And then use another boost to 12V?
AI: The 3.4/3.5 Volt Li-Ion cell voltage is not necessarily too tight for sourcing 3.3 Volts, as some Low Drop-Out regulators do mention drop-out voltages of the order of 100 mV at small currents. It would be marginal / iffy, though.
If I were doing this, I would boost to 5 Volts, run an LDO or a buck regulator off that 5 Volt rail to get 3.3 Volts, and separately boost directly from the battery for the 12 Volt rail. That way, the 12 volt boost regulator, which seems to be serving your most current-hungry rail, would not suffer 2 stages of efficiency loss, nor would the 5 Volt boost regulator need to be hefty enough to provide the high current needed by the boost regulator for the 12 Volt rail.
Also, although there are integrated boost / regulate devices that may serve your purpose, as a parametric search on Digikey indicates, there is advantage in keeping the blocks separate: That way, the heat dissipation volumes of each of the 3 parts, 2 boosts and 1 buck / LDO, could be physically separate and thus more of a distributed problem than a thermal hot-spot. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.