text
stringlengths 83
79.5k
|
---|
H: What should I do with the unused Op-amp inputs?
I am building a simple inverting operational amplifier circuit where I am using a chip with dual amplifier. I am only using one of the two amplifiers. What should I do to the unused amplifier's input pins? Should I leave them floating or is there a good way to sort of terminate them.
AI: It depends a bit on the op-amp. If it's a bipolar op-amp with high input bias current in a non-precision circuit (referring to the other op-amp) it may be safe to leave the inputs open. Think LM324 in some non-critical circuit.
One common practice is to connect the op-amp as a voltage follower and tie the non-inverting input to some voltage within the input and output common-mode ranges. Since the unused op-amp is operating normally, all the datasheet guarantees apply, so this could be considered a best practice approach.
You can also tie the inputs to potentials such that the output (left open) is railed high or low (there may be some small power consumption advantage).
I don't suggest connecting the inputs to the same potential since the output of some units might drift around and slightly affect the other op-amp. Similarly, leaving inputs open on an amplifier with low input bias current (those with bias current cancellation or JFET/CMOS input op-amps) can cause pickup that will show up in power consumption and can show up as crosstalk in the amplifier that is being used.
Edit: As the actual amplifier OPA2614 appears to be a non-unity-gain stable very high frequency type, it would likely be best to either make a gain-of-five amplifier or apply a small DC voltage of a few hundred mV on the inputs and leave the output railed. |
H: Mosfet to save power
I am making a battery powered project which involves bi-directional motor control. However motor needs to turn rarely (about 10-20 seconds in 24 hour period). I am using L298 motor driver. However the quiescent current is in mA range. To reduce current consumption, I am planning to use a mosfet switch as shown in the figure below:
VM = 9 V
VCC = 4.5 V or 6 V (I will decide after a little experiment)
Motor current consumption < 1 A
Whenever I need to use the motor, I will turn the mosfet ON and keep it OFF while the motor is not in use. (I am using logic level mosfet.) The quiescent current of mosfet is in uA range and that's how I am planning to save a lot of battery power.
Will it work?
Any suggestions/improvements are welcome.
AI: I suggest using high-side switches rather than a low-side switch.
Edit: One high side switch for each power supply.
Something like this: (Edit: x2)
It needs a base resistor for the BJT or use a logic-level MOSFET. R1 could be something like 10K and the base resistor 20K or so. The p-channel MOSFET should be logic level for your conditions. You can find dual p/n channel units in an SO8 that can handle some amperes.
The problem with switching the ground connection (low side switch) is that there are two power supplies on the chip and the inputs will end up biased at some voltage above ground, which may draw unnecessary current and/or be bad for your micro.
You still have to bring the outputs of your micro low or you will drive unnecessary current into the L298 inputs. |
H: Control of a coreless DC motor using a PWM and a mosfet
I'm using 4 Si2302 logic level mosfets to drive 4 coreless dc motors. The speed of the motors is control led by the PWM signal from an Arduino Pro Mini. The power supply for the boards is a 3.7V (4.2V when fully-charged) 500mAh 50C Lipo.
The circuit is setup in the following way:
Source to ground
Gate to PWM pin with a 10KΩ resistor to ground.
Drain to motor terminal 1
Motor terminal 2 to Vcc
Diode placed across the motor terminals
simulate this circuit – Schematic created using CircuitLab
The motor gets its RPM value via a joystick which is connected to an Analog Input on the Arduiuno. This is then converted to a 0-255 value and outputted at the PWM output.
I'm facing the following problems with the circuit:
As soon as I supply power to the circuit the Motors run at full RPM till the Arduino starts taking data from the joystick. It then settles down to the RPM corresponding to the joystick position. Is there any way to counter this so that the motors remain switched off until the Arduino starts receiving values from the joystick ? (My understanding was that the 10KΩ Rgs resistor would take care of this.)
The second problem is that the mosfet never fully switches off. This happens even when the joystick is at the 0 position. I have also tried switching the pins HIGH and LOW, however there is still movement in the motor. Is there any remedy to this problem?
When I measure the resistance between Gate and Source, the mosfet shows around 6K ohms. Shouldn't this be around 10KΩ since the Rgs resistor is 10KΩ ? Is this a sign that the mosfet is damaged ?
AI: Reduce the 10K resistor to 3.3K or even 1K.
The Si2302 device that you are using has threshold voltage around 0.65V, this is much lower than many MOSFETS which more typically have a a threshold of 2v - 4.5V.
All effects you are seeing are probably because of the pullup resistor in the Arduino (assuming it uses an AVR processor). This can be anywhere between 20K and 100K and will be putting enough current out of the processor to create a bias voltage that turns on the MOSFET slightly.
When you measured the gate resistance, was it still connected to the Arduino?
The pull-up can be disabled programmatically, but of course not until the software is running.
kevin |
H: NFC - FPGA - TFT Question
Im working on an idea but am having a problem finding even a starting point for research.
The idea is to have images (video) sent over NFC to a NFC connected to FPGA (or something else could do?) and display those images to, let's say PSP TFT.
Any general ideas from where to start researching this ? Im not expecting a complete solution just a nudge in the right direction. Could this be done, what is the minimal (cheapest) board that could do this ? Ive seen PSP screens driven with fpga but they are all $40+ units. Any cheaper options ? Does it even need to be FPGA?
Thank you
AI: Using an FPGA for this task seems to be overkill. Yes, you can connect a display to an FPGA, but you can do that with lots of microprocessors as well. Development in software is also much faster.
So unless you want to design in the FPGA for the learning experience or you already have an FPGA with some free space in your design I would go with some cheap Cortex-M3 CPU board.
Regarding NFC, yes, sure. You can use NFC to transmit images. But keep in mind that you will have a data-rate of about 2 kilobytes/second under ideal conditions. So transmitting images takes quite a while. You can cheat a little and just use NFC just to detect the transmit event and do bluetooth or wifi paring for the real data. That's what Samsung did for their S-Beam feature on several Android phones.
Regarding NFC chips: Most of them are rather complex beasts when it comes to program them. Also the data-sheets are rarely publicly available.
The PN532 from NXP is a bit aged but you can actually buy the chip and get data-sheets for it. There is also plenty of example source-code out there, so you don't have to start from scratch. If you don't have prior experiences with NFC, that would be my recommendation. |
H: Concerns in H-bridge switching times with common (one) gate control line
I have a FET based H-bridge being controlled by a micro. I was worried about software errors being able to turn on the top and bottom FETs at the same time, so I opted for the control scheme below for each half of the bridge. While this works fine, difference in the switching times of the two FETs means a partial short occurs - I see the voltage on Vcc is pulled down (even though it has quite a lot of capacitance) during switching. The duration of the 'short' is very brief (looks like <10us on my scope).
Is this inevitable with this control scheme, or can I get some improvement? I tried making R1 and R2 bigger in simulation and then strapping diodes across them (pretty sure I had seen this done before somewhere), so that the FETs turn off faster than they turn on. This seems susceptible to variations in threshold voltage, temperature changes etc. Is there any better solution?
I'm aware that there are ICs dedicated to this function, but I'd like to try and keep this simple. If the only way to do it is with more transistors, then so be it, but I wanted to make sure there isn't some simple solution involving R/Cs, diodes etc that I haven't thought of.
AI: You could improve the circuit by reducing the switching time and then adding the diodes.
Add a NPN/PNP emitter follower stage before the MOSFETs (just two cheap transistors) then do the resistor/diode to the gate thing.
Resistors R2/R3 will probably be in the hundreds of ohms to get the shoot-through to a negligible value.
simulate this circuit – Schematic created using CircuitLab |
H: LC circuit with AC-supply - current through the coil
A parallel LC-circuit is connected to an AC-supply as in the figure below.
\$I_{tot}(t)=I_0sin(\omega t+\phi)\$, \$\phi\$ is the phase angle between \$V_{tot}(t)\$ and \$I_{tot}(t)\$
a) Determine \$\phi\$.
b) What current \$I_L(t)\$(Amplitude and phase) runs through the coil L?
Use the following information: \$R=10 \Omega, ~C=30\mu F,~L=10^{-3}H,~I_0=2A,~\omega =300\frac{1}{s}\$
I was never good with LC-circuits, which is why I picked out this one out of my textbook.
How do I approach this type of exercise?
I was thinking that since it's an LC-circuit then because of Lenz's law the phase is \$\phi =90°\$? Is that also the case here? And the resistor \$R\$ kind of bugs me in the circuit. Does it have any influence on the current or the phase?
How do I get the amplitude and phase in b)? Although I still think that the phase should be \$90°\$. But what about the amplitude?
I guess part of the current would flow through R, right? Meaning the 'amplitude' of the current in L is a little less. But how would I get the value of \$I_R\$? I don't have a value for the voltage V.
Sorry for my lack of work here. My knowledge on curcuits in general is really slim.
AI: $$\begin{align}
Z_R&=10 \;\Omega\\
Z_L&=j\omega L=j \cdot300\times10^{-3}=0.03j\\
Z_C&=\frac{1}{j\omega c}=-0.009j\\
\hline\\
Z_{tot}&=Z_R||Z_L||Z_C=\left({1\over10}+{1\over0.03j}-{1\over0.009j}\right)^{-1}\approx 8.7378 \angle 89.95^{\circ}\;\Omega \longrightarrow \phi=89.95^{\circ}\\
\hline\\
&\text{Using current divider theorem*, } I_L=\frac{Z_{{R||}{C}}}{Z_L||Z_{R||C}}\times I_{tot}=\\
&=\frac{{\left({1\over10}-{1\over0.009j}\right)}^{-1}}{{\left({1\over10}-{1\over0.009j}\right)}^{-1}+0.03j}\times 2\angle\phi=(2\times0.428571..)\angle(\phi-179.926..)\approx 0.857\angle {-89.98}^{\circ} \text{A} \equiv 0.857\angle{-1.57}\;\text{A}\\
&\\
&\text{Hence, } I_L(t)=0.857\sin(\omega t-1.57) \;\text{A} \Longrightarrow \text{Amplitude}=0.857 \;; \text{Phase}=-1.57\; \text{radians}
\end{align}$$
*:current divider theorem |
H: can't read&store in global variable in function OR can, but get error reading ds18b20 sensor
I'm using Atmega8 with CVAVR 2.05.0 and trying to slightly modify the way ds18b20 library works. I want to store temperatures from sensors in global array and start conversion for all sensors at one time - so i can avoid useless delays and do something usefull.
For now in "Project Configure - C Compiler -Code Generation - (s)printf Features" are set to "float,width,precision".
I found a problem (tested it in Proteus 7.7 SP2 and on real atmega8) - if i call tempature reading in function inside printf like this:
printf("t%i read=%.4f \n\r", i, ds18b20_read_temperature(&rom_code_ds18b20[i][0]));
it works fine, except it can't read global variable inside function. But if before that print i put any assigment to global float array like this:
temperatures[i] = i + 0.275;
printf("t%i read=%.4f \n\r", i, ds18b20_read_temperature(&rom_code_ds18b20[i][0]));
i start getting errors (-9999) for every read for 2nd and 3rd sensor, no matter what is in asigment - if it is assigment to global varible. But it starts reading from global array right values.
Firs I tried to read global float array in main - it works fine. Then i tried to do same temperature reading in main - again, inside printf it works fine, but if i try assign result of reading to local variable t1 and then printf those t1 - i get zero.
Here is example for "good" output (no assign before prints, but no global variable read in function):
Here is example for "bad" output (put assign before prints, global variable starts reading normally, but 2&3 sensors are lost (see those -9999?) ):
Where is the problem?
Or there is something i should know about defining or using arrays and/or in functions?
About global variable i found only about problems inside interrupts, there was recomended to use volatile. Tried volatile - no effect. Also tried pointers (i'm not familiar with them, but with help of friend...) - the same thing - no reading global in function and "loosing sensor readings".
Also after compiling project i get warnings:
Warning: C:...\my_reading_ds18b20\my_reading_ds18b20.c(261): array index is out of range
Warning: C:...\my_reading_ds18b20\my_reading_ds18b20.c(263): array index is out of range
Warning: C:...\my_reading_ds18b20\my_reading_ds18b20.c(265): array index is out of range
I checked that variable number_of_sensors=3 (with printf), so i don't understand why i get this warning. Maybe because this varible is set with preprocessor?
Here is my .c file: watch for lines 80, 251, 252
https://app.box.com/s/8e3no26kfetoutiaqt6vn1rvsxq7wo2n
(with comments and "debug" printf. if anything isn't clear - ask me)
And here (if needed) .prj file:
https://app.box.com/s/52oo40bvo0fx02dshmjaw0nsv1mlywco
I draw your attention that it is NOT about reading dsb18b20 - those function is from library and works well, but about problems got from global float variable. I really need to store those values for later use!
UPDATE1: Seems the problem in everything except t1..t4 was in setting variable number of sensors, because if change initializng array float temperatures[number_of_sensors] to float temperatures[4] all previous problems are gone. So it seems i can't get number of sensors defined by way i used. Is there any other way except automatically change number of sensors depending on used options?
AI: From those warning messages, it appears there is a problem with the first index of the rom_code_ds18b20[i][0] array - looks like "number_of_sensors" is not getting set correctly. |
H: A simple FIFO buffer in verilog
I have decided to implement a FIFO buffer in verilog (for fun). Here is my primary prototype you can say :
It will consist of a register bank or memory.
Each register will be of size N and there will be M such registers / shift registers.
The registers support serial write and serial read only ie serial-in serial-out topology.
Two registers 'read' and 'write' will be used which act as enable signals.
A register 'writeLoc' is used which tells where data was last written to. Its size should be M. It is decremented with each write.
A register 'readLoc' is used which tells where data was last read from. Its size should be M. It is incremented with each read.
If readloc = writeloc,
if last operation was read, then buffer is empty.
if last operation was write, then buffer is full.
A register 'lastOp' is used to signify last operation. It is set whenever last write was sucessful. It is reset whenever last read was sucessful.
A register 'isEmpty' is used to signify that buffer is empty. It is set whenever buffer is empty.
A register 'isFull' is used to signify that buffer is full. It is set whenever buffer is full.
Experimental feature 1 : A register 'lock' can be used to prevent reading data while writing and vice versa. 'lock' is set whenever 'write' is set ie whenever data is being written. 'lock' is reset whenever no data is being written. The reader can read from buffer when 'lock' is reset. Likewise, the writer can write to buffer whenever lock is set.
However I have a few concerns :
1) Firstly, have I left out some critical component ? And is there some flaw so far ? Keep in mind it is meant to be a simple design, with 'essential' functionality.
2) My first concern is whether buffer full and empty conditions are correct or not. I have tried my best, but I'm not sure.
3) Can isEmpty and isFull registers be dispensed with ?
4) At the receiver end, the data can come any time. I feel that if I implement the lock feature, then if at the time when data is coming and lock is held by reader, data will be lost. On the other hand, lock is also necessary to prevent reading while writing and vice versa. Can you point me in the right direction as to how to overcome this problem ?
(Apologies if this question does not belong here. Please be kind enough to suggest appropriate place).
AI: Your read pointer and write pointer both need to travel in the same direction. Generally they are incremented, but decrementing also works, so long as you do the same for both. One method for full/empty detection is to use M+1 bit registers for the read and write pointer. If all M+1 bits match, then the FIFO is empty. However, if all bits match except the MSB, then the FIFO is full. Presuming you use a true dual port memory for storage (i.e. an FPGA block RAM), no locking is necessary as dual port RAM supports simultaneous reading and writing. No need for any isEmpty and isFull registers or a lastOp register if you can glean all of that information from the read and write pointers with simple combinatorial logic. However, you will need logic to prevent the write pointer from being changed when the FIFO is full or the read pointer from being changed when the FIFO is empty. |
H: Autodesk Autocad for PCB design
I recently completed an Advanced Diploma level course subject for PCB design that taught Autocad as the design software.
Whilst I am aware of the power of Autocad my subsequent surveying of engineering firms has shown that none of them used Autocad and the majority 60% used Altium.
So my question is:
Is anyone one involved in PCB engineering/design or repair in a professional capacity use Autocad?
Thankyou.
AI: PCB engineering/design: No.
I'm speaking from my industry experience consisting of:
Design engineering since 2002
Attending PCB West conference for the last 5 years. AutoCAD didn't present there, even though their office is fairly close to the location of the conference. |
H: Low Voltage AC Smoothing Capacitor Calculation
I have a 9V AC source which will have a max load of 100mA. I'm trying to figure the value of a smoothing capacitor with less than a 10% ripple. I don't have a scope or else I'd just try a bunch out.
I'm just a hobbyist, but I'm trying to understand this. Since I'm not sure if I'm doing this right, I'll just step through what I've done so far.
First I found this formula:
$$V_{ripple}={V_p \over R_LC} \times \Delta T$$
I'm using 60Hz 9VAC that is full wave rectified and I want a 10% ripple so:
$$(9V \times .1)={9V \over R_LC} \times {1 \over 60Hz}$$
I'm calculating my resistive load with Ohm's law.
$$R = {9V \over .1A} \quad R = 90 \Omega$$
So plugging that in I get:
$$.9V={9V \over 90\Omega \; C} \times {1 \over 60Hz}$$
If I solve for C (admittedly using wolfram alpha), I get:
$$C={1\over 540}F \quad C=1851 \mu f$$
1850µf seems pretty high to me... And if I lower the ripple percent it get crazy high.
Is this the right way to find this? Or did I screw up somewhere?
Also, my circuit has the capacitor between the full bridge rectifier's positive and negative outputs. I've only seen this type of smoothing circuit, but maybe my circuit needs to change?
AI: Your calculations are good but if you are using a full bridge rectifier (diode bridge, I think?), your frequency is the double of the input, so here 120Hz.
Moreover, there is the voltage drop of the diodes, so with a full bridge it's roughly 1.2V. Hence Vp = 9-1.2 = 7.8V.
Notice that a ripple of 10% is very good. Usually we add a regulator after the capacitor to have a better constant voltage supply. |
H: Are drivers and libraries the same?
Can driver for some device (for example LCD display), also be called library (a set of functions for work with)? If not what is the difference, and what term is used for what?
AI: The term "library" is generally used for something that is written once, and used (or at least written as if it is to be used) more than once, often by someone that is not its original author.
The term "device driver" is genrally used for a piece of software that handles the specifics of one device (a piece of hardware).
In most cases a device driver will be a library, but you could write a device driver specifically for one project.
A library can do other things than handling a device, for instance a data compression library. |
H: Why do I have crosstalk in Arduino ADC, despite low source impedance?
I. THE CIRCUIT:
Below, an Arduino Due measures voltage signals from two parallel voltage-divider circuits:
We want the Due to accurately measure the voltages at the places where it makes contact with the voltage-dividers. However, we see significant crosstalk - changing the resistance in one channel changes the voltage in the other channel:
$$\textbf{TEST I} ~~(R1 = R2 = 10 MΩ):$$
$$\textbf{TEST II} ~~(R2 = 3.3 MΩ < R2 = 10 MΩ):$$
However, we can theoretically trace these effects to current leaking through the Due: the Due usually has an input impedance of around 10 kΩ, but we have under clocked it from 20 MHz to 1 MHz, which raises its input impedance to 266 kΩ. So the electrons in the voltage divider circuit will certainly prefer to enter the Arduino, rather than traverse the 1 MΩ placed in front of them.
II. THE FOLLOW-UP:
Below, we have made a tiny modification to our original circuit, in hopes of making the voltage channels truly independent: both signals are buffered by one ADA 4528-2 (a dual-channel op amp):
The op amp is not there to amplify the signal: it provides a gain of ~1.003. Instead, it is there to hide the high impedance of the circuit that we're trying to measure. Instead of an output impedance of 1 MΩ, the impedance is now <0.1 Ω:
so the electrons should stay in the circuit, and there should be no crosstalk at all. However, to my surprise, although there is some improvement, there is still noticeable crosstalk!:
$$\textbf{TEST I} ~~(R1 = R2 = 10 MΩ):$$
$$\textbf{TEST II} ~~(R2 = 3.3 MΩ < R2 = 10 MΩ):$$
The red channel should not "know" that the blue channel has increased resistance. However, its signal drops, when I have not made any changes to the red channel - What am I missing from my analysis (By the way, I'm using low-tolerance resistors <1%)?
AI: More than likely it is a problem to do with the analogue channels being multiplexed inside the arduino - try sampling with a greater time-gap between red and blue signals and this should hopefully solve/indicate the issue. |
H: Low current more susceptible to noise?
Supose I have an opamp with pnp input stage (constant current flowing out the input pin), like the following:
simulate this circuit – Schematic created using CircuitLab
Would the input from OA2 be susceptible to noise since the current flowing through it is low?
Could I 'fix' this problem by inserting a pulldown very close to OA2 and let OA1 source this current?
AI: The impedance that the input "sees" determines the amount of noise that will be present. The only possibly noise sources on that net are the output of OA1, the specified input noise of OA2 and anything getting onto the net via the transmission line.
Assuming that OA1's output is quiet and there is no external noise, the only noise is the internal noise generated by the op-amp's input but this only becomes a problem when the source impedance it sees is significantly high i.e. tens of kohms and above. This is not the case here because OA1 has a very low source impedance of a few ohms or tens of ohms at audio frequencies rising to hundreds of ohms as frequencies get higher.
This op-amp source impedance continues to rise but the transmission line saves the day because it will have capacitance to ground.
All of this has NOTHING to do with input bias currents. |
H: RC-circuit - DE
Yesterday I was browsing through some questions in preparation for my exam and I found this one:
Consider the circuit below consisting out of a capacitor C and two identical resistors R. For \$t<0\$ the switch is open and the capacitor is uncharged. At \$t=0\$ switch is shut and the circuit is connected to the voltage source with constant voltage U.
a) What's the total current in the circuit immediately after the switch is shut? What's the charge of the capacitor and the total current after a very long time?
b) Determine for \$t>0\$ the total current in the circuit and the charge of the capacitor as a function of time by setting up a suitable differential equation and solving it.
I didn't have an answer to that so I couldn't answer it and I don't have enough reputation yet to comment. There was answer but it wasn't explicit on b).
I had very similar problem in past exercises and I could never set up a differential equation and solve it. Could someone help me out here?
Edit: \$V_R=\frac{R}{2}\cdot I\$ and \$V_C=\frac{1}{C}\int Idt\$
With Kirchhoff's law it should be
\$\frac{R\cdot I}{2}+\frac{1}{C}\int Idt=\frac{U}{2}\$?
So differentiating with respect to t should be:
\$\frac{R}{2}\frac{dI}{dt}+\frac{I}{C}=0\$.
So that would give us \$I=\frac{2U}{R}e^{-\frac{2t}{RC}}\$, right?
But how do I get an expression for the charge on the capacitor?
AI: For t≥0 you can replace the voltage source with the two Rs (forming a voltage divider) by its Thevenin equivalent.
This simplifies your circuit (for t≥0) to:
EDIT:
Note: In the simplified but equivalent circuit the resistor's value is R/2 and the voltage of the voltage source is U/2.
You should be able to formulate the differential equation for this circuit. |
H: Why doesn't LTSpice predict this op-amp oscillation?
I'm developing a circuit to act as an electronic load for bench testing power supplies. An earlier question about how to test this circuit received several very useful answers and can be found here: How to test op amp stability?. This question is about how to interpret my simulation and test results.
This is the circuit schematic as simulated and tested on the breadboard:
The plot produced by LTSpice indicates the circuit is quite stable. There is a 1mV overshoot on the 5V rise that resolves in one cycle. It can barely be seen without zooming in quite a bit.
This is a shot of the same test using the scope on the breadboarded circuit. The voltage rise is much smaller and the period is longer, but the test is the same; feeding a square wave into the non-inverting (+) input of the op-amp.
As you can see there is significant overshoot, perhaps 20%, then an exponential decay to a steady oscillation for the duration of the high signal, and there is some minor-ish overshoot on the fall. The height of the low signal is just the noise floor (about 8mv). This is the same as when the circuit is turned off.
This is what the breadboard build looks like:
The MOSFET is at the top on a heatsink, connected by the yellow, red, and black wires; gate, drain, and source, respectively. The red and black wires leading to the small proto-board are IN+ and IN- respectively, connected to the breadboard banana jacks to avoid power-level current through the breadboard. The power source being loaded in the test is a sealed lead-acid (SLA) battery, to avoid any instabilities in the power source itself. The silver jumper is where the square-wave is injected from my function generator. The resistor, diode etc. on the lower left is part of a manual (potentiometer-based) load level setting sub-circuit and is not connected.
My main question is: Why does LTSpice not predict this significant instability? It would be really handy if it did because then I could simulate my compensation network. As it stands I just have to plug in a bunch of different values and re-test.
My main hypothesis is that the gate capacitance of the IRF540N is not modeled in the SPICE model and I'm driving a ~2nF capacitive load that's not accounted for. I don't think this is quite right because I see capacitances in the model (http://www.irf.com/product-info/models/SPICE/irf540n.spi) that look to be the right order of magnitude.
Any way I can get the simulation to predict this instability so I can also tune in my compensation network values?
REPORT OF RESULTS:
Ok, it turned out that the LTspice model I was using for the LM358 op-amp was quite old and was not sophisticated enough to model the frequency response properly. Updating to a relatively recent one by National Semi did not predict the oscillation, but clearly showed the 20% overshoot, which gave me something to work with. I also changed the pulse peak voltage to match my breadboard test, which made the overshoot easier to see:
Based on that "feedback", I started with the unanimously recommended compensation method which I believe is an example of dominant pole compensation. I'm not sure if the gate resistor is part of that or a second compensation scheme, but it turned out to be critical for me. Here are the values I ended up with after a fair amount of trial and error:
This produced a very stable waveform, although I'd like to get the rise and fall a bit sharper if I could, to better test the frequency response of the power supplies I'll be testing with this load. I'll work on that a bit later.
I then used the new values on the breadboard, and lo and behold I got this:
I was pretty psyched about that :)
Especially since, to fit in the new components, I made the breadboard parasitics worse rather than better:
Anyway, this one ended happily, hope this helps others who find it on search. I know I would have torn out what little hair I have left trying to dial in these values by poking different components into the breadboard :)
AI: There are different models for the LM358 unit. PSpice simulations based on "LM358" result in a phase margin of app. 50...60 deg. But apparently, this is a very simple model.
However, when using the LM358/NS model the margin is slightly negative!
This explains the observed instability during measurements. Hence, external stabilization of the feedback scheme is necessary.
Compensation: A compensation scheme (series connection R=500...1000 Ohms and C=50...100nF) at the opamp output node provides a phase margin of app. 50 deg. (simulation). |
H: How to quantify the health of an electronic appliance according to its power consumption?
Is there any ways to quantify the health of an electronic appliance according to its power consumption?
AI: Well, if the device is supposed to draw only 500mA, but it keeps blowing a 16A fuse in your house, then the device is probably busted.
Outside of that, you'd have to know (or track) typical power consumption for the device. If it draws significantly more (or less) current than usual then there may be something wrong with it. If the current consumption slowly increases, then it may be going bad.
In truth, it will depend on the device and what you know about it.
You won't (generally) be able to put a device on a power meter and say "well, this thing's gonna go pop next week." Any information you get will have to be seen in light of what the device is expected to do and how it has performed in the past (or how devices of the same model generally perform.) |
H: Buck converter charge battery control output voltage
I have a buck converter charging 8 series of Li-Ion batteries ( 8 x 4.2 voltage of charging) with a source of 36 V. I am using this schematic (from here):
I know that for a resistive load, the output is controlled as
$$V_o=D V_{in}$$
But, here the load is not resistive. How to control the output voltage? can we control it as above without feedback?
Does duty-cycle D = 8 x 4.2 / 36 works here?
AI: If you used a synchronous converter, its duty cycle x input voltage is pretty much the output voltage when averaged. If you are intent on doing this without feedback you should strongly consider a synchronous solution - it has a high side and a low side MOSFET. In effect it is a half bridge solution.
Having said all that, you need to modify duty cycle on the fly to cater for changes in input voltage levels so this requires some analogue signal processing. |
H: Function of undocumented pads on PCB mount power module
I'm hoping someone may be able to explain to me why are there extra pads on the bottom of APXW003 DC/DC SMPS PCB mount module from ProLynx series from GE Industrial. I am doing a design and it turns out cheaper for me to use these modules than to make a SMPS from discrete parts.
The datasheet, which can be found here:
http://apps.geindustrial.com/publibrary/checkout/APXW003A0X?TNR=Data%20Sheets|APXW003A0X|generic
makes no mention of the circular pads which can be seen in the land pattern presented on page 19 of the document. I have ordered a few of these modules and checked for continuity of these pads, and found it to be as in the picture attached (two of them connect to GND, one of them connects to VIN). I have read the datasheet twice carefully and was not able to find any mention of these except on page 19 where they are just labelled "keepout".
Could someone explain to me the function of these pads? Should I connect them to GND and VIN on the PCB as I have found (with a multimeter) they are internally connected to those pads? They strike me as very strange as solder can easily bridge a pad and those circular "keepout" marks - especially the one between "VS+" and "VOUT". What is their function?
Thank you!
-Igor
AI: My guess is they are pogo-pin-test-bench test points.
I'd be amazed if one of the "GND" ones isn't in some way Vout or related to it.
They use those to test the module in an automated jig to see if it works as intended, BUT...
You cannot use them reliably, because you have no knowledge of what they are connected to exactly. One may be connected to GND directly, or it may have a buffer component like a 1Ohm resistor for some unknowable reason.
I think it's a bit sloppy to put them so close to actual pads and not even mention a DNC notice on a few more pages, but, companies these days get to be a little sloppy some times. |
H: Altium: Rules and Query syntax
I want to set some rules for certain components. These rules are in the minimum solder mask sliver however I'm stuck on the query.
So far I've written IsDesignator = U7 but nothing seems to change and I'm still getting error for rule violation.
I'm not sure if my syntax is correct but regardless, using designator to set the rule is inefficient. I want to include the component type instead.
AI: This is how I handle queries, and I find it to be pretty effective.
In your PCB window, right click on the component you want to identify with a query and right click and and select "Find similiar objects".
This will allow you to narrow down what you are looking for and if you select "Create Expression" at the bottom, it will create an expression in the PCB Filter panel which you can then edit to refine or just copy and paste elsewhere like a rule.
The benefits of this method is that you can see if your query was correct.
So right click your D7 and select Find similar objects and then make sure that ObjectKind is set to same, and that Name is also set to same.
Make sure the Create Expression is checked, and Mask is selected from the pulldown (this will highlight the results of your query so you can check if it was correct).
Just a note, if you use this method, the queries can be rather long sometimes, so it is good to review the Altium Query language because you can find some useful stuff in there. |
H: How to smooth analog data?
I am trying to read load cells data, but these values are very fluctuating. I have ADS1230 ADC and I had configured it to the internal gain of 128. Four half-bridge load cells are connected in a bridge configuration and the output of bridge is fed into ADC. BUt there is no way i can get stable reading. It would be great to know what i am missing here. Would EMI be the Cause here? Any suggestion would be appreciated.
AI: It's likely that your input is simply quite noisy. Applying some form of averaging here is your best bet.
The simplest solution is to take n samples and average them together to produce a result. This divides your sampling rate by the number of samples you use per averaging interval.
Another option is to use a digital filter; the simplest to implement is a first-order infinite impulse response, and looks something like this:
accumulator = 0.9 * accumulator + input
Where input is the ADC reading. Each time you update the filter with a new reading, you're taking a weighted average of the new data and all the old data. To get the averaged result out, divide accumulator by the inverse of the weighting - in this case, 0.1, like so:
value = accumulator / (1 - 0.9)
The weighting value controls how much averaging you get, and how quickly results converge when there's a change to the input; in this case each value is 90% dependent on the previous state and only 10% dependent on the new reading.
If you pick weightings that are powers of 2 - eg, 1/2, 1/4, etc - you can execute this very efficiently on a microcontroller without needing expensive division operations. For instance, picking a weighting value of 1/16 (=6.25%), you can compute your accumulator like this:
accumulator = accumulator - (accumulator >> 4) + value
and get the result like this:
result = accumulator >> 4 |
H: Why do RC applications use such a small PWM duty cycle?
I know that RC applications, such as a drone, use PWM signals to drive the motors. This PWM signal is mostly 50 Hz (0.02 s). The pulse itself varies from 1 ms to 2 ms. So a 1 ms pulse corresponds with a minimum motor rotation and a 2 ms pulse with a maximum motor rotation. So basically the other 18 ms of the period the signal stays idle.
Why does the PWM signal have such a format? Why is the active part of the signal not spread over 1 ms and 10 ms? What is the advantage of using such small pulses?
AI: The reason for the long gap is so that the transmitter can send all of the other servo positions.
In the days of clothes-pegs and crashed aircraft from frequency collisions, radio control was done with AM at 27 MHz.
The transmitter would send a sync pulse, and then a series of 1-2 ms pulses, one for each servo. The earlier ones delayed the later ones, didn't matter much. These are just RF pulses, no special modulation.
The receiver would receive the pulse stream, synchronise on the first one and then direct each successive pulse in turn to a different servo socket.
So to allow for maybe 8 channels set to 2 ms, and have some gaps, you need about 20 ms. With an 8 channel transmitter, the duty cycle on the combined RF channel would have been over 50%.
This servo protocol, of 1-2 ms every 20 ms, has just stuck around from then.
This site about making a PC digitiser for your remote control has some oscilloscope graphs showing four or five channels. |
H: AVR Not Resetting Properly
I am facing an issue where my AVR is not resetting properly upon power up.This is the first time I am facing such issue.
I have a Nokia LCD connected to AVR and upon startup (and after some delay and after initializing the LCD display), the AVR is supposed to toggle an LED and then display a test pattern on the LCD.
Sometimes when I power up the system, the LED gets toggled but nothing is displayed on the LCD. But when I connect a naked wire to the AVR reset pin and touch it, the system resets (the LED toggles again) and this time the test pattern is displayed correctly.
I am not sure what is happening here.
AI: The reset when you touch that naked wire could be ESD related and not something you should carry on doing - unless you want to potentially kill your micro.
As for the LCD not initialising reliably, I'd guess that you have a border-line timing issue somewhere in your init procedure. |
H: Footprint election
I have to do a PCB and I have seen that the datasheet of some discrete component like microcontrollers indicate what footprint to use, but when I want to choose the footprint of a capacitor or resistor I have multiple choices which seem to be right.
I mean, for example, if I need a 1μF whith 0603 dimensions, I may choose either SM0603 or SM0603_Capa or SM0603_Resistor. I suppose that SM0603_Resistor is for resistors, but there are still two options and it looks like both are rights or at least people uses both.
So, how do I know to choose footprints?
AI: The ideal footprint doesn't just depend on the package size. You should also consider:
The height of the contacts on the part (not all "A size" capacitors are the same, for example)
The mass of the part
Whether you're doing reflow or wave soldering.
For reflow, The thickness of the stencil you'll use.
How much you're willing to trade off assembly defects and reworkability to cram more parts on your board.
So whatever footprints are provided by Altium, they're not likely to be ideal for your design. (And you also shouldn't just blindly trust the footprints provided by the part manufacturer --- they'll give you a good compromise footprint, but not necessarily the best one considering all the details of your design)
But if you're doing hand assembly in low volume, you can probably get away without having the absolute "ideal" footprint. And the provided libraries (at least for common two-terminal devices) are probably acceptable, whichever one you choose. |
H: cheaper alternative to RPR359F Photosensor
We all love summer vacation but there comes a time when you get bored of your Xbox and decide to start off a new project to keep you busy.
Well this is what happened to me and I decided to build an Arduino controlled interactive LED table surface after watching a couple of demos on Youtube. The sensor I was going to use for interaction was RPR359F Photosensor since I had already used it earlier in a project. However, at that time, I managed to get as many of these as I wanted from the university as it was a part of a course. But I was astonished when I tried to buy it myself. The damned thing costs a lot.
Since I need nearly a hundred of them so now I am looking for a cost effective alternative to those photosensors to use it in my project. I was wondering if the LDRs are what I am looking for but wouldn't the light feedback effect keep them always on. And I am not even sure if they would be able to detect the user's hand as efficiently as those photosensors could do.
Please suggest any other cheap solution and also comment on the LDR's usage.
AI: The sensor you mention is just a phototransistor and an IR LED in a housing.
Maybe you could 3D print frames, use drilled holes, or otherwise replace them (spacers or shrink tubing over the parts?). |
H: Will coiling a mains power electrical cord cause interference?
I am a maker working on a lamp design in which a decorative power cord is wound through the structure, creating a coil down the lamp's main structure. The coils are about 3cm apart and the same in diameter, and the power standard is 220V.
I'm pretty certain that this isn't in any way dangerous, however will coiling the cord in this way cause any interference with other electronic devices? Are there any other concerns?
AI: The coils, if "air-cored", meaning that no metal passes though the center of the coils, should be relatively benign. Especially if both wires are routed together in the coil. However, if they are routed separately, and have any metal though the centers, then they will behave at least slightly as inductors and/or transformers, and three things may happen. 1. They metal or coils may get warm. 2. They may reduce the amount of power reaching the lamp. 3. They may audibly "hum" with the mains frequency. Any metal passing through them may also generate a current (transformer action) which may be negligible, or rather significant depending on the exact design. A picture here would be worth a thousand words. |
H: Component Not Found VHDL XILINX ISE
i know this might be a very simple question .
i have to simulate some delays for various adders in ISE Suite . ( i'm a little familiar with vhdl concepts but ISE Environment , not at all ! )
this is the vhdl Code for Carry select adder :
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.NUMERIC_STD.ALL;
use work.all ;
library UNISIM;
use UNISIM.VComponents.all;
entity csa is
generic (
WIDTH : natural := 32 -- adder will add WIDTH bits, should be a power of 2
);
-- some port mappings ..
end csa;
architecture csa_arch of csa is
component csa is
generic (
WIDTH : natural
);
port (
op_1 : in std_logic_vector(WIDTH-1 downto 0);
op_2 : in std_logic_vector(WIDTH-1 downto 0);
c_in : in std_logic;
sum : out std_logic_vector(WIDTH-1 downto 0);
c_out : out std_logic
);
end component;
signal sum_loc_0 : std_logic_vector(WIDTH-1 downto 0);
signal sum_loc_1 : std_logic_vector(WIDTH-1 downto 0);
signal c_out_loc_0 : std_logic_vector(1 downto 0);
signal c_out_loc_1 : std_logic_vector(1 downto 0);
begin
base_case : if (WIDTH = 1) generate
full_adder_0 : full_adder -- GENERATES ERROR --
port map (
op_1 => op_1(0),
op_2 => op_2(0),
c_in => '0',
sum => sum_loc_0(0),
c_out => c_out_loc_0(1)
);
end generate;
and the line creating a component of the full adder entity rises tthe error :
Line 44: full_adder is not a component
the full adder is defined in a seprate file : ( in teh same project as another vhdl module )
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.NUMERIC_STD.ALL;
library work ;
library UNISIM;
use UNISIM.VComponents.all;
entity full_adder is
port (
op_1 : in std_logic;
op_2 : in std_logic;
c_in : in std_logic;
sum : out std_logic;
c_out : out std_logic
);
end full_adder;
architecture full_adder_arch of full_adder is
begin
sum <= op_1 xor op_2 xor c_in;
c_out <= (op_1 and c_in) or (op_2 and c_in) or (op_1 and op_2);
end full_adder_arch;
AI: There are three ways to instantiate components in VHDL, through the use of direct entity instantiation, instantiating a declared component and instantiating a configuration of an entity.
The first two of these are shown below:
library ieee;
use ieee.std_logic_1164.all;
-- use IEEE.NUMERIC_STD.ALL;
-- library work ;
--
-- library UNISIM;
-- use UNISIM.VComponents.all;
entity full_adder is
port (
op_1: in std_logic;
op_2: in std_logic;
c_in: in std_logic;
sum: out std_logic;
c_out: out std_logic
);
end full_adder;
architecture full_adder_arch of full_adder is
begin
sum <= op_1 xor op_2 xor c_in;
c_out <= (op_1 and c_in) or (op_2 and c_in) or (op_1 and op_2);
end full_adder_arch;
library ieee;
use ieee.std_logic_1164.all;
-- use IEEE.NUMERIC_STD.ALL;
-- use work.all ;
-- library UNISIM;
-- use UNISIM.VComponents.all;
entity csa is
generic (
WIDTH: natural := 32 -- adder will add WIDTH bits, should be a power of 2
);
port (
op_1: in std_logic_vector(WIDTH-1 downto 0);
op_2: in std_logic_vector(WIDTH-1 downto 0);
c_in: in std_logic;
sum: out std_logic_vector(WIDTH-1 downto 0);
c_out: out std_logic
);
end entity csa;
architecture component_instantiation of csa is
-- component csa is
-- generic (
-- WIDTH: natural
-- );
-- port (
-- op_1: in std_logic_vector(WIDTH-1 downto 0);
-- op_2: in std_logic_vector(WIDTH-1 downto 0);
-- c_in: in std_logic;
-- sum: out std_logic_vector(WIDTH-1 downto 0);
-- c_out: out std_logic
-- );
-- end component;
component full_adder is
port (
op_1: in std_logic;
op_2: in std_logic;
c_in: in std_logic;
sum: out std_logic;
c_out: out std_logic
);
end component;
signal sum_loc_0: std_logic_vector(WIDTH-1 downto 0);
signal sum_loc_1: std_logic_vector(WIDTH-1 downto 0);
signal c_out_loc_0: std_logic_vector(1 downto 0);
signal c_out_loc_1: std_logic_vector(1 downto 0);
begin
base_case:
if (WIDTH = 1) generate
full_adder_0:
full_adder -- GENERATES ERROR --
port map (
op_1 => op_1(0),
op_2 => op_2(0),
c_in => '0',
sum => sum_loc_0(0),
c_out => c_out_loc_0(1)
);
end generate;
end architecture;
architecture direct_entity_instantiation of csa is
-- component csa is
-- generic (
-- WIDTH: natural
-- );
-- port (
-- op_1: in std_logic_vector(WIDTH-1 downto 0);
-- op_2: in std_logic_vector(WIDTH-1 downto 0);
-- c_in: in std_logic;
-- sum: out std_logic_vector(WIDTH-1 downto 0);
-- c_out: out std_logic
-- );
-- end component;
signal sum_loc_0: std_logic_vector(WIDTH-1 downto 0);
signal sum_loc_1: std_logic_vector(WIDTH-1 downto 0);
signal c_out_loc_0: std_logic_vector(1 downto 0);
signal c_out_loc_1: std_logic_vector(1 downto 0);
begin
base_case:
if (WIDTH = 1) generate
full_adder_0:
entity work.full_adder -- GENERATES ERROR --
port map (
op_1 => op_1(0),
op_2 => op_2(0),
c_in => '0',
sum => sum_loc_0(0),
c_out => c_out_loc_0(1)
);
end generate;
end architecture;
The entity and architecture for full_adder is included for the second csa architecture (direct_entity_instantiation).
Note that there is an implied library declaration for the library simple name work in VHDL. A use clause specifying use work.all; would make all the declarations for primary units in the current working library available. The architecture direct_entity_instantiation could have taken advantage of that and not used a selected name to specify full_adder in the generate statement.
I analyzed both architectures, and verified they work with the generic WIDTH set to 1. Elaborating and running tells us there's no connectivity issues for width 1.
A component instantiation with a component declaration does not require the full_adder to analyze, but does require it be analyzed before csa for elaboration.
Likewise the direct entity instantiation requires full_adder be found in the working library to analyze csa successfully.
See IEEE Std 1076-2008 11.7 Component instantiation statements. |
H: Eagle CAD: method of re-linking schematic and board?
I've accidentally lost the sync between my schematic and board, with Eagle CAD giving me the following error:
Board and schematic are not consistent!
No forward-/backannotation will be performed!
Is there a method of re-linking the two? I had very little work invested in the board layout so a method of linking the schematic to a new board file would also be helpful.
AI: From schematic run ERC. Consistency errors will be at the top. Fix the errors by removing parts, nets, etc. that causes them then try to switch to layout and back. Repeat until the error message disappears. |
H: Why does my solid state relay not properly power a DC load?
I'm using a T108S02 to try to use a logical signal to turn on or off a small 3V DC toy. I'm not sure of the load current of the toy since my ammeter is not working.
When I activate the relay, my toy turns on, but appears to be running with limited load as the motor runs at about half speed.
I am expecting this SSR to be either all on or all off. What would make it act like a resistance?
AI: An SSR can, in most cases, be considered to be "all off" when it's OFF, but when it's ON there'll always be some series resistance it exhibits which keeps it from being "all on".
That resistance is, most likely, what's keeping your motor performing at a level less than what you'd like it to.
EM Fields |
H: Transfer function of a basic RC circuit
I'm having a hard time getting my head around finding the transfer function.
I have a circuit that looks like this:
o----------R-------C-----------o
|
|
C
|
|
o------------------------------o
The solutions in my book say the answer is $$\frac{(RC)^{-1}}{s + 2(RC)^{-1}}$$ where s = jω. How did they get this?
Help will be much appreciated.
AI: At the risk of doing your homework for you,
Start with the voltage divider rule
$$\frac{V_o}{V_i}=\frac{Z_C}{R+Z_C+Z_C}$$
where \$Z_C\$ is the impedance associated with a capacitor with value C.
Now substitute
$$\frac{V_o}{V_i}=\frac{1/sC}{R+2/sC}$$
Now multiply by \$\frac{sC}{sC}\$
$$\frac{V_o}{V_i}=\frac{1}{sRC+2}$$
Now divide both the numerator and denominator by \$RC\$ to isolate \$s\$.
$$\frac{V_o}{V_i}=\frac{(RC)^{-1}}{s+2(RC)^{-1}}$$ |
H: 555 Timer Min Max Expected Output Voltage Value
Could someone please tell me what are the min and max output values that should be expected from a 555 timer Output (pin 3) given X volts as the voltage source?
For example, assuming that the 555 timer is powered by 9 volts, what should the pin 3 voltage be when the pin is low and when the pin is high? I was under the impression that the voltage should be 0 when the pin is low and 9 when the pin is high but instead I get 0 volts when the pin is low but only 7.7 volts when it is high (Note that I measured the voltage with no load on pin 3).
I tried this with a couple of timers that I have laying around here and they all did the same thing. At this point I am not sure if I have a bad batch of timers, if I am connecting things the wrong way of if this is the way is should be.
If possible, could someone also point me to the place in the timer 555 specs document where it specifies what the output should be? I tried looking at the specs but I got lost, I am still pretty new to electronics and spec sheets overwhelm me a little.
The specific timer I am using is NE555P.
Thanks.
AI: The question you ask is not easily answered. The problem is that the chip really doesn't have any specs for your condition. If you look at http://www.ti.com/lit/ds/symlink/ne555.pdf, section 7.4, you can find the high output voltage numbers, but these are only given for fairly large (100 mA) currents. There is simply no guidance in the data sheet for performance with very low currents.
With that said, you'll notice that (for instance) at a 15 volt supply the high level is guaranteed to be 13 volts, or 2 volts less than the supply. For 5 volts, it is once more spec'ed for about 2 volts under the supply.
So, anything above 7 volts is about as good as you should hope for, and 7.7 volts seems a pretty good number. |
H: Internal reference of MCU
The internal reference of the MCU is 1.45 V. I am relying on this to measure ambient temperature ratio-metrically using NTC and a resistor. The MCU datasheet says that the internal voltage reference can vary from 1.38 to 1.5. I am assuming that for the given instant, If I sample the 3 V supply with the internal reference and immediately sample the NTC, the short term variation of the internal reference will not add errors in my measurements.
Question: Is my assumption right? Or, any other suggestions?
[datasheet of MCU:][1]
[1]: http://am.renesas.com/req/product_document_lineup_child.do?REGION_KEY=3&LAYER_KEY=85282&PDF_URL=http://documentation.renesas.com/doc/products/mpumcu/doc/rl78/r01uh0382ej0200_rl78l13.pdf&TKUPDATE=true&APNOTE=true&AUTHORFLG= Temperature Measurement range: -10 to 40C
AI: Since you're measuring ratiometrically slow variations in the supply or the reference (for example with ambient temperature) will not have any effect on the reading. That's the beauty of ratiometric reading- the reference can vary 5% and the reading will depend only on the stability of the reference resistor.. ideally.
However, fast variations (for example, if the supply varies when something is switched or noise in the readings) will show up in your temperature reading. Since the resistance change with temperature of a typical NTC thermistor is very large it won't have much effect on the reading around the point where the thermistor resistance is close to the reference resistor resistance.
If you're looking for very stable readings over a wide range of temperature you may wish to regulate the 3V down to 1.8 or whatever with another dedicated regulator (there are other things that would work, but a regulator takes almost no area and is inexpensive) to keep the variations to a minimum and perhaps digitally low-pass filter at least the reference measurement to reduce the noise in the reading. Of course if you could power the resistor/thermistor from the internal reference it would be ideal, but often the chip designers don't make it externally available. |
H: Altium: PCB rule check violation errors
I'm not sure how to change the rules to satisfy the component constraints
AI: If you open up your PCB and Violations panel, you can see all your errors. Double click on one of the errors, and a pop up will appear. Jump to the error, so it fills the screen, and the highlight it, so you know exactly where it is.
You can find all the rules within the Design->Rules
Go through the list, and you can find all the rules including the ones in your Message panel. |
H: Burned Out Tantalum Capacitor Replacements
I have an old computer with a broken Miniscribe 8425SA hard disk. One of the capacitors has burned out, and need some help finding a replacement. Here are my questions:
It appears there are similar capacitors on the board which are marked "-A- 22uF 16V 89 2 8" (see pics below). What does the "A" code mean? I think I understand the rest (capacitance, voltage rating, date code?)
What ESR should I get? Is the lower the better?
The capacitor appears to be 6.5mm X 4mm. So the size code would be something like 6540?
Is there anything I can do to make this less likely to burn out in the future? Higher voltage rating, say 25V? Different capacitor type? It appears tantalum capacitors are finicky and fail catastrophically.
Images:
Top view with identical (?) component
Side view, it looks like the capacitor was connected to the 12V rail.
Length of duplicate, in mm.
Width of duplicate, in mm.
AI: It looks like your fried cap is connected right next to the input terminals of the +12 V rail and GND. Here are the steps I would try to get the drive running again:
Remove the cap. Power the hard drive, chances are it will work
anyway because the cap just acts as a small filter for the incoming
+12 V rail and the slightly increased ripple voltage on this rail will likely be tolerated by the rest of the hard drive. This
test will also tell you if anything else has failed along with the
cap or if you're lucky and the cap is the only bad part.
If step 1 was unsuccessful, you can put pretty much any cap with at
least the same capacitance and at least the same voltage in place of
the fried cap. Maybe the drive will work now? If you just need the
drive to recover the data, any half-decent electrolytic (including
tantalum) capacitor will likely do the job long enough until you
finally scrap the drive. Don't worry too much about the ESR. As the cap appears to be just in parallel to the 12 V input, it's not worth counting every milliohm. However, your're of course right: The smaller the ESR, the better.
However, by the looks of it, the drive is so old that you value not
only the data but the cool vintage hardware itself. Here's what I
would do for a good, permanent repair: Sizes of SMD tantalum
capacitors are standardized. Yours
appears to be one of the bigger ones (C?, D?). Try finding a
replacement cap with the same size and capacitance, and you're very
right about the voltage - 25 V or more is a very good idea. There is
a huge derating to be considered when using tantalum capacitors, and
using a cap with twice the voltage it is subjected to in your
application is not a bad idea at all. One last hint: While aluminium
electrolytic caps have the mark ("bar") on the negative end,
tantalum capacitors are marked on the "+" end!
As we're aleready talking about derating and fried tantalum caps: Besides (even very short) voltage spikes causing tantalum caps to fail catastrophically, they are also very sensitive to current spikes (as they will appear when you hot-plug the power connector into the drive). If you have the space, using an aluminium electrolytic cap as a replacement will be more robust. If you want to go for a "good as original" vintage repair, try to stay away from hot-plugging your drive.
Example random size chart (it gets more confusing when you consider not only the length and the width, but also the height):
Related: https://electronics.stackexchange.com/a/80458/930 |
H: What is a purpose of BJT in an LED driver circuit with MOSFET?
I am trying to turn an LED on and off repeatedly with a square wave.
Yesterday, I've checked the following circuit works:
(Please note that, the figure has one voltage source Vdd. But I've connected a square wave source to the resistor Rg)
But, the most of LED driving circuits have a form of the following:
I am curious that what roll a BJT does in this circuit. From this article, it has something to do with a constant current source. Then, what is an advantage if there is a constant current source?
AI: The npn Transistor is used to control the current flow through the LED. The resistor Rs can be chosen using the formula below:
ILED = 0.7 V / Rs
Note that this type of current limiter is far from perfect. You actually have to expect base voltages of 0.5...0.9 V, and they will vary greatly with temperature and depend on the exact type of transistor used. Consider this as a mere starting point for digging deeper into the subject of transistor current sources...
For more detail you can refer the below link
http://www.physics.unlv.edu/~bill/PHYS483/current_lim.pdf |
H: Is there a shortcut key in ModelSim so that part of the code I wrote will be turned to a comment:?
Is there a shortcut key in ModelSim so that part of the code I wrote will be turned to a comment?
Just like here, we use Ctrl + k. I wonder if there is also in ModelSim.
AI: Although I did not manage to find such a shortcut in modelsim, I found a way to create one. Follow these steps :
1) In modelsim, goto Window -> Keyboard Shortcuts. A dialogue will popup.
2) On the top, under Shortcut type, select "Window Specific" .
3) In the text box area, enter your desired key combination. Note that some shortcuts are reserved and cant be changed (including your preferred ctrl+k).
4) In the 'Select Command From' Radio buttons, select "Popup or Pull-Down Menu".
5) In the 'Menu Items' , select "Source -> More -> Comment Selected" .
6) Press Ok.
Voila ! You now have your shortcut ready. |
H: Why are vias bad?
I am designing a PCB with EAGLE and saw that it was trying to limit the amount of vias through the PCB.
Why do you want less vias?
Why are they bad?
Do they bring extra manufacturing cost or is it OK for low-frequency
and low-power solutions?
AI: I think the main problem is: vias could occupy significant space from other components, thus a larger board is necessary.
On the first picture a TH vias allow us only four pads to be placed. But with a blind via or without a via we have place for six (or more if we have more rows) pads. A larger BGA component could be placed here this way. source
And at the end reduced size means reduced cost.
But to defend the vias a little:
There are cases when they are useful. For example at high power dissipation componenets thermal vias could be used to help dissipate the heat by leading it to large copper-pours.
All in all it is very application-specific and could have both advantages and disadvantages as well. It is up to you to find the balance. |
H: How to adjust linear voltage regulator equivalent?
I'm attempting to build a linear voltage supply. (I'm not touching the mains yet.)
My first thought was to use an adjustable linear voltage regulator. Unfortunately, I found that linear voltage regulators have minimum load requirements as well as a reference voltage which translates to your minimum voltage output. On most linear voltage regulators I found that reference voltage to be ~1.25V.
I want to be able to go from 0V-30V with current limiting from 1-3A. So, I looked at the equivalent circuit of a linear voltage regulator on one of the datasheets and came up with this...
Since op-amps don't pull much current (in ideal op-amps zero current), and can have a maximum input voltage above 30V I thought that this circuit would be perfect because really my only limit was the maximum collector voltage and current of the BJT connected to the op-amp output, and I can get 0V!
Since the op-amp inputs don't draw current anyway* the voltage divider just has to establish a low current voltage reference. I thought that would be easy, but I was wrong.
Assuming I replace R1 and R2 with a potentiometer, when I'm at a high total resistance everything will be fine. When I drop lower power gets in the way. If I'm at 0 resistance (0V reference) the voltage divider will basically be a short and I'll be fine:
$$I=V/R$$
$$I=30/0Ω$$
$$I=0A$$
$$P=VI$$
$$P=30V(0A)$$
$$P=0W$$
But, when I want a very low voltage power becomes a problem.
(Let's assume total resistance is at worst case resistance of 1Ω)
$$I=V/R$$
$$I=30/1Ω$$
$$I=30A$$
$$P=VI$$
$$P=30V(30A)$$
$$P=900W$$
And even if my constant current regulator was working before hand and only let me draw 3A, I'd still be having power troubles.
My second solution was to leave R2 as a high value resistor and substitute a potentiometer for R1. In this case I wouldn't be having power troubles anymore but something would be funky with the control scheme. Let's say the potentiometer replacing R1 is at 0Ω.
In this case R2 acts as a current shunt, and I get my full rail voltage as the reference voltage. But the potentiometer would have to go from 0Ω - ∞Ω...and I don't think that's feasible.
The third solution I thought of was to use a linear voltage regulator as a voltage reference but...that kind of defeats the purpose.
The fourth solution I thought of was to replace R2 with a potentiometer instead of R1. I wouldn't have power issues, but the power supply would go from 30V to 0V turning right, and again the potentiometer would have to go from 0Ω - ∞Ω.
There must be a way to do this, but how exactly?
AI: You are not thinking about the potentiometer correctly - it is a three pin device with the wiper effectively being the junction of R1 and R2 - you appear to be regarding it as a rheostat i.e. a two pin variable resistor and this of course can be a problem across supplies.
Basically use a pot (maybe 10k ohm) to replace R1 and R2. This gives you a variable voltage between 0V and 30V going into the non-inverting input of the Op-amp.
Also R3 can be a short circuit and R4 is not needed. |
H: What is the difference in assigning output before end process and after end process in VHDL
I have written a code to check the difference in assigning output before "end process" and after "end process" in VHDL. And the results of the simulation I have posted with it.
What I found is assigning output
1:After "end process" there is no delay, output port is reflected with change in variable.
2:Before "end process" there is a pulse delay.
but I'm not able to conclude it.
entity signal_delay is
port (clock_50M: in Std_logic;
r: in std_logic;
r_delay1, r_delay2: out std_logic);
end signal_delay;
architecture ada of signal_delay is
signal r_1,r_2: std_logic;
begin
process(clock_50M)
begin
if ( clock_50M='1') then
r_1<= r;
r_2<=r_1;
end if ;
end process;
r_delay1<=r_1;
r_delay2<= r_2;
end ada;
----case:2-------------------------------------------------------------
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity signal_delay is
port (clock_50M: in Std_logic;
r: in std_logic;
r_delay1, r_delay2: out std_logic);
end signal_delay;
architecture ada of signal_delay is
signal r_1,r_2: std_logic;
begin
process(clock_50M)
begin
if (clock_50M 'event and clock_50M='1') then
r_1<= r;
r_2<=r_1;
end if ;
r_delay1<=r_1;
r_delay2<= r_2;
end process;
end ada;
AI: In a sequential process the signal is assigned with the next event.
If it is not in a clocked process the signal is assigned immediately.
But another thing is you have this block in your VHDL description:
process(clock_50M)
begin
if (clock_50M 'event and clock_50M='1') then
r_1<= r;
r_2<=r_1;
end if ;
r_delay1<=r_1;
r_delay2<= r_2;
end process;
This is not synthesised in a way you want.
You should put the r_delay1 <= r_1; and r_delay2 <= r_2; inside the if to determine on which clock edge it should happen. There are no Flip Flops reacting to both.
Do not use clock_50M 'event and clock_50M='1' use rising_edge(clock_50M) it is more readable |
H: Usefulness of VBW in spectrum analyzer
Typically in the block scheme of a spectrum analyzer a video filter, with a bandwidth VBW, is located after the envelope detector and before the screen.
As pointed out in this document, the VBW may (and sometimes should) be less than RBW (Resolution BandWidth, that is the bandwith of the IF filter): the resulting signal will be less affected by noise (page 28). But if the VBW is smaller than RBW, this means that part of the RBW output is "wasted", which is undesirable.
1) Isn't it?
The envelope detector itself is a low-pass filter applied after the RBW and before VBW, so (even without the VBW) the signal displayed on the screen has a lower bandwidth than RBW. But the bandwidth of the envelope detector is nowhere specified. So:
2) How can I become sure that no useful signals are cut off by a VBW < RBW? Should I display the signal with VBW > RBW and then lower VBW till all the harmonics are still preserved and stop when a harmonic is cancelled, in a trial-and-error procedure?
Note: the document was just an example, the only useful I found so far. I am not referring to a particular model, but to the (theoretical) reason why a video filter is used in a spectrum analyzer.
AI: Do you have any hands-on experience with a spectrum analyzer ?
If not then maybe you should as it will give you a better understanding of the effect of changing the RBW and VBW.
Ad 1) Indeed the VBW setting can be used to filter out noise and "smooth" the graph. The information is not so much "wasted" but "averaged". Most spectrum analyzers also have an option to average but this averages over multiple traces, this takes longer time and is inconvenient for observing a short event.
Ad 2) Normally you would leave the analyzer on auto settings and then it will take care of the RBW and VBW settings for you based on the frequency span you select. There are no guaranteed settings so that you don't miss anything ! Depending on the signal you're looking for you determine what settings you should use. This requires some practice.
I have been using spectrum analyzers for 20 years already without really thinking too much about how they work. I consider them basically a tunable radio receiver with a visual output. |
H: Number of address in AT24C16 EEPROM or is it duplicate?
I am working on EEPROM AT24C16 for a particular project. According to the datasheet it must have 2048 addresses and I should be able to write 1024 unsigned int into it [ 1 unsigned int per 2 addresses] but I am only able to write 128 unsigned ints onto 256 addresses.
Is my EEPROM duplicate or I am confused and it has only 256 addresses.
please help me to figure out the number of addresses in AT24C16.
Code:
#include<p18f4520.h>
#include<i2c.h> // Required For In-built I2C Routine
#pragma config OSC = HS /* Sets the oscillator mode HS */
#pragma config WDT = OFF /* Turns the watchdog timer off */
#pragma config LVP = OFF /* Turns low voltage programming off */
#define LCD_PORT LATB
#define LCD_EN LATDbits.LATD7
#define LCD_RS LATDbits.LATD6
#define ADDRESS 0xA0
#define LCD_PORT_DIR TRISB
#define LCD_EN_DIR TRISDbits.TRISD7
#define LCD_RS_DIR TRISDbits.TRISD6
#define I2C_SCL TRISCbits.TRISC3
#define I2C_SDA TRISCbits.TRISC4
#define AddressU 0
#define AddressL 1
int TempUpper, TempLower;
long int TempValue;
int TempUpper1, TempLower1;
long int TempValue1;
void DelayMS(unsigned int);
void init_lcd();
void command();
void lcd_data(unsigned char);
void Init_MSSP_I2C();
void DelayMS(unsigned int itime) {
unsigned int i;
unsigned char j;
for (i = 0; i < itime; i++)
for (j = 0; j < 165; j++);
}
void command() {
LCD_RS = 0 ;
LCD_EN = 1 ;
DelayMS(1);
LCD_EN = 0 ;
DelayMS(1);
}
void lcd_data(unsigned char dat) {
LCD_PORT = dat ;
LCD_RS = 1 ;
LCD_EN = 1 ;
LCD_EN = 0 ;
DelayMS(1);
}
void init_lcd() {
LCD_PORT = 0x38 ; //LCD 2 Lines
command();
LCD_PORT = 0x0E; //Display On,Cursor On
command();
LCD_PORT = 0x01; // Clear LCD
command();
LCD_PORT = 0x06; //Shift Cursor right
command();
LCD_PORT = 0x80; //line 1, position 1
command();
}
void lcd_string(char rom *str) {
while (*str)
{ lcd_data(*str++); }
DelayMS(1);
}
void Init_MSSP_I2C() {
I2C_SCL = 1 ; // Initilize MSSP For I2C Send Write '1' RC3/SCL
I2C_SDA = 1 ; // Initilize MSSP For I2C Send Write '1' RC4/SDA
OpenI2C(MASTER, SLEW_OFF) ; // Start I2C Stop I2C
SSPADD = 0x18 ;
}
unsigned int e, th, h, t, o, c = 0, g = 0, temp, tempvalue, fu, add = 0, mv = 0;
void main(void) {
Init_MSSP_I2C();
LCD_RS_DIR = 0 ;
LCD_EN_DIR = 0 ;
LCD_PORT_DIR = 0 ;
DelayMS(250); // Wait on Intilization LCD
init_lcd();
lcd_string((rom char *)"Testing 24C02.. "); // DPTR in 8051 AS
TempValue = mv;
add = 0;
while (add < 512) {
TempUpper1 = (TempValue >> 8) & 0x00FF;
TempLower1 = (TempValue & 0x00FF);
EEByteWrite(ADDRESS, add, TempUpper1);
DelayMS(10);
EEByteWrite(ADDRESS, add + 1, TempLower1);
DelayMS(10);
TempValue = TempValue + 1;
add = add + 2;
}
init_lcd();
lcd_string((rom char *)"END ");
while (1);
while (add < 512) {
TempUpper = EERandomRead(ADDRESS, add);
TempLower = EERandomRead(ADDRESS, add + 1);
DelayMS(10);
add = add + 2;
TempValue = 0x0000;
TempValue = TempUpper;
TempValue = TempValue << 8;
TempValue = TempValue | TempLower;
DelayMS(50);
g = TempValue;
fu = g / 10000; // gets 1000's value of number to Segments[1]
temp = g % 10000;
th = temp / 1000; // gets 1000's value of number to Segments[2]
temp = temp % 1000;
h = temp / 100; // gets 100's of number value to Segments[3]
temp = temp % 100;
t = temp / 10; // gets 10's value of number to Segments[4]
o = temp % 10; // gets 1's value of number to Segments[5]
LCD_PORT = 0xc2; //line 1, position 1
command();
lcd_data(fu | 0x30) ;
LCD_PORT = 0xc3; //line 1, position 1
command();
lcd_data(th | 0x30) ;
LCD_PORT = 0xc4; //line 1, position 1
command();
lcd_data(h | 0x30) ;
LCD_PORT = 0xc5; //line 1, position 2
command();
lcd_data(t | 0x30) ;
LCD_PORT = 0xc6; //line 1, position 3
command();
lcd_data(o | 0x30) ;
DelayMS(1000);
}
while (1);
}
AI: The problem here is actually with the I2C peripheral library, not your code.
The EEByteWrite function is defined as:
signed char EEByteWrite1( unsigned char control,
unsigned char address,
unsigned char data );
#define EEByteWrite EEByteWrite1
As you can see the address parameter is an unsigned char which means it can only accept values up to 255. That's the limit you are hitting.
The EERandomRead function is defined similarly.
The built-in EEByte* functions in plib are not suitable for anything more than small EEPROMs with up to 256 addresses.
To access more than 256 addresses you will need to write your own routines that control the target chip appropriately. |
H: VSSOP-8 Package Footprint
I am trying to create a footprint for a LMR61428 but the datasheet (linked) only has the package outline and nothing for the recommended land pattern, or footp for a PCB design.
I found this image on TI after a fair amount of searching for a VSSOP-8 package which is what the LMR61428 claims to be but I am not 100% confident this is actually the correct one - the pitch of the pins are correct but I am not sure about the overall sizes that it gives.
It seems that it should work, but I just wanted some clarification before it gets further down the line in my design!
AI: Adding to Sanjeev's point, below comparison indicates that Land pattern can be shared. If still in doubt, ask TI.
below is Land Pattern of OPA4170. |
H: Two 2.4GHz radio modules (XBee+Bluetooth) on same PCB. How to minimize interference?
I'm designing a PCB with XBee radio module and a bluetooth module (RFDuino SMD with XBee 2mW Radio). Since both of these modules are using 2.4GHz, are there any special consideration about how to place them on the PCB to minimize radio interference? Is it a good idea to place the XBee on top of the BLE module to save space?
AI: I don't think it will be an optimum solution to place one module on top of the other. I'm not saying that it will not work because it probably will only with less reliable connection, lower datarate etc.
Bluetooth in particular has been designed to avoid interference (it changes channel 1600 times per second !).
In general it is always best to separate transceivers as much as you can for optimum performance. If you look at how antenna's on cellphones are placed inside the phone you should notice that they are usually separated as much as possible even for antennas that do not operate in the same frequency band. |
H: Can I make photodiode's voltage output bipolar?
I am trying to detect light with photodiode. Currently, I am planning to build a circuit like one of the followings:
Two circuits' output will swing between 0 to Vcc volts.
What I want is, I want to make an output swing -A to A volts.
For better understanding, please note the following figure:
In the figures, original signal is a brightness of light signal and NRZ coding will be the output of photodetecting circuit, and the input of ADC.
So, the problem is, Can I build a photodetecting circuit which converts unipolar waveform of light into bipolar NRZ waveform of voltage?
NOTE: The ADC is originally used for RF signals and antennas which outputs NRZ signal. Therefore, you don't need to worry about How ADC accepts negative voltage input?
AI: You can do this trivially by replacing the 0v rail with your negative rail; the output will thus swing between the negative and positive rails. How close it gets to those rails depends on the light input, your photodiode's characteristics, and the resistor; it will not be a neat square wave, but will require squaring up with a comparator.
Since your data is using NRZ coding, which guarantees you'll see a certain minimum rate of edges, you could also use AC coupling to achieve this without a negative rail:
simulate this circuit – Schematic created using CircuitLab |
H: What is the total resistance of a LED array?
First time poster and a hobby EE enthusiast here.
I want to turn on a LED array with a transistor switch and I'm having trouble with determining what will the total resistance on my transistor collector be. And without that I can't determine what should my base resistor be.
This is part of my schema, the switch will be a pin on an Arduino that can supply 5V and max 40 mA:
I got the LED array scheme from an online LED array calculator and it gave me the info that the array draws 60 mA current - from which I figured I could get the total resistance of the array with Ohms Law: 12V/0.06A = 200 Ohm. If my collector resistor is 200 Ohm that would mean that my base resistor should be 2k7 Ohm.
Is that correct? Can a treat the array as 200 Ohm resistor on the collector? Or is the total resistance the parallel of 3 resistors - 110 Ohm? Any advice or a hint in the correct way is appreciated.
Thanks,
Tadija
Edit: LED Red 2.0V, 20mA
AI: Since LEDs drop voltage when there's current through them, and since Ohm's law states that:
$$ R = \frac{E}{I} $$
They can certainly be considered to be resistances of a particular value with a known current through them and a known voltage across them.
For instance, one of your your LEDs, with 20mA through it and 2 volts across it, will look like:
$$ R = \frac{E}{I} = \frac{2V}{0.02A} = 100 \text{ ohms}$$
Usually, though, the resistance of the LED is ignored because it's not needed to calculate the values of the ballast resistors or the transistor's base resistor.
The value of the ballast resistor is determined by:
$$ Rs = \frac{Vs - (n \ \ Vf) + Vce(sat)}{If}\text{ ohms} $$
where n is the number of LEDs, Vf is the forward voltage of one LED, Vce(sat) is the transistor's collector to emitter saturation voltage,\$If\$ is the LED forward current, and Vs is the supply voltage.
In your case that works out to:
$$ Rs = \frac{12V - (3 \times 2V) + 0.5V}{0.02A}\text{ 275 ohms} $$
The 330's you have in there will work, no problem, with the LEDs losing a little brightness.
Since there will be three series strings in parallel, the current into the transistor's collector will be 60 milliamperes. Switching transistors doing this kind of work are usually run at a forced beta of ten, which means that for 60 mA into the collector 6 mA is forced into the base.
The base-to-emitter junction of a transistor is basically a diode, so in this case it'll drop about 0.7 volts with 6 mA through it.
That means that with the Arduino supplying 5V to drive the base, about 4.3 volts of that must be dropped across a resistor with 6 mA through it so, from Ohm's law, R = E/I = 4.3V/6mA = 717 ohms. 750 ohms is a standard E24 value and will work well. |
H: SMD vs THR Transistor for Relay
Designing a Relay control from a MCU's GPIO, there are some requirements to take into account.
Coil Voltage: 3V
Coil Resistance: [36-45]Ohm
Relay Voltage: 250Vac // 30Vcc
GPIO Voltage: 3V3
Max GPIO Current 4mA // 20mA (depending on pin)
So, even when relay are THR, I'm looking for SMD transistor instead of THR for controlling the relay.
I would like you to share yout opinion about which would be the best option to make this work.
THR transistor:
BC550
1N2222
1N3704
SMD transistor:
50C02CH
My questions are:
What do you think about used SMD instead of THR?
Will transistor be
able to dissipate power?
MCU, would it deliver enough current to
activate the base?
Do you have any recommendations?
EDIT: Added COIL Resistance [36-45]Ohm
AI: Pick a transistor that will be able to easily handle the current (Ic(max) >> relay coil current), and check the SOA (Safe Operating Area) to ensure that it can withstand full coil current at 3*Vcc for a millisecond or so. The voltage rating should be at least 3-5x Vcc.
Chances are you can use a good SOT-23 transistor but you might need an SOT-89 or larger, depending on the coil current.
The transistor will be able to dissipate power. Whether it is enough or not, depends on how hard you drive it, the coil current and the package and mounting conditions as well as the maximum ambient temperature. Lots of factors.
If the coil current is low enough, then the GPIO will be able to deliver sufficient current. Think of coil current/20 or so, and ensure that the output voltage is guaranteed at that current (otherwise you cannot guarantee the base current and the transistor may not be sufficiently 'on').
Recommend you find the coil current- that is the missing factor in the design. The design will be quite different if the coil current is 300mA vs. 20mA.
I would also suggest considering a small MOSFET instead of the BJT. Inexpensive MOSFETs can handle lots of current in a small SOT-23 package for a very reasonable price. Eg. AO3414 which is only 0.07\$\Omega\$ with 2.5V drive. Even a 0.5A relay with the weakest GPIO you mention would be fine. |
H: Yellow X in Eagle
I am trying to connect two points of my board with a bottom and top route, connected with a via. Whenever I link the two routes, a yellow x appears. Placing the via on top of the connection doesn't fix it.
How can I get rid of it?
AI: The via doesn't get the same ID as the route. You should try to inspect the name of the route and via and make them the same. You could also try to draw a new route using nets and just change the layer on the point you want to go from top to bottom (or from bottom to top) and eagle will automatically add a via |
H: How to read capacitor code u10j63?
I need to find these capacitor immediately. How to read these values? I am pretty sure they are metalized polyester film capacitor. But I don't know what values they are? Capacitors look like this.
AI: As Rempelbekkie says, it is a 0.1µF, 63Volts, 5% tolerance capacitor.
In case you have more capacitors to check, here is a link to a complete chart.
Extract: |
H: When to use Battery Fuel gauge
I am designing a measuring instrument powered by a Li ion Cell, I need to display remaining battery capacity on it, so I was wondering what is good or lets say widely used method.
Should I use full fledged Battery fuel gauge IC instead of just measuring battery voltage to display remaining battery.
My second question is, since current draw of my instrument would be fairly constant throughout the run, so is it possible to estimate capacity from Battery voltage and current draw?
AI: It's possible to get a very rough estimate for battery capacity from voltage and current draw, but as the battery ages and as the temperature changes it will lead to very significant errors. Probably the best method out there is impedance tracking, which you can read about here:
http://www.ti.com/lit/an/slua450/slua450.pdf |
H: Automatically renumbering element parts in Eagle
I have a circuit in Eagle, and say that counting from left, I have R1, R2, R3, then between R1 and R2 I'm adding a new resistor, it will be named R4. I will end with (looking on the circuit) R1, R4, R2, R3.
It's not ordered.
I would like to keep elements ids (separately for each element type, e.g resistors, capacitors) in order from lowest to highest (counting from left). Is there a script or settings in eagle that will do it automatically for me?
AI: Although Tom Carpenters anwser is right, I am adding this as an alternative.
Eagle already has an inbuilt tool that will allow you to renumber parts without the need for external ULP scripts.
In your schematic editor in your menu, open "Tools" and click "Renumber parts". This will automatically renumber all your parts in the schematic as you wish. |
H: Microphone connection diagram
I am trying to replicate project Jasper of raspberry pi. Currently I am using a USB to audio converter (shown in image below) and a regular PC mic. However the audio reception range is very small. So, I am planning to make my custom mic with opamp to amplify the sound signal.
This is the wiring of the mic (which confused me actually):
Pins labelled '1' are GND. However 2 and 3 tend to produce similar output. (I was assuming GND, VCC, Analog OUT kind of stuff so that I could replace the mic with the red modules shown in the bottom left part. They are ADMP-401 MEMS mics along with an op-amp).
Here are the waveforms that I got after randomly shouting at the mic while connected to laptop. I took the readings from Pin 2 and 3.
This is what I want to do:
Use the breakout board to be the mic and that USB to audio converter module (because raspberry pi doesn't have a mic-in) to provide a audio-input to the raspberry pi. The reason I want to use the breakout board rather than regular mic is "lack of good audio reception range".
This is what I think I should do to get it working:
1) Connect GND of breakout board to Pin - 1.
2) Connect VCC to USB 5V supply after using a 3v3 voltage regulator.
3) Connect AUD to pin 2 or 3 whichever tends to work.
One more discovery that I should share:
Before plugging in the mic, the voltages at pin 2 and 3 float around 4.8V but as soon as I plug the mic in, the voltage drops down to 3.7V.
Any suggestions from you guys will be quite helpful.
Thanks for reading.
AI: Typical USB sound cards have an earphone jack and a microphone jack. Since it works with your microphone, it is set up to deliver power to the electret microphone - hence the 4.8 Volts when open. That is to say, the sound card is delivering DC Voltage to your microphone.
The microphone input of a sound card can't supply much current, but it is enough for a small transistor amplifier. If fact, electret mics all have a single FET transistor amplifier attached to them - the signal from the mic itself is very high impedance and requires that little amplifier to deliver low impedance signal. You might stretch a point and find a low power op-amp that will work with 3.8V and damn near zero current, but I bet your pocket book will say "ouch" if you go that way.
Picking up a voice from across a (normal sized) room shouldn't be a problem, though, even without a preamplifier. The mic can pick it up easily, and the sound card will digitize it. What you hear has got relatively little to do with it, however. It might well pickup and be capable of recording a voice that you can't hear when played back through the speakers. You can amplify the signal digitally, however.
The sound card samples at 16Bits, which gives you a lot of room to amplify things digitally. All you need to do is multiply the incoming samples with some number to amplify the signal. Need 20dB of gain? Multiply your samples by 10.
A better microphone shouldn't be neccessary, unless the one you've got is just utter crap. I use a 20 year old electret mic from an old Toshiba laptop for my experiments - it can pick up voices from all across the room, even if I can't hear them on playback through the speakers. A little digital gain, though, and all is good.
If you actually do go the preamp route, you will probably need to consider using an automatic gain control. Cranking up the amplification until a voice from across the room gives you a full scale recording means that noises closer to the microphone will overload it and you'll just get a distorted mess. Again, digital amiplification can save your bacon. An AGC in software isn't that hard, so just take advantage of the 96dB range of that sound card and do the amplification digitally.
Mmmf. Completely ignored the MEMs mic.
You might try connecting your MEMs mic like an electret with a simple transistor amp. It might work, since the data sheet say the module only needs 250µA at 3.3 Volts.
Like this:
simulate this circuit – Schematic created using CircuitLab
You might have to diddle with R1 and C1 (different values) to make it go.
R1 might need to be bigger, maybe C1 could be smaller.
Looking at your linked picture of the Echo, it would seem that they are using multiple mics to eliminate noise and possibly track the voice source (for better noise reduction and to separate voices.)
The tear down shows a Texas Instruments DM3725 processor, which combines a DSP and an ARM core in one unit. I expect the Echo uses the DSP core for all of the audio processing, and the ARM does the internet and user interface parts. |
H: How do I perform logical operations without a micro-controller?
I would like to build some (hopefully) simple logic circuits without the use of a microcontroller. I'm a software engineer primarily so I think of things slightly differently. To implement this with a microcontroller would be simple but I want to learn how to do it without.
Take the following image. Imagine four photoresistors separated by some baffles. As a light travels around this, each photoresistor would change it's resistance in response to the light, obviously.
If I had this mounted on a two-axis pan-tilt mount, I could track the light with the following simple pseudocode:
# primary axis
if (A+C > B+D) rotateRight()
else if (A+C < B+D) rotateLeft()
# secondary axis
if (A+B > C+D) tiltUp()
else if (A+B < C+D) tiltDown()
Now say I have four LEDs, I want to light them up depending on where the light is. I essentially have four inputs and would like to electronically do this:
LED 1 = A+C > B+D
LED 2 = A+C < B+D
LED 3 = A+B > C+D
LED 4 = A+B < C+D
How would you go about that? Is it possible (/viable) with standard transistors or would you need specific chips? Is there a simple way of doing this?
I look forward to hearing back from everyone!
Thanks
AI: You can average two analog voltages - which is equivalent to adding them, effectively - with a resistor divider:
simulate this circuit – Schematic created using CircuitLab
This only works if your inputs, A and B, have low impedance compared to R1 and R2 - that is, they're capable of supplying a lot more current than these resistors will draw, meaning their voltage won't be affected much by the divider. That's definitely not the case for something like a photodiode, so you'll need a buffer that measures the photodiode signal and reproduces it with much lower impedance - something like this:
simulate this circuit
To compare voltages, you want a comparator. A comparator takes two inputs, and outputs a high voltage if the positive input is greater than the negative input, and a low voltage otherwise.
Collectively, you'd configure the whole thing something like this:
simulate this circuit
For each of the other outputs, you could reuse the opamp buffers, but use separate resistors and comparators to sum the outputs you need. |
H: Where and how do I put an inductor on a volume control
I built an stereo equalizer but I made some mistakes. As the potentiometers didn't fit on my PCB I had to put them separated and make the connections with some wires. The other mistake is that I made a virtual ground instead of a real one.
This mistake causes the equalizer to amplify all the noise from all the mobile-phones sitting around in my house and makes a very annoying noise. It works fine when no phone is around (but this isn't the normal condition).
I bought some ferrite toroids to wind the wires around them. But I don't have enough for all the wires I have in here (they wouldn't fit in the case anyway). So some wires will have to share toroid.
Here is an example for how I think it could bee:
simulate this circuit – Schematic created using CircuitLab
So my big question in which direction should I turn the wires around the toroid?
I know I can turn one wire in any direction I like to if it's only one. If I put two wires around a ferrite toroid I have to care about the relation between these two wires (also easy). But when it comes with this case I don't know how to deal it.
Should I turn all in the same direction? or 2 in one direction and 1 in the other direction? or should I avoid one of them?
If someone could please explain what should I care about? I don't want just a make this or make that solution since this is something I can do on my own.
AI: Putting ferrites around the circuit may actually make it worse, ie act as antennae. What you want to do is make the interconnections as short as possible and more importantly, put it all in a properly earthed metal box. |
H: Difficulty understanding data over opto-diac
I'm having difficulty understanding the data over MOC3021, DIAC side.
Should I see it as with DB3? So DB3's \$V_{bo}\$ (28-36V) is the same in opto-diac, and DB3's \$V_o\$ (min 5V) is the same as MOC3021 \$V_{tm}\$ (typ 1.8V max 3V) and DB3's \$I_{trm}\$ (2A) is MOC3021's \$I_{tsm}\$ (1A), all calculated from \$P_d\$ max for MOC3021:
$$ {300\text{mW}\over1\text{A}} = 300\text{mV}$$
although max 3V why
$$ 300\text{mW} \times 3\text{V} = 900\text{mA}$$
or
$$300\text{mW} \times 1.8V = 540\text{mA}$$
?
AI: Shorter sentences and more white space, please.
It's really an opto-triac in the MOC3021 (a low current triac). A triac will break over like a diac, but the voltage is not controlled and it's not usually very low as for a diac. In this case, it's only guaranteed to be greater than 400V (VDRM).
The current ITSM is peak current, not continuous current. When the opto-triac is used in its typical application it will be driving a much larger triac. When you switch the LED on near the peak of a cycle, the current may only be limited by a single resistor. The triac gate will have very little voltage across it, so the peak current before the triac turns on could be \$\sqrt{2}\times\$ Vrms/R, so for a 240VAC mains, the resistor must be at least 340 ohms to limit the peak current to 1A.
Power dissipation is another (mostly orthogonal) constraint. Normally the power dissipation due to the opto-triac is not very high since it's only short pulses of (typically) some tens of mA near the zero crossing of each cycle. If you try to control a load directly (which is generally not recommended) the power dissipation spec (including LED power dissipation) may come into play. If the current is 100mA RMS and it drops 2V then the power dissipation will be 200mW plus (say) another 50mW for the LED, then the absolute maximum limit will be exceeded for a temperature of only 43°C, which would normally be unacceptable. |
H: Sensitive or not sensitive gate?
If there is nothing about it in the datasheet, how can I find out if it is a sensitive or not sensitive gate?
AI: Simply look at the gate trigger current specification in the datasheet:
A "sensitive gate" triac will have a gate trigger current at 25°C in quadrants excluding IV that around 5mA or 10mA (or less). Trigger current will be much higher when the triac is cold and may be very high or not guaranteed at all in quadrant IV (positive gate, negative MT2 vs. MT1).
It is not necessarily a good thing to have a sensitive gate, as it often goes hand-in-glove with lower tolerance for dv/dt, which can be an issue when switching inductive loads or with mains transients. |
H: Driving IR LEDs using PWM - measuring current & current source questions
For a project I'm currently working on, we're trying to drive 940nm IR LEDs (Kingbright L-934-F3C) using PWM, regulated by an Arduino Uno. We've run into several issues during our prototyping process and could use some help!
We want to illuminate a 50 x 70 cm area from above using these LEDs, to be able to take a photo with an IR-sensitive camera when it's dark. There will be several objects located on this area that need to be lighted. We'd like to use as few LEDs as possible, so our reasoning is to pulse these LEDs at their maximum current while the camera is taking the picture, to achieve maximum illumination.
The Kingbright datasheet specifies an peak forward current of 1.2A, when a duty cycle of 1% and pulse width of 10μs are used. However, it doesn't say at what voltage (the forward current vs forward voltage graph doesn't extend that far). This peak current value doesn't seem to jive with the max. specified voltage of 1.6V (according to the graph, this happens at 50 mA).
(1) Are LEDs able to take massive amounts of voltage when pulsed at
such short times, as long as the peak current stays below the limit?
We currently use a Velleman current & voltage source 30V/3A(http://www.velleman.eu/products/view/?id=420136). We hooked it up to one IR LED using the PWM settings as described in the datasheet and set the current source to 1.2A. The LED instantly blew up as the voltage rose to 30V. When used as a voltage source, further experimenting found that above 15V, the LED did not get appreciably brighter. At 15V, the single LED only appears to draw 40 mA (according to the display on the source).
(2) As these voltage and current figures do not match the datasheet of
the LED, perhaps the lab source doesn't display the correct current
flow. How can we accurately measure this?
(3) What's the longevity of the LED when you operate it at the limit?
Does it have enough time in between pulses to dissipate the heat that
is generated when running at 1%?
We found that a single LED gave a fairly disappointing amount of light. We're thinking of hooking up around 15 parallel strings of 2 LEDs connected in series. If we were to put 30V into the array (2*15V), assuming that the LEDs can draw a peak forward current of 1.2A, the array would draw a current of 18A.
(4) Is it possible to get a peak current of 18A @ 1% duty cycle out of
a 3A source without blowing it up?
Lastly, we're very interested to see other peoples' solutions for this kind of build. I have the feeling that PWM is mostly used to 'dim' LEDs instead of being able to overdrive them to the max, but I might be mistaken. We'd love to hear your opinion on this!
Edit June 25th
Thanks for the responses! I will try to give some background information. As you might have guessed, we're not really electronics ninjas, but that's exactly why we're asking!
The lab source is a Velleman LABPS3003SM (it's strange that the link isn't working for you, WhatRoughBeast, it works over here!)
Responding to the question of CL.: we're trying to pulse the LEDs at the 1% duty cycle for the duration of a single snapshot of the camera, at 3fps. We're homing in on the actual moment that the photo is taken but this is proving difficult. In the final product, it would be great if we would be able to only pulse the LEDs exactly when the picture is taken.
Responding to the questions of mkeith: unfortunately, we do not have an oscilloscope. I'm don't have access to our prototype right now, but the PWM circuit consists of an IRF540N, with the gate hooked up to the Arduino (5V) and the source directly attached to the negative lead of the LED, no resistors.
The source was set as a voltage source, no current limit. This appeared to work when just a single LED was hooked up at 15V. When we tried to hook up 2 LEDs in series (and the voltage source set to 30V), the first of the LEDs in the series blew up.
AI: First, your link does not work, so I have no idea of what power supply you are using. Simply recreating your link when on the web site produces no result. I'm assuming you were looking at their 30V/3A power supply PS300U3. This supply has no PWM setting, and if you applied 30 volts to your LED for more than 10 usec, yes you killed it. As for applying 15 volts, I suspect that you had the current limit set to 40 mA. At this point your LED was dissipating .6 watts, and if you did that for long you would have killed that LED, too.
Looking at the current curve, a quick approximation for voltage rise is to note that from 15 mA to 50 mA, the nominal curve rises 0.1 volts. 1.15 / .1 is 11.5 volts, so a rough estimate suggests 12 volts at 1.2 amps. Note that this is a peak power of 14.4 watts, and with a 1% duty cycle the average power is 144 mW, which is reasonable, since 1.6 volts time .05 amps is 80 mW - the two are within a factor of 2.
(1) Are LEDs able to take massive amounts of voltage when pulsed at
such short times, as long as the peak current stays below the limit?
Yes, indeed. Of course, you MUST keep the duration less than 10 usec, and the PWM frequency less than 1 kHz. Also, long term reliability may be bad. The data sheet just says keep the current below 50 mA, and if you want to do something else (like high-current pulses) you are free to do so. Just don't go crying to the manufacturer if the LED doesn't last long.
(2) As these voltage and current figures do not match the datasheet of
the LED, perhaps the lab source doesn't display the correct current
flow. How can we accurately measure this?
This is pretty straightforward. You make a setup like
simulate this circuit – Schematic created using CircuitLab
and monitor the voltages with an oscilloscope. A multimeter will not work.
You vary R1 while monitoring the scope V1 (1 volt equals 1 amp), and when you get a current you like, you can read the voltage across the LED (V2 minus V3). And whatever you do, don't use a pot for R1 - a 1 amp current will very likely burn the wiper. Turn power off, replace R1 with a different value, then turn power on again. Start with 50 ohms. Use 10 volts on the FET gate, and don't play with it. Make sure that the gate drive never stays high for more than 10 usec.
(3) What's the longevity of the LED when you operate it at the limit?
Does it have enough time in between pulses to dissipate the heat that
is generated when running at 1%?
Absolutely no way to tell other than by doing it. Probably not great.
(4) Is it possible to get a peak current of 18A @ 1% duty cycle out of
a 3A source without blowing it up?
With a good, current-limited supply? No. It won't blow up, mind you. It just won't provide more than 3 amps. With a cheap, voltage-only supply and a narrow pulse width? Sure, especially if you put a big capacitor on the output. Of course, this requires that you are not trying to provide the pulses by commanding the power supply.
With all of this said, you are going about this the wrong way. You need to stop and think about what you are doing. At the very best, your average current per LED will be 1.2 amps x 1% (your duty cycle) or 12 mA. And I can guarantee that the efficiency of the LED will drop at higher current levels, so you will get even less than this in terms of brightness. An LED is not a light bulb, where the light power is roughly the electrical power in. You will get more brightness by driving each LED to a maximum of 40 mA. Not 50 mA. 50 is the manufacturer's absolute maximum, and driving any component to its rated maximum is a good way to get reduced reliability.
EDIT -
1) Power Supply - The problem with the link is that Velleman apparently does not sell that model in the US, so it is necessary to select a European country in order to see it. However, this doesn't matter, it's just a switching supply.
You have misunderstood the current limiting circuitry, though. You might do well to contact Velleman and ask for their specification on response time to a current limit event. It is probably in the range of 50 to 100 usec. Not only that, but the high ripple voltage (200 mV) suggests that they don't do anything special on their output. It is just an inductor/capacitor combination. This means that when you pulsed your LED, the output capacitor discharged immediately into your LED, and the supply also provided a pretty good slug of current as well, while the current limit function never really engaged.
You need to follow mkeith's advice, and use a current limiting resistor in series with the LED.
2) Pulse Width - Your description of what you need is still unclear. As best I can understand it, you have an autonomous camera which takes 3 fps pictures, and are trying to provide IR illumination. At this point, you do not know exactly when each picture is taken or the shutter speed of the camera.
If this is true, PWMing the LEDs is simply not appropriate. Yes, by running the LEDs continuously you will waste power by illuminating the target area when the camera is not utilizing the illumination. However, since you don't know when that is, there is no sense worrying about it. Just run the LEDs at 40 mA and be done with it. Consider the situation where the camera takes 3 fps with a shutter speed of 1/100. If the LEDs are simply run continuously, each exposure will use only .01/.33, or 3% of the available light. If the LED is being PWM'd at 1 kHz, a single exposure will only use 10 pulses worth of light out of 333 which occur during 1/3 of a second. Efficiency is 10/333, or about 3%.
On the other hand, let's say you can either provide the shutter drive, or look at the camera data to determine when the camera has finished acquiring an image. This still does not tell you what the shutter speed is, so you cannot tell how short a pulse you need.
Note that the pulse condition (10 usec @ 1% duty cycle) says that as long as the shutter speed is greater than 1 msec, continuous illumination is the way to go. Like I said earlier, 1% of 1.2 amps is 12 mA, and 40 mA average for continuous is more than 3 times better, regardless of efficiency drops. The only exception to this is if you need shorter exposure times. If the camera shutter speed is less than about 300 usec, than pulsing the LED can be considered. And it's also possible to consider using very short LED pulses as a strobe light to freeze high-speed motion.
3) Efficiency - Efficiency is measured in optical output vs current, and all LEDs show a peak efficiency at (typically) a few mA. An article on the subject: http://www.electronicsweekly.com/news/components/led-lighting/provred-why-led-efficiency-drops-at-high-current-2013-08/. And here http://www.tech-led.com/data/L940-66-60-550.pdf is the spec sheet on a high-current illuminator. Note that the efficiency (mW/mA) is .875 at 700 mA, .800 at 5 A.
4) Voltage Drop - While your specific LED does not have a high-current spec for Vf, http://www.adafruit.com/datasheets/IR333_A_datasheet.pdf is probably a pretty good guide. The material (GaAlAs) is the same. |
H: What does 125VAC mean on a small indicator bulb?
I have recently discovered a small box device that used to have an indicator bulb on it that would switch on when a switch was flicked. I am not sure what voltage to give the bulb, or if its AC or DC, though I assume it is AC because it says 125VAC. This is a picture of the bulb:
I am not experienced with circuits at all and I know very little about voltage, amps, resistors, and power supply. What would I need to make this work? Can I use a household battery?
AI: That looks like a common neon pilot lamp assembly. It should work when directly connected to 120 V AC (common household power in the US and Canada).
I've also seen these assemblies using an LED as the light source - but still designed to be connected directly to 120 VAC. |
H: Input impedance of a non-inverting op-amp
From what I've read (and simulated), the feedback loop of an op-amp modifies the input impedance of the non-inverting input. The value specified in the datasheet is the open-loop input impedance, and the actual closed-loop input impedance will be some much larger number? Why does this happen, and how do you calculate the new input impedance? Does this also reduce effective input capacitance?
Radio-Electronics.com "Op Amp Input Impedance" says it's the differential input impedance of the op-amp plus the impedance to ground seen by the inverting input, with no mention of open-loop gain. So for a voltage follower with no feedback resistor, the impedance seen by the inverting input is zero and the input impedance is unchanged? That doesn't seem right.
HyperPhysics "Practical Benefits:Negative Feedback" says it's $$(1 + A_0 B)\cdot Z_\mathrm{ino}$$
where
\$A_0\$ is the gain without feedback (the open loop gain)
\$B\$ is the fraction of the output which feeds back as a negative voltage at the input
\$Z_\mathrm{ino}\$ is input impedance without negative feedback
So for a voltage follower, B = 1 and it's \$\approx A_0 Z_\mathrm{ino}\$?
AI: Your hyperphysics link is correct, and so is your conclusion about the input impedance of the voltage follower. The math follows from the basic control system diagram. You can see a nice presentation on it here:
http://slideplayer.com/slide/1496732/ |
H: method of locating schematic part on board layout?
In a design with a large number of parts it can be difficult to immediately pin-point a part's location on the board. Is there an easy method of finding a schematic part's location on the board layout?
AI: It's called 'cross-probing'. In Eagle open the schematic and the corresponding brd, on both interfaces press the eye-shaped icon ("Show Objects"). Now by clicking a specific object in one of the windows it will be highlighted in the second. If you are wondering how to locate a part on the schematic, just type show <part_reference> on the command entry field just above the schematic. The same will work on the PCB view. |
H: Why does a resistor in my Neopixel data line work at all?
Adafruit's best practices for their Neopixel LED strings say, "Place a 300 to 500 Ohm resistor between the Arduino data output pin and the input to the first NeoPixel."
Someone asked about the purpose of that resistor here and I'm reading about parasitic diodes and termination resistors to understand that more, but in a nutshell, why doesn't adding this resistor also drop voltage? In other words, if I had a 5V logic signal touching my Neopixel data line, won't adding this resistor in series make that signal fewer volts?
For example, if the Neopixel data circuit doesn't have any resistance then now I would expect 5V on one side of the resistor and 0V on the other... right? And if I have 0V going to the Neopixel data in, then how does signaling work at all? I'm super new to electronics but it just seems like this is the definition of a voltage divider circuit.
Also, if you didn't know about the 300-500 Ohm resistor, how would you choose that value? Is that based on an equation or just looking at something under a scope until it seems stable?
Thanks for helping, this is really puzzling me =)
AI: The resistor is there to limit the current into the input pin. The input likely has a very high DC resistance (more than 1 megohm) so negligible current flows (on the order uA) and a negligible voltage drop is produced (on the order uV or mV). The resistor is likely used to slow the slew rate of the connection (the input pin will have some capacitance, so adding a series resistor forms an RC circuit) to prevent overshoot and ringing which could cause issues with the communication. It also prevents the I/O signal from trying to power the LED string through the ESD protection diodes by limiting the current to something that will not damage the internal diodes. |
H: Can a magnetic wire be used to extend/strengthen the signal coverage of a cellphone?
When i'm inside of our apartment, getting a cellphone signal is very hard, often times I wouldn't get any bar in my iPhone. My unit is in the ground floor and is surrounded by tall walls. My apartment has a small balcony (which is still surrounded by tall walls) where I can at least get a single or two bar signal from my iPhone.
This question was inspired by this video (https://youtu.be/pFx8tuSlCcQ) where a guy used some copper or magnetic wire to extend the range of it's mobile phone antenna. I'm aware that there are some repeater that are being sold but they're really expensive. I'm just looking for a cheap (below $10) solution that I can do or buy.
I'm planning to do a similar solution where I'll be extending some magnetic wire from the inside of my apartment to my balcony. But before I do that, I wanted to confirm if this idea would really work.
I also don't know where I will be connecting the end of the magnetic wire as iPhone doesn't have any external antenna port.
AI: This will do absolutely nothing. What you could consider doing is picking up a pair of antennas and a length of coax cable for the correct cell band. I think that would be around 800 MHz. It should be possible to get a couple of cheap 800 MHz antennas and maybe 20 feet of coax with the proper connectors for around $20 or $30. If you know where the local cell tower is, you could consider getting a log-periodic or other directional antenna for the external antenna and mount it so that it points at the cell tower. Note that this may not help very much; it's going to be more useful for, say, a basement that has thick concrete walls where reception inside is zilch and reception outside is very good. If reception outside is only mediocre, then you may have to get a repeater or a femtocell. |
H: How bad is it to undervoltage a 12-volt lead-acid battery?
I had a heated discussion with a few colleagues today revolving around how low of a voltage was alright for 12 volt lead-acid battery; they were in the opinion that the low voltage warning buzzer and ultimate automatic shutoff was annoying and a safety risk.
I had one guy insisting that the batteries were 'fine' even when they had been seriously undervoltaged and you can throw pretty much anything at them.
Another guy insisted his car battery had at some point been as low as 2 (!) volts and hey, he had no problems with it.
I've always thought when boating that you never let your 12 volt battery drop under around 11 volts, so this very passive stance has confused me a bit. Is there data available to quantify a loss in lead-acid battery quality from low-voltage events? How much do I lose capacity-wise from a low-voltage event? I'm fairly certain I'm right but I need some data.
AI: Your point can be very easily made differently.
If you look at the discharge curve for a Lead-Acid Battery with a 12V or 6V rating:
This comes from Yuasa. They make the things. It's either reliable or optimistic, certainly not pessimistic.
Let's look at the 12V one and optimistically assume that you are only interested in 0.2C discharge, any other rate the same arguments can be made with a different line.
At its 12V mark, you can see there is a "tipping point" where the voltage goes from relatively constant to plummeting.
At 11V it is almost going straight down.
At 9V it will drop right away under the same loading current.
This means that at the 12V point you have essentially used 60% of its capacity. At 11V you are at effectively 93%. At 9V you're at 99.5%.
Now adding that a battery with 0V across it has no chemical initiative any more, of any chemistry type, you will need to motivate it re-create the chemical imbalance that causes the apparent voltage and potential for current to flow. This is hard in any battery (which is why almost all batteries are built with electrodes already chemically built of the right materials to create the cell potential).
With SLA a lot of energy goes in chemical recombination of Sulphates and Sulphites, wasting a lot of energy. This results in needing excessive power to re-engage a cell that is left at 0V. Excessive power = heat. Heat = gassing. Gassing = moisture loss. Moisture loss = bad. Not to mention the higher voltage usually required makes many, many by-products on the plates, next to by-products already generated by neutering it in the first place and you're left with a AA battery with the weight and size of a 6Ah SLA.
Now, if you go near 9V, it will become 0V very quickly. You'll easily be too late.
Many manufacturers tell us "Consider your battery empty at 11.8V", some people (me included) assume 11V. Those who use 11V often (but not always) take care to know that this is the lower limit. This is exactly for that reason.
If they will not accept that 100's of manufacturers, countless experts in the field and users alike say "at 11.8V you're not going to get much more out of it and it'll be risky to try", then just convince them with the fact that at 11V there won't be much to get any more anyway. Done. All other points moot.
The reason a car battery can be dropped to 2V and then keep working, is because that battery was at 2V very shortly, because the idiot leaving his lights on realised after a while. And because they are usually over dimensioned by a factor of 2 to 5, depending on the type and brand of a car, so a crippled one will work for a couple more years.
And let's be honest, are we really going to put hours and hours of work and research into convincing someone who can't even manage to mind his car lights of agreed fact shared between thousands of electrical engineers worldwide? |
H: Safety/efficiency of a makeshift aluminium can heatsink?
I had recently received a 9v 1A DC wall-wart off eBay, and needed to open it to swap the polarity of the jack to center negative. As I had the case open, my finger bumped against the metal part of the TO-220 voltage regulator - on which there was no affixed heatsink - and I noticed it was quite hot, I thought I'd been shocked.
I wasn't sure if the heat would be a problem with extended use; I knew it was a cheapo eBay buy, so I wouldn't expect proper heatsinking. But I was in an experimental mood, so I thought I might see if I could remedy the supposed problem.
I couldn't find any actual sinks in my parts, but as any good student would, I had plenty of aluminium beer cans in my recycling bin. I cut a rectangle from one and tested its conductivity, could not get anything on either side, and screwed it to the regulator.
It does not make any contact with any electrical pins or other parts, and even though the thermal contact is flaky, when plugged in, the side of the plastic case it is touching does get comfortably warm, so I assume it is doing at least something in the way of thermal conduction.
So, my questions. Should the 9 Volt regulator under full 1 Ampere load, have required a heatsink in the first place? If so, would I be making even the slightest difference with my bodge? And most importantly, is this a hazard in any way shape or form?
AI: Answering your questions in somewhat the same order as you asked:
1) If the device package was running too hot to touch while it was exposed to the open air, it definitely needs better heatsinking than it currently has.
2) By spreading the heat over a much larger surface area that can then radiate to the plastic enclosure, you are helping the situation. As you noted: the plastic case now feels much warmer than it did before you did your modification. That means that you are helping the heat get out of the device.
You may want to add even more surface area to the heatsink if you can do so safely.
3) So long as your aluminum can't short to anything internally and so long as nothing external can touch the heatsink, it should be perfectly safe.
From my point of view, the mod that you did is worthwhile and should greatly increase the service life of your power supply. Good Job! |
H: Design Project via State Space
Design a state-variable feedback controller to yield a 20.8% overshoot and settling time of 4 seconds for a plant
$$G(s) = \frac{(s+4)}{(s+1)(s+2)(s+5)}$$
I am studying Design Project via State Space (Chapter 12 - Norman Nise - Control System Engineering) and I am very doubts about the specificity development that transfer function.
Flux-flow signal:
and the first state space equation:
when I look the E.E plant represented in cascade, I understand all above development, except for this expression:
$$y = \textbf{C}_z\textbf{z} = [-1\quad 1\quad 0]\textbf{z}$$
My question: Why the output variable y doesn't have the following expression, consider the derivative (s+4) like this:
$$y = z_1(s+4) = \dot{z}_1 + 4z_1 = 4z_1 + z_2$$
OBS.: \$ z_1 \$ and \$ z_2\$ are a variable of state.
$$y = \textbf{C}_z\textbf{z} = [4\quad 1\quad 0]\textbf{z}$$
I really really confused how can they find the -1 that vector row in the first place.
thanks for your help!
AI: There is an unnamed node in the flow diagram between \$z_2\$ and \$z_1\$. Call it \$k\$. The equation for \$k\$ can be written as:
\[
k = z_2 - 5 z_1
\]
Then the equation for y becomes:
\[
y = k + 4 z_1 = (z_2 - 5 z_1) + 4 z_1 = -z_1 + z_2 = [-1\quad 1\quad 0]\;\textbf{z}
\] |
H: Fundamental property of an EM wave
Imagine there's an electromagnetic wave propagating in vacuum with a frequency \$f\$ and wavelength \$\lambda\$. Its speed is \$c\approx3\cdot10^8{{m}\over{s}}=f\cdot\lambda\$.
Now, the wave has to travel through a material with relative permittivity and permability \$\epsilon_r\$ and \$\mu_r\$. The speed of the wave will change in the new material, the new speed is$$v={{c}\over{\sqrt{\epsilon_r\cdot\mu_r}}}=f^{'}\cdot\lambda^{'}$$
There are three possibilities to fulfill the equation:
The frequency changes.
The wavelength changes.
Both the frequency and the wavelength change.
My guess is that one of these two properties is more "fundamental" than the other and remains unchanged. Is that assumption correct, and if it is, which is the fundamental property?
AI: The frequency will not change. That's because you state upfront implicitly that the material has relative permittivity and permeability constants \$\epsilon_r, \mu_r\$, i.e. it is linear. There is no way that a linear medium will generate frequencies that are not in the excitation signal. Therefore it's the wavelength that will change.
BTW, in what you say there are a lot of implicit assumptions: not only the material is linear (\$\epsilon_r, \mu_r\$ don't vary with the signal intensity), the material is homogeneous (\$\epsilon_r, \mu_r\$ don't vary with the specific point in space), the material is not dispersive (\$\epsilon_r, \mu_r\$ don't depend on the frequency of the signal), the material is isotropic (\$\epsilon_r, \mu_r\$ are scalars and not tensors - i.e. matrices to put it simple), the material is time-invariant (\$\epsilon_r, \mu_r\$ don't vary with time).
Just to make an example of a non-linear material: the active medium used to generate LASER light. For example, in old LASERS ruby crystals were excited with flashes of light and as a byproduct you got the stimulated emission at a different frequency from the frequency components of the excitation light. Non-linear media can generate/change the frequency of the excitation signal.
Another, more common, example of a nonlinear material is the phosphor coating used to make white LEDs out of blue ones. When hit with the blue light generated by the underlying junction of the LED it will downconvert (convert to a lower frequency) a part of its energy and emit yellowish light, which mixes with the remaining blue light producing white light as a result.
EDIT (to integrate and expand a comment of mine which seems to have helped the OP)
To summarize: there is no "more fundamental" quantity in general. What happens to an EM wave in general can be inferred solving Maxwell's equations taking into account the constitutive relations of the materials involved.
In the simple case of linear, time-invariant, etc., material the frequency happens to be "more fundamental" in the sense that it cannot change, but this fact depends heavily on the properties of the material.
Another example in which you can see how the properties of the material influence the frequency content of the incident wave: a piece of colored glass, say a green window pane. This is a medium which is linear, but frequency-dispersive, i.e. its \$\epsilon_r, \mu_r\$, depend on the frequency. After the incident wave (sunlight) has passed through the window, components with frequency far from the green light frequency will have been greatly attenuated, therefore the frequency content of the emerging light will have changed.
Of course this is not directly related to your example, since you explicitly stated that the incident wave was monochromatic, but I reported it to show you how different the behavior of a material can be depending on the assumptions you make.
As yet another example: have you ever seen one of those American movies where a truck is seen running along the road coming toward the camera from a distance? You'll see the shape of its front distorted and blurred in a random, time-varying way. I guess you know that's the effect of the flow of hot air rising from the road surface. What you may not know is that this is an example of a time-varying material: the air changes its refraction index (i.e. its \$\epsilon_r, \mu_r\$ "constants") with time. Therefore the light passing through it is sort of "modulated" by the material, giving rise to that blurring. |
H: Flexing Peltier Plate (Physical Question)
I am doing research into Peltier plates for a project, which requires a flexible component. From what I have found, no commercially made flexing Peltier plates seem to exist. My question is, what is the science behind this that inhibits flexing plates? Is it just a matter of the ceramic casing that usually houses standard Peltier plates? Alternatively, do flexing grids of flexible Peltier plates exist?
AI: The materials of the individual semiconductor blocks are rigid. I think it would be possible to assemble them on Kapton flex circuits and attach thermally conductive elastomeric pads rather than using the rigid alumina circuits. Performance would probably suffer somewhat, and it could not achieve a very small radius nor could it deform freely like, say, into a hemisphere, as opposed to a cylindrical shape. |
H: SSR selection - how is on resistance related to output IV curve?
I am looking at the datasheet at the link below, and I can't for the life of me figure out what I am missing.
http://www.digikey.ca/product-detail/en/TLP3542(F)/TLP3542F-ND/871299
This is a Toshiba SSR whose on resistance is 100mΩ maximum. There is an on-state I-V curve that shows a current of 0.5A at 25V, implying an on resistance of 50Ω! The problem is, I'm looking for at least 2mA output at 12VDC, and based on that IV plot, I won't be getting it.
I am clearly misunderstanding something here. Please help!
AI: Looks like a typo- Von should be mV, not volts.
Even so, there are small discrepancies between the typical on resistance, the curve you mention, and the Ron-Ta curve at 2A, but not enough to get excited about. |
H: Using Arduino + MOSFET to automate the pressing of button
I am working on using Arduino Uno to automate the pressing of buttons. The configuration to the left is the current configuration and it works fine. However, the configuration to the right doesn't. Could someone help with this matter?
P.S. I've tried using relays and it works, but I don't want to use them because they are too big.
P36N06 Datasheet
AI: The SOT packages can save cost. But if there are multiple pins to be controlled individually, number of FETs required will be 2*No. of encoder pins
Source: MOSFET as a switch? |
H: DAC interfacing with Atmega128
Hope you are doing well and solving all your problems!!!
I am new to hardware programming, facing some difficulties to work with DAC interfacing with Atmega128 board. After searching on internet, could not find any any good tutorial or explanation about ADC interfacing with AVR or Atmega. I have Atmega128 connected to DAC8532 through PD4(ICP1), PD5(XCK1), PD6(T1) and PD7(T2) pins of Atmega. I have no idea how to deal with it.
Please, can anyone help or give some suggestions how to programming it.
Thank you very much.
AI: Software Bit bang is possible. Or, Go for SPI with little changes:
Use only MOSI and SCLK of SPI to connect to DAC.
SYNC pin of DAC can be driven low by a GPIO of MCU, while SPI can be configured to transmit data to DAC.
MOSI pin sends out the data in three consecutive writes along with 24 clocks from SCLK.
Assuming CPHASE, CPOL, and LSB First requirements are taken care of in software before initiating the write. Figure 38 in http://www.ti.com/lit/ds/symlink/dac8532.pdf may help. |
H: Can I run two LED strips in parallel?
I'm considering bying this LED strip for better lighting around the bathroom mirror, but I'd like to cut it into 1/3 and 2/3 and arrange them in parallel. Is that possible with the given parts? Electrically I mean, physically I'm quite capable of soldering and mounting.
I ask because I'm unsure what effect the parallel connection will have on the power supply and light output. I haven't bought the thing yet, but there are no relevant hints on the web shop page.
AI: Yes you can. The LEDs in the strip are in parallel, so you can cut it and use it parallel as well. However, make sure that you only cut at the marked positions. |
H: What are values of fundamental frequency and the harmonics for the below signal g(t)?
We know that a Fourier series formula for any signal $s(t)$ is given as
$$\frac {a_0} 2 + \sum \limits _{m=1} ^\infty (a_m \cos \frac {2 \pi m t} T + b_m \sin \frac {2 \pi m t} T)$$
Here,as we see from the formula ,except the DC component and fundamental frequency components there are all harmonics present at right side of the Fourier series formula.
Let us consider 4 sinusoidal periodic signal $$x(t),y(t),z(t) and g(t)$$ such that
$$x(t)=\cos \frac {1.2*2 \pi t} 8$$
$$y(t)=\cos \frac {1.4*2 \pi t} 8$$
$$z(t)= \cos \frac {1.6 \pi t} 8$$
and
$$g(t)=x(t)+y(t)+z(t)$$
Then,
How would you apply Fourier series formula for a signal $$g(t)$$ which is nonharmonic?
If there are fundamental frequency and harmonics present ,can anybody tell me what are they and their values?
AI: In general, Fourier coefficients are given by the formulas:
$$a_n = \frac{2}{T}\int_{x_0}^{x_0+T}g(x)\cos\left(\frac{2\pi nx}{T}\right)dx\\
b_n = \frac{2}{T}\int_{x_0}^{x_0+T}g(x)\sin\left(\frac{2\pi nx}{T}\right)dx$$
For any integrable \$g(x)\$ on the interval \$[x_0, x_0+T]\$. For periodic functions this interval can correspond to the period of the function, such that the Fourier series will be perfectly equal to the function itself. But the case of your example is very simple - it's just a sum of three cosines, so the \$a_n\$ terms can be calculated directly and there would be three of them. \$b_n\$ would equal to zero, as there is no sine terms. |
H: Wireless amplifier antenna
There is something like an antenna that works like an amplifier, repeating every signal in the device frequency operation range but wireless.
I mean that this "dumb" active antenna receive every protocol and retransmit all, and of course it need some power to do the job.
I know that specific devices can retransmit the signal using the same protocol (WI-FI repeaters) and also I'm aware of Wireless repeater that work connecting RF cable to the amplifier. Obviously this is not the most elegant solution but the environment that I'm working hasn't too much RF signals.
EDIT:
In short I'm searching for a 2.4 Wireless Repeater.
AI: No, there's not a general "receive and retransmit" everything device.
A simple device that tries to do that would also try to retransmit its own signals - instant feedback and the device stops working (possibly with SF movie effects of the device exploding if it had any large amount of power to work with.)
There are repeaters made for various radio systems and protocols, but they always work together with known properties of the signal being used so as to avoid problems.
The simplest example is a repeater for a two-way radio system. There, the repeater "listens" on one frequency and retransmits on a different one (generally, it transmits on a higher frequency than it receives.)
The devices using the repeater then must "know" to transmit on the frequency the repeater "listens" on, and they must also "know" to "listen" on the frequency the repeater transmits on. |
H: input of class E amp
i don't want to lose time on understanding it's theory, i just wanna know what kind of input does it take in, does it take a PWM input like the class D (the one below) ?
or just a ON/OFF signal with the frequency of the output and a duty cycle of 50% and a frequency near it's resonating frequency. since it's a switchmode amp i believe it wouldn't take a sinusuidal input.
here is the class E circuit
AI: In a class E amplifier the input can only turn on/off the switch so the (shape of the) amplitude of the input signal does not matter (as long as it is enough to toggle the switch).
The duty cycle could matter as this will influence the amplitude of the harmonics of the input signal. However a class E amplifier has a limited bandwidth, due to the inductors and capacitors. So my guess is that all harmonics will be heavily suppressed. So duty cycle does not seem to matter !
Then what is left ? Frequency ! By changing the frequency you can apply FM modulation. This is useful as almost all High Frequency / RF amplifiers are used for FM modulated signals.
And indeed class E amplifiers are used for RF / High frequency applications.
So you could feed the class E amplifier a sinewave, however if you would feed it a squarewave with the same frequency, the output of the amplifier should be the same. |
H: can dropped voltage be greater than forward voltage?
What I know is:
forward voltage, Vf = The minimum voltage that is required to start current flow across the LED/Diode
dropped voltage, Vd = The voltage that is used/lost across the LED/Diode.
My question is, initially the equation should be Vf>Vd but can Vd>Vf be true at any moment?
Besides, please correct me if I have any misconception.
AI: Sure, whenever the diode is conducting.
With greater \$V_d\$ the current across the diode increases exponentially, and if it exceeds the maximum the diode can handle, the diode is destroyed.
When the supply cannot sustain the current (e.g. because it is regulated somehow), the system will reach an equilibrium where a slight increase in \$V_d\$ would reduce the resistance of the diode, which in turn reduces \$V_d\$ because the ratio \$\frac{R_{diode}}{R_{supply}}\$ drops. |
H: Extracting and Using Sensor in Camera Assembly of Nokia Lumia 1020
I am trying to use the awesome camera sensor in the Nokia Lumia 1020 for research purposes. Unfortunately, my screen is broken so the screen is completely black. I intend to disassemble the phone, extract the camera assembly out of the phone, and use the camera sensor severed from the phone itself.
Are there means to connect the camera assembly/sensor to my computer? If not, what would be the next easiest alternative in using the camera sensor remotely?
Here are the specifications:
https://www.microsoft.com/en-gb/mobile/phone/lumia1020/specifications/#head_camera
And some pictures of the sensor/assembly itself:
(source: allaboutwindowsphone.com)
(From left: Complete camera sensor, the barrel shift OIS 'mechanism' around the lenses, the side view cutaway, and the sensor plane)
(Bottom most sensor is the Lumia 1020 sensor I'm looking at)
AI: I've never done this, but here's how I would start:
find the data sheet for the camera. If none available, I would find the most similar part with a datasheet available and start with that and learn all you can.
for this camera, make an interposing board with male and female of the camera connectors, and breakouts for a logic analyzer.
capture waveforms during a capture of a bright scene and dark scene
stare at waveforms for a long time.
You should then be able to blindly copy what the phone does to the camera. Then you can use French cafe techniques to figure out what the registers do. |
H: analog error pcb
I am building a scale with a load cell and a INA122 equivalent circuit. When I build it in a breadboard I get very good readings but when I place it on the PCB I only get a -3.8V at the output of the INA122.
The circuit consists of an amplification stage with an equivalent circuit of the INA122, an inverter and a low-pass filter at the end.
AI: I think you're bumping into an input common-mode voltage limit which is described on page 8 of the INA122 datasheet and certainly applies to your INA122-equivalent circuit.
The problem with that configuration is that for certain combinations of gain and input common-mode voltage, A2 (your U1b) is being expected to produce an output voltage that is greater than its supply voltage.
If your load cell can handle a 10V excitation supply, then try connecting it between your Vcc and -5V. It will then produce a common-mode voltage close to 0V instead of the 2.5-ish its probably currently giving and this should keep things within acceptable ranges for this circuit. |
H: Resistors and capacitors calculation for 555 timer circuit
I am new to electronics and I want to try an experiment.
I want to use a 555 timer to create an automatic food dispenser for my aquarium (something like opening a small door when the timer has elapsed) and I need some help in timing here.
To have a configurable amount of time (lets say 6 hrs, 12 hrs or 24 hrs), I understand that I need to modify resistors and capacitors accordingly.
Can you please let me know if there is any standard formula or tool for calculating the resistance value required for my resistors and the capacitance value required for my capacitors in my experiment.
Note: If I am completely wrong with my approach, please let me know a better way for creating an automatic timer. I am completely new to electronics and just got this basic info over the net.
AI: For timing in the hours, and if you really don't want to use a microcontroller, you could consider using something like a CD4060, which contains an oscillator and digital divider chain. You could also use a 555 and a counter such as a CD4040, but the 4060 has it all on one chip.
Here's one example circuit.
If you increase the value of C1 to 2.2uF you'll get 10x the times shown.
You may want to trigger another timer (such as a 555) monostable to provide a pulse for the feeder.
One advantage of the divider chain is that if you want to calibrate the time by using an adjustable resistor (trimpot) you can look at the timing on the earlier divider stages and not have to wait hours for each incremental adjustment of the time.
It's not necessarily impossible to achieve timing in hours with a 555, especially a CMOS type, but it's not very easy or rewarding. |
H: PCB stackup plane distance
What are the main reasons why one would choose one of the following options:
sig
(1") space
gnd
(4") space
pwr
(1") space
sig
comparing with
sig
(1") space
gnd
(1") space
sig/pwr
(1") space
sig
I know the impedance would be better controlled and the loopback would be smaller. But what if I want to use layer 3 for signal and local power planes. Can the GND layer be my reference one? Should I even consider that option?
AI: Well hopefully you don't have 1" spacing between your layers because that's a heck of a thick board :) You can use layer 3 for small local power planes and routing but the consequences I can think of would be the following:
Traces on layer 4 will reference the reference plane on layer 2 if there is no reference plane below them on layer 3. As you say the distance is greater, you won't be able to get reasonably sized traces and maintain the same impedance you have on layer 1. Well unless the over all thickness is very small, but in a 4 layer board it won't be.
Your radiated emissions will increase because your loop area is increased
Traces on layer 3 will reference layer 2
Places where your traces on layer 4 cross your power planes will result in impedance discontinuities and reflections. Depending on your speeds this may or may not be an issue for you. I'd advise avoiding this, and where possible only cross traces on layer 3 and 4 orthogonally (like a plus sign).
Traces from layer 3 and 4 can couple to one another easily so avoid long parallel runs between the layers just as you would on a single layer. |
H: How do i turn multiple usb ports off based on multiple sensors
I'm looking for a way to turn a usb port on an off from an Arduino, I'm looking at purchasing something like this and somehow using a pressure or light sensor to turn the usb port on and off. I was thinking that I could use a transistor or relay to turn the usb port on and off, however, I may need to have many sensors ( maybe 20 ) that turn USB ports on and off, and the Arduino pins would fill up pretty quick. Perhaps there is such thing as a serial or i2c transistor? that way they could all be on a bus of some sort.
AI: I would recommend using a GPIO expander for this. I have used the Microchip MCP23017 in the past for this very setup. This device is a 16 channel programmable GPIO available in either SPI, or I2C (the part number is slightly different for SPI).
You can connect the gpio outputs from this device to N-Channel mosfets with a pull-down resistor to achieve your goal. The best thing about this part is that it is available in a dip package for cheap ($1.44) at DigiKey. |
H: Is it possible to combine multiple 5V USB batteries to power a Raspberry Pi for a long period of time (months)?
I need suggestions or help thinking this problem through. I want to battery power a Raspberry Pi with multiple USB battery packs (for a remote sensing application) with no need to do anything manually. Solar re-charging of one battery is not really an option. I am talking about off-the shelf USB batteries sold by companies such as Anker.
Most USB batteries do not allow simultaneous charging while using a battery, so daisy-chaining multiple USB batteries (with one plugged into the RPi's USB) is tempting, but probably out.
I am wondering if I need to design a charge controller circuit that detects when a given battery is low, then switches instantaneously. Does this sound like my best bet? Is there an off-the shelf circuit or reference design that I should look into for this?
Another idea I had is maybe to connect all the batteries in series. This would of course produce a higher voltage than the original 5V. I could use a step-down buck converter to supply the 5V to the raspberry Pi.
Any ideas or strategies are welcome! Thanks for your help!
AI: A Raspberry Pi model B draws about 1.21W with nothing plugged into the USB ports.
So (say) 3 months is about 2200 hours, so you're talking about 2.6kWh if you want to power it continuously.
A full-size laptop Li-ion battery pack might hold 48 to 80Wh, so you'd need at least 33 to 54 of them.
A 76 lb deep cycle battery might hold 1.2 or 1.3kWh so you might only need a couple of them.
A 5.2Ah USB battery pack might supply 25Wh so you'd need almost 100 of them.
Doesn't sound very practical at all, I'm afraid.
A properly designed low-power microcontroller device can run for several years on a small button cell, waking up briefly and doing things once in a while. |
H: Solving RC filter by differential equation
I'm trying to solve the differential equation of a simple RC filter. What i got so far is:
$$CRV'+V=V_0\sin(\omega t)$$
Solving i get:
$$V == \frac{V_0 \sin(\omega t)}{1 + R^2C^2 \omega^2} - \frac{RCV_0 \omega \cos(\omega t)}{1 + R^2C^2 \omega^2} +c_1e^{-\frac{t}{RC}}$$
Can someone please help me understand how to interpret this with the usual concepts of reactance and impedance?
simulate this circuit – Schematic created using CircuitLab
AI: For steady state sinusoidal response, the exponential term goes to zero and you are left with sine and cosine terms that can be expressed as amplitude and phase angle. The same result can be obtained by using Laplace analysis (replace C with the reactance 1/sC , followed by \$s\rightarrow j\omega\$) to find the steady state response. |
H: Reading and processing 32+ ADC channels at high frequencies
For a project I need to sample 32 or more photoresistors at a time and return an ID and value of the brightest photoresistor over some communication (i2c, serial, etc doesn't really matter to me). I am struggling with how to read so many ADCs at the same time while keeping high return rates (>100Hz would be preferable, but that may be unrealistic).
I've heard that FPGAs can be used for this purpose, but I have limited time and no experience with them. Are there any microcontrollers that have so many ADCs, or do you have any other suggestions? Thanks.
AI: 100Hz on 32Channels sounds very perfectly doable.
Presuming we are talking 8 to 12 bits, that's only 12 * 32 * 100 = 38400 bits per second of sampling work.
Even 16bit or 32bit per channel wouldn't be a huge drain on sampling budget at only 100Hz, but going above 10 to 12bit with an average photoresistor is probably already more than over-engineering, they are not that consistent between two different types that you need single-milivolt accuracy on your ADC.
If you need exact simultaneous you just need a set of 4, 8 or even 16 channel ADCs, no other option for it. If you need "sort of at the same time" there are many MCUs that offer 200kSample/s to 2MSample/s and 8 to 10 channels muxed. If you have 8 channels on your MCU, you can use an analogue multiplexer of 1 to 4 on each channel and make it 8*4 = 32 channels.
If you need to scan 32 channels at 200kSample/s with some settling time in between, let's say 10us, you will be able to scan them all in:
32*10us + 32*(1/200000)s = 480us.
If you need 100 reports per second that leaves 9.52ms between a sample batch, that's almost a factor 20 more than the time it takes to sample them and it will seem like they are taken at the same time, compared to your measurement rate.
I would advise you some exact MCUs, but since I am very strongly Atmel branded, I feel that would be biased/opinion based. But if you want an Atmel, look into ATMega and ATXMega series, they are easy to use and powerful. The ATXMega types offer a lot of bang for relatively few bucks. But Microchip and Texas Instruments surely have $4 ~ $6 counterparts with cheap experimenter boards based around them that you could use, if you feel there's better examples or support for those. |
H: Why is my circuit so incredibly sensitive to electric fluctuation?
I recently finished building a circuit showcased in a beginner’s electronics book. I have included the picture of my creation below because I think it may become relevant to the question.
At the beginning of the build process, the instructions specified to add a "smoothing" 100 microfarad capacitor to be placed right by where the power supply cables were connected to the board. I decided not to bother with that step because I was using a quality power supply so I didn’t think I needed that "smoothing" capacitor (big mistake).
It wasn’t long before I started experiencing weird and inexplicable odd circuit behavior and after a lot of troubleshooting and getting nowhere, it occurred to me to add the smoothing capacitor to the circuit. As soon as I added the capacitor to the circuit the problems went away, but I found myself wondering how is possible that such a capacitor mattered so much given that my circuits uses a measly 50 milliamps of total power and I have what I think is a reasonably good power supply (Rigol DP832).
To make matters more interesting, I decided to move the smoothing capacitor away from the center of the board off to one end of the board and to my surprise the problems began again. Why such a big difference just by placing the capacitor in a different place on the board?
I decided to add a beefier 8200 microfarad capacitor (that is 82 times bigger than the previous one) thinking that this would put an end to all my problems but to my surprise once again, that still did not fix the problem. I actually had to move the capacitor back to the center of the board to make things go back to normal.
That wasn't the only issue, even with the capacitor in "perfect placement", I tried to power a small mechanical relay by using the same power from the circuit and every time the relay triggered my circuit would “reboot”.
So the question is, are all circuits that sensitive to even the smallest change in electric fluctuation? Or is the problem due to my cheesy circuit prototyping skills and an inefficient breadboard?
The IC used in the circuit are:
NE555P (Precision Timers).
CD4026BE (CMOS Decade Counters/Dividers).
AI: The advised capacitor is a long-lead buffer, so to speak.
Even if you had a perfect power supply, the cables that run to your design are far from perfect. And that's not your fault, it's just how cables are. I believe some rapper wrote a song about that... I'm pretty sure it was about cables anyway.
Your cables firstly pick up noise. Secondly they have silly characteristics that you will learn about later at some point in more detail, but basically for high frequency signals (such as digital circuitry makes) they have a very high reluctance to conduct current, possibly even only 50 mA. Those signals are hard to transport over just any cable. You can see it for now as the cables being a bit slow to react. If you switch on a current they will take some time to supply that steadily, so if you switch it often, you'll start to notice a lot of noise on the power supply.
Adding that capacitor will allow your high frequency switching currents to be taken from the capacitor, so the cables can supply just the short-term average, and normal DC leads are very good at short term average near-DC, they can do many amps at that and so can your supply: Everyone happy.
In fact, many design guides for voltage management or voltage regulator chips specify an input capacitor of 2.2 μF, for example, parallel to a dotted 22 μF or larger, with an asterisk saying "if the incoming power cables are longer than X or Y, regardless of power supply used, add the 22 μF (or more) capacitor for stability and better noise rejection".
It may even be better to keep the 100 μF capacitor, because the 8200 μF capacitor will have a larger internal resistance, unless it's also much, much larger physically. The internal resistance of a capacitor determines how good it is at taking away the ripple of low-current high frequency signals. Smaller is better in most cases with first input capacitors like this one. But, with voltage regulators, that doesn't always apply for all input/output capacitors, so once you get to those beware! But that's not for now.
You can be happy about not everything being this sensitive, slowly switching or high frequency digital alike, there are many robust things that are much less sensitive to reboots, but it is often still a very good idea to add some capacitance if a board or design is powered with wires or sometimes even through a connector between boards. It doesn't always have to be as large as 100 μF, but a little to take the edge off (pun for the more weathered reader intended). Having no noise to work with is always better than having to work with noise.
The reason the capacitor between the power wires and the circuit works better than the circuit between the power wires and the capacitor is because the trace inductance (whether it's a PCB or bread board) will limit the response of the capacitor, if you then have power wires nearby, your circuit will ask them to supply some of the current as well, which will cause the same kinds of dips, but possible in a lower order. You are already basically putting your switching noise onto the cables and the cables already react to it. When your noise sees the capacitor first, even with some inductance in the traces, the noise will not go into the cables and not cause any further problems, which reduces the noise your circuit sees by a much greater factor.
Edit: Note: The above about capacitor position is severely simplified in some respects, but it generally conveys the idea well enough. To clarify it should suffice, but there are many dynamics to things like this. In later years looking back, you may find this to be a bit lacking. But you don't need to know all that right now. This will do.
The reason with a relay and a capacitor and shared power things go wrong, still, is because the current spike of your relay is too large for the capacitor to help with and then the cables can't keep up either, or because the relay release creates a voltage spike. A solution could be, if your design can handle a diode-drop:
simulate this circuit – Schematic created using CircuitLab
D1 prevents anything powered by the DR832 from stealing power from your digital buffering capacitor C1. D2 prevents the relay from making any significant noise on your supply and D3 catches any power spikes the relay still makes when you turn it off. |
H: How does this button work without any circuit closing device?
This may be a stupid question, but I have searched online for a little bit and can't seem to find my answer. I am working on a circuit board that uses buttons that i've never seen before. These buttons just have a metal lead around them and an LED in the middle (for lighting up the button I'd assume) but how does a button like this even work? I've attached some pictures to show you what i mean.
this is the back of the push buttons from the device
AI: The gold plated interlocking concentric "rings" are two contacts of a switch.
When they are electrically connected by a resistance of less than say 10 k Ohms the circuit is activated.
The white "rubber" has a conductive ring on it which is close to but not touching the gold contacts - it is probably held clear by small protrusions in the rubber moudling. When the rubber is pressed from above it presses the ring onto both contacts and closes the circuit.
The conductive material is often made of a conductive ink or similar which may be loaded with carbon particles to make it conductive. |
H: "DB" data directive explaination
What exactly is initialization of code memory IN 8051? Does the db directive command DB "SAM'' burn data into ROM location?
WHAT DOES INITIALIZING WITH A BYTE VALUE MEAN ?
I am all confused?
I am programming assembly in 8051!
AI: Yes, it literally puts those bytes into memory. There is no difference between bytes from code and bytes from data, both look exactly the same. The only difference is in how you use them. |
H: How do I know current across unknown load if I know voltage
If I know voltage across a load, but don't know load resistance, how do I know current going through load?
Do I put a resistor of 1K and calculate?
My voltage is square wave so multimeter only get average current. I want current square wave
AI: Serial resistor is OK, but it should be several orders of magnitude smaller than the load, so 1k is a little surprising. Also i would measure with oscilloscope instead relying on average and recovering peak out of it. And the best part: you cand use DC instead your square wave, just put external voltage source.
More generally there is a four - point measuremet method. You take two DVMs: one for current and one for voltage. It's normally used for power metering, but also for accurate resistance metering too. |
H: Are capacitive display(s) capable of measuring what fraction of a finger is touched?
I'm really curious to get an answer for this question. Since I don't know the functioning of a capacitive display and Google didn't help me on this issue, I landed here. :)
Are capacitive displays used in most modern phones capable of measuring relative fraction of the finger being touched? For example, if I touch the screen and then apply pressure gently, will the system be able to make out the increase in the surface area of contact?
AI: A projected capacitance touch screen like the type in your phone is quite capable of creating a reasonably detailed map of the areas of the screen that are covered by your fingers. You could definitely use this to infer the amount of pressure being applied by looking at the contact patch size, and indeed this is apparently how Apple's Force Touch on the watch works (note, the Macbook's new trackpad has actual force sensors on each corner). However, you can probably imagine a lot of issues with making this work reliably, as everyone's fingers are different sizes, and you don't always touch the screen with the same part of your finger.
Another thing is that you can tune the sensitivity of a touch screen so that it can detect objects nearer or further away (which is how glove mode works on some phones) but then you lose the ability to differentiate the actual contact patch of a finger. It may be that Apple is using a sort of analog sensing system where they can infer the contact patch and the part of your finger that is slightly above the surface by actually measuring the amount of projected capacitance rather than just apply a threshold. Unfortunately you would not be able to do anything like this without your own hardware. |
H: How to make arduino GPIO to operate at 3.3v instead of default 5v
I am working on a project, I use arduino mega 2560 with system operating voltage of 5v, at the same time I have a Bluetooth module which operates at 3.3v is there any way to reduce my arduino output voltage without any external component such as resistor, ic etc
I saw the following statement in arduino website but couldn't understand,
"IOREF. This pin on the Arduino board provides the voltage reference with which the microcontroller operates. A properly configured shield can
read the IOREF pin voltage and select the appropriate power source or enable voltage translators on the outputs for working with the 5V or
3.3V."
AI: AVR 2560 output are not 3V3 tolerant (for input) and you cannot internally change voltage level (output) unless you reduce Vcc to 3V3 (which reduces max. crystal frequency). You need employ level shifters. I prefer 74LVC125, 74HCT125 ICs. |
H: Will (LiPo) batteries draw current/voltage between packs if main lead is disconnected?
Never learned this stuff in school (electrician study) oddly enough.
But if you serial up 4 batteries (3S LiPo's x4 to be specific), and you switch off the main leads to the power bank..
Will the batteries still draw/distribute load in between each other?
I know the loop is broken but for some reason the one thing that got stuck in my head is that batteries - lead will always try to balance out it's internal overcapacity of electrons vs protons, and if one pack has more protons and still have a negative lead connected to it's positive, will those two packs balance each other out?
I apologize for the noobish question, but it's out of concern for battery safety!
AI: With just the batteries? Nope. Current can only flow if the loop is closed.
BUT!
With LiPo batteries there is often a control board, they will at least still use a tiny amount of power (in the order of micro amperes usually). Some more advanced technologies can actually actively balance cells while in use or while charging, Linear had a nice chip that does that. In such a case a little while after you switch it off, it may keep currents flowing around between the batteries to balance them for a tiny while after. But those packs will be very rare.
So simply put: If there's electronics in there, anything could be happening, if there isn't, then loop broken means no current anywhere, ever. Although with LiPo it's very smart to have electronics at least for per-cell protection.
(Except for a battery's inherent self-discharge, but that's a current that flows inside each cell, so that still doesn't affect other cells in the chain and that is extremely low for Lithium types.) |
H: Current sense driver feedback line
Is the current sense feedback dependent on how the driver is controlled, PWM or discrete signal.
Will the reading on ADC input differ when controlled by PWM, as we have a duty cycle?
For example if ADC sample rate is big enough is there a possibility we capture the 0 in the PWM period, so we get very variable values through the ADC?
AI: For example if ADC sample rate is big enough is there a possibility we capture the 0 in the PWM period, so we get very variable values through the ADC?
Yes. There are several solutions:
First, where is your current measurement shunt? If it is in series with the load, then it will measure current all the time. But if it is in series with one of the MOSFETs, it will only measure when current flows through it, ie when the MOSFET is ON. The rest of the time there will be no current through the shunt so so voltage across it. This can be used to lower dissipation in the shunt. For example if you make a buck converter with a low duty cycle, you can put the shunt in series with the top FET, which makes shunt dissipation proportional to duty cycle.
If you want the ADC to measure average load current, then you need to put the shunt in series with the load. Otherwise, if the shunt is in series with one of the FETs, you'll measure average current through the FET and not the load. This is a problem if an inductor or inductive load is involved (ie, switching converter, motor, etc). If you use simple PWM in a non-inductive load, then the current in the FET is the same as the current in the load, and it makes no difference where you put the shunt.
Then you need an anti-alias (lowpass) analog filter and set ADC frequency high enough. It's the same as sampling any other signal, frequencies above Fs/2 are folded back in the wrong place, see sampling theory.
If you want instantaneous load current to use in a feedback loop, then the delay introduced by this filtering will be a problem as it will introduce phase lag in your feedback loop. In this case you have to synchronize the ADC sampling time with the PWM. Most microcontrollers with PWM and ADC have hardware for this. When the ADC always samples at the same point of the PWM, usually right after one FET turns ON, then the current ripple won't appear in the ADC results. You'll get instantaneous current.
But you won't get average current. If there is an inductor, current is a sawtooth waveform, so if you always sample on the peak you'll get peak value, etc. And if you use simple PWM on a non-inductive load, to know the average current you have to multiply this instantaneous current value by the duty cycle. |
H: Any physical barrier to read an HDMI input?
I'm considering coding a software that would read data sent from a device (game console, computer, ...) via HDMI. The program would then be able to display the shared content inside a window, which would make it possible to use a laptop screen as a monitor. More info on what I'm trying to do here.
I'm aware that an HDMI-out port of a laptop can't be used to retrieve data. I would rather use an USB port, with potentially a HDMI to USB adapter.
My question is : Is there any physical barrier blocking me from retrieving an HDMI output from USB port, manipulating it in my program to somehow display it on screen ?
In my mind, this should just be some transfer of bits. With the right protocol understanding, my program should be able to retrieve the data one way or another. But I must admit my knowledge of HDMI and hardware is really limited. Any redirection to web content, doc, tutorial or blog would be greatly appreciated by the way.
Thank you.
AI: Yep, I learnt about it but I wonder why you have to get through such cards instead of just having an appropriate software on your computer...
USB is a complex bidirectional protocol implementing a bursting bus with host arbitration. HDMI is a complex, multi-lane unidirectional protocol.
They electrically aren't related to each other.
You need special hardware, including buffers, and packetization, to make that work.
Software is exactly that: instructions you run on a processor of sorts one data that has already been acquired by specific hardware. USB is not specific hardware for HDMI signals. They simply aren't compatible in any way.
with potentially a HDMI to USB adapter.
so, yeah, you need one of these commercially available devices. |
H: Building NOT gate with transistor -- output remains always high
I'm following this tutorial to build a NOT-gate using a transistor (using slightly different parts).
The issue I'm seeing is the following: when no voltage is applied to the base of the transistor, then current flows, normally, through the path including the collector (as it should). However, when voltage is applied to the base, then current still flows through the path of the collector (should not). In other words, I always get high output, no matter what.
Question: I would like to find out is what I'm doing wrong, or what is wrong with my (still very limited) understanding of how the circuit should work.
Summary of what the tutorial says (in case the link dies later)
This is the circuit we are trying to build:
simulate this circuit – Schematic created using CircuitLab
This is how it is supposed to work (in my understanding):
If SW is open, then current flows like this: +6V -> R1 -> LED1 -> GND
If SW is closed, then current flows like this: +6V -> SW -> R2 -> B->E -> GND (In other words, no current flows through R1 and LED1).
Circuit I built
My circuit is slightly different, because I have different parts (in particular, I don't have any jumper cables yet), and also because I added some extra leds to try to "debug" the problem. I realize that these extra leds add more resistance (and previously I was using real resistance, where tutorial said to use a jumper cable), but I'm not sure if that matters or not.
This is the circuit (I think) I built:
simulate this circuit
And this is what is happening:
When SW is open then only LED3 is lit up (as expected)
When SW is closed then all three leds are lit up (LED1 and LED2 should be, but LED3 should not). In other words: the base has voltage (because LED1 is lit up), the current is flowing through B->E (because LED2 is lit up). However, the current is still flowing through +9V -> R3 -> R4 -> LED3 (because LED3 is lit up -- it shouldn't be).
(N.B.: I was seeing the same problem even before adding the extra "debugging" LED's, i.e. LED3 was always lit up, independently of the state of the switch.)
Pics of the board
Open switch:
Closed switch:
Research
This answer (to the related question) seems relevant.
In particular:
What you have done is connect the emitter to ground, and the collector
to ground via a resistor. You have then applied a voltage to the base.
Yes, I did the same, with the exception that I connected the emitter to ground through a resistor (either the LED2 or the 220 Ω resistor I was using before due to the lack of jumper cable -- I'm not sure if that matters, though).
However in your case, the collector is not at a higher potential than the base, it is at a lower potential. [...]
You now have current flowing from the base to the cathode, through the resistor to ground, thus the mysterious current flow is identified.
Could this be the reason in my case too?
I don't know how to calculate the potential at the collector, and at the base, but I compared my circuit to the one of the tutorial, and these are my conclusions:
The voltage of the battery is higher in my case (9 V vs 6 V), but I don't think it matters.
The resistances are lower (440 (=220+220) Ω vs 1 kΩ), but they are the same on both branches. (I.e.: tutorial has 1 kΩ both on collector and base, I have 440 Ω both on collector and base).
Also, I tried to increase the resistance for the collector, to 880 Ω (with two extra resistors), still the same result.
One more thing: I'm fairly sure that I connected the transistor the right way, but I tried the other way round too, just in case (same result).
AI: If SW is closed, then ... no current flows through R1 and LED1.
Not quite. Current always flows through R1, but when the transistor is switched on, all of the current flows through it, and since the collector voltage is now less than the LED's forward drop, no current flows through the LED.
When you inserted LED2 in the emitter lead of the transistor, you made it impossible for the transistor to pull its collector low enough to "short out" LED3. The emitter voltage is now equal to the forward drop of LED2, and the collector voltage is a few hundred mV above that.
If you take out LED2 and connect the emitter to ground again, the circuit will work as expected. |
H: Is it dangerous to use an ungrounded USB C charger to charge a laptop?
I have a laptop (with an aluminium case) that charges via USB C. The original power brick is 95W (but uses 60W charging in standard mode if I don't enable fast charging in software) and it has a standard CEE 7/7 plug.
When I travel or am in another room, I use a small unofficial multiple-output charging brick, rated 60W on the usb C output, which doesn't have grounding, only the standard 2 pin plug (CEE 7/16 Europlug).
[After a few weeks] I noticed that I get very small electric shocks when touching the corners of the laptop case with the forearms and also the touchpad had weird responses and ghost touches when using it but only very rarely. Today I realised this only happens when using the other, non grounded charger so I pulled out the digital multimeter and I get around 20V AC between the laptop case and my hand (with small jumps to 40V). DC reads are almost zero, probably within reading error (~0.4V). This doesn't happen with the original charger so my guess is that it's related to the lack of grounding, is this correct?
My main question is: is this dangerous for the device? Should I stop using the secondary charger completely? Should I only use it when not touching the laptop? Or is this normal for a low power device and grounding is not needed/mandatory?
AI: Not likely to be dangerous to humans, but to devices if connected together.
Yes, it happens because it is designed to be connected to ungrounded socket, and for electromagnetic compatibility reasons it contains common-mode capacitor between unisolated mains side and isolated low voltage output side which weakly couples mains to laptop.
And yes, this is quite normal for power supplies which use ungrounded inlet. Especially no-name cheap ones can be so terrible you can't touch a device with metal case.
It should not be dangerous, and as long the laptop is only connected to charger there is no problems. But there is a chance that while the charger is connected, connecting it to another device like a grounded monitor there can be high potential difference when the connectors touch, and the capacitor discharge current can be so high you see small sparks. The connector must be good quality and hot pluggable so the voltage difference or discharge current does not go via data pins as it can do permanent damage.
Basically, almost all manuals of devices with ungrounded 2-pole plugs instruct to disconnect mains plugs of devices being connected, so I would do the same here so nothing breaks. |
H: what is the easiest way to make a gate that detects if something passes through a gap?
I have a home project with a device with an opening that is about 20cm (8 inches) wide. I want to attach two sensors on the sides of the opening, such that if an object passes between them, a switch is shorted (either momentarily and then disconnected, or as long as the object stays in between).
What is the easiest way to do this?
I am a software engineer but I work "close to the metal" - I am reasonably good with EE: I can solder, use meters, put together my own computers from parts. If you tell me what the method is and what the required parts are, I can probably figure out the connections required.
The objects I want to detect passing, are big, at least a quarter of the size of the opening - 5 cm, and they do not move quickly - they may spend at least half a second moving through the opening.
False positives - I can have them occasionally, say once an hour. False negatives are less OK - I would like to have, say, less than 10% chance of non-detection.
The thing is on a balcony shielded from rain, sometimes it is very dark, sometimes it is sunlight.
The objects are cats :) The device is a litter robot, which, while otherwise a perfect device, suffers from one stupid design choice, where a cat depresses a spring upon entering, which is highly unreliable - sometimes the spring gets "stuck" and won't depress, sometimes it stays depressed all the time, and this varies even if the spring is not adjusted and is kept clean. Detection of cat passing through the opening by means of tripping an electronics sensor would be far preferable.
I guess a single "Proximity sensor" that detects a moving object within 20cm or 8 inches, that was not there before, would be good.
AI: The objects are cats :) The device is a litter robot, which, while otherwise a perfect device
If you constrain the opening at least vertically, it should be possible to arrange an optical path across the opening such that the cat's body must entirely block it at some point in the entrance. Cats will actually fit through quite small openings (if they want to) so you could even constrain the opening in width as well as height, but there's no real need to, since a break-beam system can easily cover far more distance than you need. Even with the existing opening you can probably just put the beam at a height to be broken by the center of the cats body during normal walking... they're clever creatures but they probably haven't paid enough attention that time you streamed "Mission Impossible" to hit on trying to slither underneath it in order to stealth a stinker. If there's any aversion to the "robot" give it a ten minute delay so it doesn't activate while the cat is still nearby.
In terms of actual components, you'll want to use an IR LED toggled on and off at 38 KHz, and a matching receiver which looks only for that, and ignores ambient light. Typical receiver modules also include an AGC as they are looking for bursts of pulses (eg from a TV remote) so you'll either need to get a receiver without AGC, or else have your transmitter output a series of 38 KHz pulses, give a gap, then another series so that it looks not unlike a TV remote control signal - try something like 5-10 pulses, then a gap of the same amount of time. Such a pattern is easily implemented in a small MCU, which can also help with the detection rules. So basically you have something along the lines of an "Arduino project" (/ATtiny, Cortex M0, MSP430, whatever) to pulse the LED, monitor the receiver, and then probably activate a small relay to trigger the mechanism (unless you can reverse engineer its circuitry enough to drive directly).
You'll also want to build a sort of tubular shield around the emitter and detector to make sure they only see each other directly through the a narrow region of the center of the path to be occupied by the cat.
where a cat depresses a spring upon entering, which is highly unreliable - sometimes the spring gets "stuck" and won't depress, sometimes it stays depressed all the time, and this varies even if the spring is not adjusted and is kept clean.
You could also consider some sort of flap, and detect movement of the flap optically or magnetically rather than by means of electrical contact to avoid the flaws of the present "spring"
There is another option overlooked, of detecting the cat inside the litter box. If the box is tall enough, that is the place you could potentially put an ultrasonic sensor, by having it inside looking down, but due to ringing issues these have a minimum detection distance which you may or may not be able to achieve. Such a method would definitely point to software interpretation - you need software range-gating to ignore the floor of mounded litter, and see the cat as a closer reflection; then you probably also need to entirely ignore the situation for a bit after triggering the cleaning mechanism, so you don't re-trigger off that. As mentioned in comments, the response of the cat to an ultrasonic system should be evaluated before committing to such a path. At the cost of higher power, identifying a cat inside the litter box (or at least a "blob") should also be well within the capability of computer vision algorithms watching a webcam given suitable IR illumination.
If you had an ultrasonic system with direct software signal interpretation of the received signal, then you could fire it out the door and look for a reflection from an approaching cat in addition to the spurious one from the door aperture. But the cheap "Arduino project" modules just give you the output of the first strong reflection, and you may have a lot of trouble making the door aperture not be that. Doppler ultrasound could work, too, but again points to having a far more custom circuit where you can actually see the analog response, and not just get an pre-(mis)interpreted output as from a little HC-SR04 module. One advantage of detecting the cat inside the box is that you have longer to do it, so you could have a battery powered system which polled at a much lower rate to preserve battery life, but designing systems which are truly low power without unintended power drain when they are supposed to be asleep is practically far more tricky than it first looks.
Microwave doppler motion detects exist, too. Getting one to see the cat would be easy; the problem would be having it not see far beyond the enclosure to say tree branches swaying in the wind. And doppler radar just loves fans of any sort... was testing a module and couldn't figure out why the output was incessant, until I looked up at the slowly rotating ceiling fan. |
H: Question about setting the MPPT on BQ24650
I have a question about the MPPT in BQ24650 chip.
It has the MPPTSET pin that need to get 1.2v because the inside comparator.
According to the datasheet, on page 13 section 8.3.2, they say:
When the voltage sensed on the MPPSET pin drops below 1.2 V, the charger maintains the input voltage by reducing the charge current. t. If the MPPSET pin voltage is forced below 1.2 V, the BQ24650
stays in the input voltage regulation loop while the output current is zero
And on the other hand on page 18 section 8.3.18 they say:
MPPSET is used to disable or enable the charge process. A voltage above 175 mV on this pin enables charge. A voltage below 75 mV on this pin also resets all timers and fault conditions
My question is if the MPPTSET pin, senses a voltage so 175mv < Vmpptset the charging is enabled.
But they also say that if Vmpptset < 1.2v, the output current will be zero. and the batteries will not charged.
What will happen when 175mV < Vmpptset < 1.2V? the charge will be enabled and output current is zero?
It seems a bit weird or Im missing something..
AI: That's not what it says.
With Vmpptset < 1.2V, (but > 175mV) it will try to maintain the input voltage at (some setpoint defined somewhere) by reducing the charge current. If even reducing the current to 0 isn't enough to maintain Vin, it will stay in that state (but fail to maintain Vin).
So what happens is that it will keep trying to charge, but at a lower current than the current setpoint, as long as Vin remains at the voltage setpoint. But if there isn't enough sunlight to maintain Vin even with 0 current, it will remain in that state but at 0 current, waiting for more light.
Or
A voltage above 175 mV on this pin enables charge
Charge is enabled, but what you get depends on the available current. But if there's not enough sunlight even to maintain Vin (at that setpoint) at 0 current, there's not a lot it can do.
This is not really MPPT as generally understood (the "T" means Tracking whereas this follows a pre-determined path): a poor man's MPPT if you will. I've seen a bunch of really cheap Chinese charge controllers that claim "MPPT" : presumably they use this chip or something similar.
Reading it a little further, the setpoint is defined by a voltage divider connected to MPPTSET. So if your solar panel claims its MPPT point is at (say) 16V at standard illumination, set the voltage divider to produce 1.2V from 16V.
Above 16V from the solar cell, you'll get constant current, to protect the battery.
Below 16V (1.2V at MPPset) a simple voltage divider will give you whatever current is available that keeps the cell producing close to 16V as long as Vin > Vbatt.
You could manipulate MPPset to try and discover the real MPPT; that would require external electronics, but may increase charging current by a few % in poor light.
Also note discrepancy between "To disable charge, pull MPPSET below 75 mV." on p.4 and 175mV on figure 8.2 p.12.
8.3.2 p.14 explains this as 100 mV hysteresis, 75mV to stop charging, 175 mV to restart. |
H: How do I find the Millman theorem in this op-amp circuit?
So I have this circuit and I want to find the millman theorem of it. I started with it and I got here.
I have E2 connected to the ground and E1 connected to a voltage source V1. So V+ = V1; and V- is where i got confused a little bit. So when I want to find V-, I have on the numerator ((0/R + Vs/R0 + Vs/R1 + Vs/R2) / (1/R + 1/R0 + 1/R1 + 1/R2))
Is that right? Is that what I should do or not?
AI: Well, we are trying to analyze the following circuit (assuming an ideal opamp):
simulate this circuit – Schematic created using CircuitLab
When we use and apply KCL, we can write the following set of equations:
$$
\begin{cases}
\text{I}_1=\text{I}_2\\
\\
\text{I}_4=\text{I}_2+\text{I}_3\\
\\
\text{I}_4=\text{I}_1+\text{I}_3
\end{cases}\tag1
$$
When we use and apply Ohm's law, we can write the following set of equations:
$$
\begin{cases}
\text{I}_1=\frac{\text{V}_\text{b}-\text{V}_1}{\text{R}_1}\\
\\
\text{I}_2=\frac{\text{V}_1-\text{V}_3}{\text{R}_2}\\
\\
\text{I}_3=\frac{\text{V}_2-\text{V}_3}{\text{R}_3}\\
\\
\text{I}_4=\frac{\text{V}_3}{\text{R}_4}
\end{cases}\tag2
$$
Substitute \$(2)\$ into \$(1)\$, in order to get:
$$
\begin{cases}
\frac{\text{V}_\text{b}-\text{V}_1}{\text{R}_1}=\frac{\text{V}_1-\text{V}_3}{\text{R}_2}\\
\\
\frac{\text{V}_3}{\text{R}_4}=\frac{\text{V}_1-\text{V}_3}{\text{R}_2}+\frac{\text{V}_2-\text{V}_3}{\text{R}_3}\\
\\
\frac{\text{V}_3}{\text{R}_4}=\frac{\text{V}_\text{b}-\text{V}_1}{\text{R}_1}+\frac{\text{V}_2-\text{V}_3}{\text{R}_3}
\end{cases}\tag3
$$
Now, using an ideal opamp, we know that:
$$\text{V}_+=\text{V}_-=\text{V}_\text{a}=\text{V}_1$$
So we can rewrite equation \$(3)\$ as follows:
$$
\begin{cases}
\frac{\text{V}_\text{b}-\text{V}_\text{a}}{\text{R}_1}=\frac{\text{V}_\text{a}-\text{V}_3}{\text{R}_2}\\
\\
\frac{\text{V}_3}{\text{R}_4}=\frac{\text{V}_\text{a}-\text{V}_3}{\text{R}_2}+\frac{\text{V}_2-\text{V}_3}{\text{R}_3}\\
\\
\frac{\text{V}_3}{\text{R}_4}=\frac{\text{V}_\text{b}-\text{V}_\text{a}}{\text{R}_1}+\frac{\text{V}_2-\text{V}_3}{\text{R}_3}
\end{cases}\tag4
$$
Now, we can solve for \$\text{V}_2\$:
$$\text{V}_2=\text{V}_\text{a}\cdot\left(1+\frac{\text{R}_3}{\text{R}_4}\right)+\left(\text{V}_\text{a}-\text{V}_\text{b}\right)\cdot\frac{\text{R}_4\left(\text{R}_2+\text{R}_3\right)+\text{R}_2\text{R}_3}{\text{R}_1}\tag5$$
Where I used the following Mathematica-code:
In[1]:=V1 = Va; FullSimplify[
Solve[{I1 == I2, I4 == I2 + I3, I4 == I1 + I3, I1 == (Vb - V1)/R1,
I2 == (V1 - V3)/R2, I3 == (V2 - V3)/R3, I4 == V3/R4}, {V2, V3, I1,
I2, I3, I4}]]
Out[1]={{V2 -> ((R3 + R4) Va)/R4 + ((R2 + R3 + (R2 R3)/R4) (Va - Vb))/R1,
V3 -> ((R1 + R2) Va - R2 Vb)/R1, I1 -> (-Va + Vb)/R1,
I2 -> (-Va + Vb)/R1, I3 -> (R1 Va + (R2 + R4) (Va - Vb))/(R1 R4),
I4 -> ((R1 + R2) Va - R2 Vb)/(R1 R4)}} |
H: What type of op-amp configuration is this?
If you need more info I will provide it. The op-amp board is piggybacked on an inverter driver board.
AI: This is a DC balance integrator for a full-bridge driver to null the DC offset, but it is prone to saturate unless it has large resistive feedback to limit the DC gain. Also, the Vin+ should also have 100k in series to null Iin offset.
This is one of the worst readable "pretty" logic diagram that I have ever seen in 50 years. Simply put, it is illogical.
The draftsperson needs to be trained on how to draw circuits that any engineer can read (skilled in the arts of electronics in any country).
There are many other ways to use this as well if you know the allowable input Vcm range and expected output. |
H: How would I find the transfer function of this circuit?
I know that I can take the inductor and resistor and find the impedance from them in parallel. But what do I do with the resistor, R3? Do I need to do a nodal analysis and solve for the Vout? Or can I say that no current flows through R3 because the circuit is open, and then use just the R1 and L || R2 values in my calculation of Vout?
AI: Redraw your circuit with a load impedance \$Z_{load}\$. If the output circuit is truly open, then \$Z_{load}\to\infty\$ and the following results will still be valid.
simulate this circuit – Schematic created using CircuitLab
Node equations:
$$
\begin{cases}
\frac{v_x-v_i}{R_1} + \frac{v_x}{j\omega L} + \frac{v_x}{R_2} + \frac{v_x-v_o}{R_3}=0 \\
\frac{v_o-v_x}{R_3} + \frac{v_o}{Z_{load}} = 0
\end{cases}
$$
$$
\begin{cases}
v_i = \left(1 + \frac{R_1}{j\omega L} + \frac{R_1}{R_2} + \frac{R_1}{R_3}\right){v_x}-\frac{R_1}{R_3}v_o \\
v_x = \left(1+\frac{R_3}{Z_{load}}\right)v_o
\end{cases}
$$
$$
v_i = \left(\left(1 + \frac{R_1}{j\omega L} + \frac{R_1}{R_2} + \frac{R_1}{R_3}\right)\left(1+\frac{R_3}{Z_{load}}\right) - \frac{R_1}{R_3}\right)v_o
$$
$$
T(j\omega)=\frac{v_o}{v_i}= \frac{1}{\left(1 + \frac{R_1}{j\omega L} + \frac{R_1}{R_2} + \frac{R_1}{R_3}\right)\left(1+\frac{R_3}{Z_{load}}\right) - \frac{R_1}{R_3}}
$$
Up to you to simplify further. The open circuit case makes \$R_3\$ irrelevant:
$$
T(j\omega | Z_{load}\to\infty)= \frac{1}{1 + \frac{R_1}{j\omega L} + \frac{R_1}{R_2}}
$$ |
H: Op-Amp current sense in H-Bridge
this is my first attempt ever at building an H bridge for brushed DC motors. The board is controlled externally with an Arduino that sends the EN and PWM signals. I also need to measure the motor current to do torque/current control.
For current sensing I decided to adopt low-side sensing with shunt resistor (10mOhm) and op-amp in non-inverting configuration to amplify the voltage drop.
The bridge-part of the board works quite as expected, I'm able to move a dc motor in both directions with varying duty cycle, but I have 2 problems:
Not crucial, but I noticed that the Green LED (I put it in order to signal that the board is powered) turns on even when the VBATT is disconnected if I apply the EN signal from the Arduino, and I really can't understand why.
Current sensing is not working. When I just power the circuit with a DC power supply I have 0.08A drawn by the op-amp. If I remove the IC, the current goes to 0. If I apply PWM, at 0.27A drawn from the supply (of which 0.19A = 0.27A-0.08A are due to the motor) I have:
1.9mV across the shunt resistor (which is reasonable, at 0.19A * 10mOhm)
1.9mV on the opamp non inverting input (of course)
0.42V on the opamp inverting input (?). This value is more or less fixed varying duty cycle.
10.63V on opamp out (?). This value is more or less fixed varying duty cycle.
Moreover, the op-amp gets rather hot in few seconds.
I already double checked the pcb for shorts or wrong connections.
To measure I'm using a multimeter since at the moment I don't have an oscilloscope at hand, planning on buying one.
So the questions are:
Why is the green LED turning ON when it is not supposed to
Why is the op-amp amplifier not working as expected
If possible, some recommendations on better ways/components for current sensing.
PS. At the moment I considered only through hole components for ease of soldering, but for future versions I will probably consider also SMD components.
AI: Why is the green LED turning ON when it is not supposed to
Failure to recognize ESD input clamp to Vdd is powering up the 12V rail with logic input voltage. ( bad idea and cause for latch-up fault possible)
Why is the op-amp amplifier not working as expected
Failure to read datasheets V common mode input range is +/-12 for +/15V supply (meaning required input must exceed bottom rail by 3V for biasing.
If possible, some recommendations on better ways/components for current sensing.
Use equal balanced resistors to shift both inputs near V/2 and achieve same gain.
choose Rsense for approx 50mV full scale for worst case locked rotor current. due to power dissipation. Usually choose Pd of R at 50% of rated value for ~70'C rise.
-Consider braking current (BEMF) is negative , consider Vout=idle at Vref/2 to measure bipolar currents, if you want otherwise not
Consider CMOS OA for Rail to Rail input and output but observe ESD precautions and latchup protection of moving motor and power off then ON |
H: Is this MOSFET upside down?
I'm looking at existing circuits and trying to understand them so I can design my own. Also to improve my electronics knowledge, for some reason MOSFETs have never quite sunk in for me.
I came across the circuit for this board (the files from here (Rev D)) which the company are gracious enough to share.
Please educate me if I am wrong but is this MOSFET upside down? I know it is a PMOS as the arrow from the gate is facing outwards, and that the arrow/diode connects to the source so the source is at the bottom and the drain is connected to VBAT.
My thinking of their intention is for the 100k R to be a pull-down and that when VBUS is not present, the gate is pulled low, switching on the MOSFET and connecting the VBAT to the LDO.
When the VBUS voltage is present, the gate would be pulled high, turning off the MOSFET, disconnecting VBAT from the circuit so it can be charged.
However for that to be true I believe the PMOS source should be connected to VBAT and the drain should be connected to the load - the LDO? This would also result in the body diode facing upwards, conducting towards Vdd as it usually does.
As a bonus question, when VBUS is connected wouldn't it be wasteful constantly dropping a voltage across the 100k resistor (the left one)?
AI: It is correct. You normally see PMOS connected like this to act as a reverse-polarity "diode".
simulate this circuit – Schematic created using CircuitLab
It has much less voltage drop than an actual diode and will protect currents from flowing the wrong way when the voltage is connected between the battery terminals are connected in reverse.
It will NOT protect against the load pushing current back towards the source like a real diode will. That requires additional circuitry to accompany the PMOS.
When power is connected the correct way, the parasitic-diode gets current flow started which produces a voltage drop across the load, and this voltage drop appears across the gate-source which turns the MOSFET on. At this point the current flows through the source-drain of the MOSFET rather than the parasitic diode which results in low voltage drop.
When power is connected in reverse, current can't flow through the parasitic diode, and with no current flowing through the load, the voltage drop across the load is zero which also means the voltage drop across gate-source is zero so the PMOS does not turn on to conduct anything between source-drain.
At this point you may notice that the voltage drop across the load is what triggers the PMOS to turn on, which means that if the load develops a voltage that tries to push current in reverse, the gate-source will be biased in the correct way to turn the PMOS on and flow through the source-drain back towards, bypassing the diode which would otherwise block it. This is why it can't stop the load from pushing current back towards the source.
The 100K there is to allow the PMOS to do its job. In a simple, normal, reverse-polarity PMOS circuit the gate would be directly connected to GND, which obviously doesn't work here because it would short out Vbus.
In this case, a twist has been thrown in where Vbus can pull the gate HI turning the PMOS off which prevents Vbus from back-charging the battery (something which I mentioned earlier a regular, simple PMOS reverse-polarity circuit can't do). That's something new to me. I'll have to remember it. |
H: Having issues with I2S with DMA using bare metal
I am trying to setup the I2S Peripheral to interact with the Pmod I2S module. The FW and SCLK are not generating, however I can see the MCLK on the oscilloscope.
Using the ST32H753ZI
What I have done so far are the following:
Setup the SPI1/I2S Clock
Enable the GPIOA, GPIOC, DMA1, and SPI1 Clocks
Let SP1 use the PLL2 Clock
Setup GIPO A and C for alternative functions for A5F (PA4, PA5, PA6,
PA7, PC4)
Setup DMAMUX1
Setup DMA1 Stream0/1 for Tx and Rx
Setup SPI
I tried using the HAL driver and that got the FW and SCLK showing on the oscilloscope. Comparing the bare metal code and the HAL code I cant find the difference between them as the registers are all setup the same.
Any ideas what's causing the FW and SCLK not to show?
Code:
void init_I2S(){
//Setting Clock for 98.304MHz
//N = 122
//P = 8
//M = 10
//FRACT = 7209
// RCC_PLL2DIVR
// MASKING:
RCC -> PLL2DIVR &= ~RCC_PLL2DIVR_P2;
RCC -> PLL2DIVR &= ~RCC_PLL2DIVR_N2;
// WRITING:
RCC -> PLL2DIVR |= RCC_PLL2DIVR_P2_DIV8;
RCC -> PLL2DIVR |= RCC_PLL2DIVR_N2_MULT122;
// RCC_PLLCKSELR
// MASKING:
RCC -> PLLCKSELR &= ~RCC_PLLCKSELR_DIVM2;
// WRITING:
RCC -> PLLCKSELR |= RCC_PLLCKSELR_DIVM2_DIV10;
// RCC_PLL2FRACR
// MASKING:
RCC -> PLL2FRACR &= ~RCC_PLL2FRACR_FRACN2;
// WRITING:
RCC -> PLL2FRACR |= RCC_PLL2FRACR_FRACN_7209;
// RCC_PLLCFGR
// MASKING:
RCC -> PLLCFGR &= ~RCC_PLLCFGR_DIVP2EN;
RCC -> PLLCFGR &= ~RCC_PLLCFGR_PLL2RGE;
RCC -> PLLCFGR &= ~RCC_PLLCFGR_PLL2VCOSEL;
RCC -> PLLCFGR &= ~RCC_PLLCFGR_PLL2FRACEN;
// WRITING:
RCC -> PLLCFGR |= RCC_PLLCFGR_DIVP2EN;
RCC -> PLLCFGR |= RCC_PLLCFGR_PLL2RGE_4_8;
RCC -> PLLCFGR |= RCC_PLLCFGR_PLL2VCOSEL_192_836;
RCC -> PLLCFGR |= RCC_PLLCFGR_PLL2FRACEN;
// RCC_CR
// MASKING:
RCC -> CR &= ~RCC_CR_PLL2ON;
// WRITING:
RCC -> CR |= RCC_CR_PLL2ON;
// WAITING:
while (((RCC -> CR) & (RCC_CR_PLL2RDY)) == 0){};
// ENALBING CLOCKS
// RCC_AHB4ENR
// MASKING:
RCC -> AHB4ENR &= ~ RCC_AHB4ENR_GPIOAEN;
RCC -> AHB4ENR &= ~ RCC_AHB4ENR_GPIOCEN;
// WRITING:
RCC -> AHB4ENR |= RCC_AHB4ENR_GPIOAEN;
RCC -> AHB4ENR |= RCC_AHB4ENR_GPIOCEN;
// RCC_APB2ENR
// MASKING:
RCC -> APB2ENR &= ~RCC_APB2ENR_SPI1EN;
// WRITING:
RCC -> APB2ENR |= RCC_APB2ENR_SPI1EN;
// CHANGING CLOCKS OF PERIPHERALS
// RCC_D2CCIP1R
// MASKING;
RCC -> D2CCIP1R &= ~RCC_D2CCIP1R_SPI123SEL;
// WRITING:
RCC -> D2CCIP1R |= RCC_D2CCIP1R_SPI123SEL_PLL2_P_CK;
// CHANGING GPIO PINS TO ALETERNATIVE
// GPIOx_MODER
// MASKING
GPIOA -> MODER &= ~GPIO_MODER_MODE4;
GPIOA -> MODER &= ~GPIO_MODER_MODE5;
GPIOA -> MODER &= ~GPIO_MODER_MODE6;
GPIOA -> MODER &= ~GPIO_MODER_MODE7;
GPIOC -> MODER &= ~GPIO_MODER_MODE4;
// WRITING:
GPIOA -> MODER |= GPIO_MODER_MODE4_ALT;
GPIOA -> MODER |= GPIO_MODER_MODE5_ALT;
GPIOA -> MODER |= GPIO_MODER_MODE6_ALT;
GPIOA -> MODER |= GPIO_MODER_MODE7_ALT;
GPIOC -> MODER |= GPIO_MODER_MODE4_ALT;
//SETTING ALT FUNCTIONS TO PINS
// GPIOx_AFRL
// MASKING:
GPIOA -> AFR[0] &= ~GPIO_AFRL_AFSEL4;
GPIOA -> AFR[0] &= ~GPIO_AFRL_AFSEL5;
GPIOA -> AFR[0] &= ~GPIO_AFRL_AFSEL6;
GPIOA -> AFR[0] &= ~GPIO_AFRL_AFSEL7;
GPIOC -> AFR[0] &= ~GPIO_AFRL_AFSEL4;
// WRITING;
GPIOA -> AFR[0] |= GPIO_AFRL_AFSEL4_AF5;
GPIOA -> AFR[0] |= GPIO_AFRL_AFSEL5_AF5;
GPIOA -> AFR[0] |= GPIO_AFRL_AFSEL6_AF5;
GPIOA -> AFR[0] |= GPIO_AFRL_AFSEL7_AF5;
GPIOC -> AFR[0] |= GPIO_AFRL_AFSEL4_AF5;
// ENABLING DMA1
// RCC_AHB1ENR
// MASKING:
RCC -> AHB1ENR &= ~RCC_AHB1ENR_DMA1EN;
// WRITING:
RCC -> AHB1ENR |= RCC_AHB1ENR_DMA1EN;
// SETTING UP DMA FOR I2S
// DMAMUX1_Channel0_CCR
// DMAMUX1_Channel1_CCR
// NOTE: Using DMAMUX1 -> DMA1_Channel 0 & 1
// 0x25 = Rx | 0x26 = Tx
// MASKING:
DMAMUX1_Channel0 -> CCR &= ~DMAMUX_CxCR_DMAREQ_ID;
DMAMUX1_Channel1 -> CCR &= ~DMAMUX_CxCR_DMAREQ_ID;
// WRITING:
DMAMUX1_Channel0 -> CCR |= 0x25; //Rx
DMAMUX1_Channel1 -> CCR |= 0x26; //Tx
// DMA1_Stream0_CR
// DMA1_Stream1_CR
// MASKING:
DMA1_Stream0 -> CR &= ~DMA_SxCR_CT;
DMA1_Stream0 -> CR &= ~DMA_SxCR_PL;
DMA1_Stream0 -> CR &= ~DMA_SxCR_MSIZE;
DMA1_Stream0 -> CR &= ~DMA_SxCR_PSIZE;
DMA1_Stream0 -> CR &= ~DMA_SxCR_MINC;
DMA1_Stream0 -> CR &= ~DMA_SxCR_CIRC;
DMA1_Stream0 -> CR &= ~DMA_SxCR_DIR;
DMA1_Stream0 -> CR &= ~DMA_SxCR_PFCTRL;
DMA1_Stream0 -> CR &= ~DMA_SxCR_TCIE;
DMA1_Stream0 -> CR &= ~DMA_SxCR_HTIE;
DMA1_Stream1 -> CR &= ~DMA_SxCR_CT;
DMA1_Stream1 -> CR &= ~DMA_SxCR_PL;
DMA1_Stream1 -> CR &= ~DMA_SxCR_MSIZE;
DMA1_Stream1 -> CR &= ~DMA_SxCR_PSIZE;
DMA1_Stream1 -> CR &= ~DMA_SxCR_MINC;
DMA1_Stream1 -> CR &= ~DMA_SxCR_CIRC;
DMA1_Stream1 -> CR &= ~DMA_SxCR_DIR;
DMA1_Stream1 -> CR &= ~DMA_SxCR_PFCTRL;
// WRITING:
DMA1_Stream0 -> CR |= DMA_SxCR_CT_MEM0;
DMA1_Stream0 -> CR |= DMA_SxCR_PL_Very_High;
DMA1_Stream0 -> CR |= DMA_SxCR_MSIZE_32BIT;
DMA1_Stream0 -> CR |= DMA_SxCR_PSIZE_32BIT;
DMA1_Stream0 -> CR |= DMA_SxCR_MINC;
DMA1_Stream0 -> CR |= DMA_SxCR_CIRC;
DMA1_Stream0 -> CR |= DMA_SxCR_DIR_P_TO_M;
DMA1_Stream0 -> CR |= DMA_SxCR_PFCTRL_DMAFLOW;
DMA1_Stream0 -> CR |= DMA_SxCR_TCIE;
DMA1_Stream0 -> CR |= DMA_SxCR_HTIE;
DMA1_Stream1 -> CR |= DMA_SxCR_CT_MEM0;
DMA1_Stream1 -> CR |= DMA_SxCR_PL_Very_High;
DMA1_Stream1 -> CR |= DMA_SxCR_MSIZE_32BIT;
DMA1_Stream1 -> CR |= DMA_SxCR_PSIZE_32BIT;
DMA1_Stream1 -> CR |= DMA_SxCR_MINC;
DMA1_Stream1 -> CR |= DMA_SxCR_CIRC;
DMA1_Stream1 -> CR |= DMA_SxCR_DIR_M_TO_P;
DMA1_Stream1 -> CR |= DMA_SxCR_PFCTRL_DMAFLOW;
// DMA_SxNDTR
// WRITING:
DMA1_Stream0 -> NDTR = 0x08;
DMA1_Stream1 -> NDTR = 0x08;
// DMA_SxPAR
// WRITING:
DMA1_Stream0 -> PAR = (uint32_t)&SPI1->TXDR;
DMA1_Stream1 -> PAR = (uint32_t)&SPI1->RXDR;
// DMA_SxM0AR
// WRITING:
DMA1_Stream0 -> M0AR = (uint32_t)RxBuff;
DMA1_Stream1 -> M0AR = (uint32_t)TxBuff;
// DMA_SxCR
// WRITING:
DMA1_Stream0 ->CR |= DMA_SxCR_EN;
DMA1_Stream1 ->CR |= DMA_SxCR_EN;
// Setting up the SPI/I2S Peripheral
// MASKING:
SPI1 -> I2SCFGR &= ~SPI_I2SCFGR_MCKOE;
SPI1 -> I2SCFGR &= ~SPI_I2SCFGR_ODD;
SPI1 -> I2SCFGR &= ~SPI_I2SCFGR_I2SDIV;
SPI1 -> I2SCFGR &= ~SPI_I2SCFGR_DATFMT;
SPI1 -> I2SCFGR &= ~SPI_I2SCFGR_WSINV;
SPI1 -> I2SCFGR &= ~SPI_I2SCFGR_DATLEN;
SPI1 -> I2SCFGR &= ~SPI_I2SCFGR_CHLEN;
SPI1 -> I2SCFGR &= ~SPI_I2SCFGR_CKPOL;
SPI1 -> I2SCFGR &= ~SPI_I2SCFGR_I2SSTD;
SPI1 -> I2SCFGR &= ~SPI_I2SCFGR_I2SCFG;
SPI1 -> I2SCFGR &= ~SPI_I2SCFGR_I2SMOD;
SPI1 -> CFG1 &= ~SPI_CFG1_RXDMAEN;
SPI1 -> CFG1 &= ~SPI_CFG1_TXDMAEN;
SPI1 -> CFG1 &= ~SPI_CFG1_FTHLV;
// WRITING:
SPI1 -> I2SCFGR |= SPI_I2SCFGR_MCKOE;
SPI1 -> I2SCFGR |= SPI_I2SCFGR_ODD_MULT2;
SPI1 -> I2SCFGR |= SPI_I2SCFGR_I2SDIV_2;
SPI1 -> I2SCFGR |= SPI_I2SCFGR_DATFMT_RAlign;
SPI1 -> I2SCFGR |= SPI_I2SCFGR_WSINV_I2S;
SPI1 -> I2SCFGR |= SPI_I2SCFGR_DATALEN_24BIT;
SPI1 -> I2SCFGR |= SPI_I2SCFGR_CKPOL_FALL_RISE;
SPI1 -> I2SCFGR |= SPI_I2SCFGR_I2SSTD_I2STAND;
SPI1 -> I2SCFGR |= SPI_I2SCFGR_I2SCFG_MASTER_TRANSMIT;
SPI1 -> I2SCFGR |= SPI_I2SCFGR_I2SMOD_I2S_PCM_MODE;
SPI1 -> CFG1 |= SPI_CFG1_RXDMAEN;
SPI1 -> CFG1 |= SPI_CFG1_TXDMAEN;
SPI1 -> CFG1 |= SPI_CFG1_FTHLV_2_Data;
SPI1 -> SR = 0x00;
SPI1 -> CR1 |= SPI_CR1_SPE;
SPI1 -> CR1 |= SPI_CR1_CSTART;
}
AI: The issue was the DMA Rx and Tx Peripheral and Memory were switched around. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.