Thursday 28 February 2019

What does it says the transconductance efficiency (gm/Id) in an amplifier?


I understand the concept of the transconductance but it's not clear what does the transconductance efficiency (gm/Id) mean. Since gm is the variation of Id to the Vgs or vin voltage... What is the variation of Id to Vgs by Id???



Answer




I'm a little unclear what you're actually asking. If you're asking why we care about transconductance efficiency, that I think I can answer.


If you're asked to design an amplifier, and you need a specific transconductance gm, the transconductance efficiency tells you the drain current you need to achieve that transconductance. That determines the current consumption and power dissipation of the amplifier.


Normally, the lower current consumption and less power dissipation, the happier your customer will be...


reliability - What happened to electrolytic capacitors in the 21st century?


We can sometimes see decades-old capacitors (such as ones made in the USSR) still working. They are bigger and heavier, but durable and not desiccating. Modern aluminium capacitors serve for about 11 years, if you are lucky, then become dry and quietly fail. I remember early 2000s devices where capacitors failed after 3–4 years of service, and not necessarily low-end devices (one example is E-TECH ICE-200 cable modem worth ∼ 240 USD in 2000). A repair due to failed electrolytic capacitors became a commonplace, something uncharacteristic for 1980s.


Was this 1990s degradation caused by cheap mass production? Or by poorly-tested technologies related to miniaturization? Or many manufacturers just didn’t care?


It appears that the trend is by now reversed, and recent capacitors are a bit better than the ones from 1994–2002. Can experts confirm it?



Answer



Principal reasons were:



  • The capacitor plague of 1999–2002 – an attempt to reproduce a stolen Rubycon Inc.’s formula for electrolyte, which went bad.


  • Otherwise changing composition of electrolyte; more H2O (useful to obtain lower ESR) makes it more corrosive.

  • Cost optimization due to increasingly mass production of electronics.

  • Errors in design, process, or low-quality materials; bad quality control.


Am I understanding this circuit right?


This is from an iPhone 6. I'm having a hard time understanding how q1701 controls the "handshake" to Tristar_pin to allow charging. (Diagram says "pin for handshake" next to C1704 at top right.)


I don't see anything controlling the gate of q1701 either. Am I right to assume current flow that I've traced in red?


enter image description here




Wednesday 27 February 2019

Capacitor on USB cable?


I was messing around with a USB camera. I wanted to change the cable because is trimmed but as I was cutting it I saw a small thing (image below). As I was trying to cut the casing and see what it has inside I saw a spark. I tried to connect it with another cable but I don't know if I'm gonna damage the camera or the USB port.


enter image description here


What is it and can I connect the camera without it?




Answer



I guess you're talking about the ferrite bead:


enter image description here


Source: Wikipedia - Ferrite bead


Its purpose is to prevent interference at high frequencies signals.


It may also work without it and with a cable as short as possible.


integrated circuit - Which of these marks signifies Pin 1 on the STM32F (LQFP64)?



I'm using the STM32F105, in a LQFP64 package. It has two circular markings, on opposing corners of the IC. This picture is for a different ST ARM, but the markings and silkscreen are similar:


ARM


The larger mark in the upper-right of the picture has a flat bottom, whereas the smaller mark in the lower-left is slightly concave. This package doesn't have an exposed pad, so there are no clipped corners underneath.


The datasheet only mentions one mark:


diagram


and I haven't found any other package documentation that mentions it.


Does anyone have a clue for me?




Update:


The project is completed and the answers are correct. Pin 1 is the smaller, concave mark in the lower-left. Don't forget to upvote the good answers!



Interestingly, I've since purchased another batch of these chips and they only have the one mark. Thanks, all!



Answer



I have designed a board for the STM32F103R, like you. Tested and "proven" now.


Anyway, if the text is right-side-up, pin 1 is in the lower left.


The other answers all mention things that could be considered a "hint", Luckily those hints all point in the same direction and happen to be correct.


Using diodes to mix 2 audio signals into one set of speakers


I have the audio output of 2 computers connected to only one set of speakers.
Each computer uses one of these external USB sound cards: enter image description here


And I use this splitter cable to wire the signals together: enter image description here



The whole thing works, but with some minor problems:



  • There's a little bit of noise when the speakers are set at max volume

  • One audio signal sounds a bit louder than the other

  • When recording the microphone input, sometimes the audio output of the other computer becomes the mic input


So obviously the two signals are interfering each other and also each signal finds its way into the other sound card because the splitter cable is meant to be a splitter and not a mixer.


So I thought if I could solve this by adding diodes to each side of the splitter cable so that each audio signal goes to the speakers only and not to the other sound card. enter image description here


Will this idea work?
What kind of diode should I use for that?




Answer



As mentioned in the comments, diodes are not the way to go. They will massively corrupt your audio signal, and it will just sound utter rubbish.


The simplest method is to use a passive mixer. That simply consists of two resistors per channel:


schematic


simulate this circuit – Schematic created using CircuitLab


You can tie all the ground wires together without resistors.


This of course is assuming you are using a powered speaker set, and not just raw speakers.


ESD wrist wrap resistance


I use a wrist strap with 1 MOhm resistance connected to a ground Plug Adapter with 1.5 MOhm, so total series resistance is 2.5 MOhm. Is it OK for ESD protection or would it be better to connect the wrist strap directly to ground?


I know that this resistance is to protect the operator. However, is there an upper limit on the value of the resistor so that it doesn't affect ESD protection?


Thanks





analog - General impedance converter


Can anyone give an explanation about general impedance converter? This question might not be specific enough, but I will appreciate if someone could share as much as possible about this circuit.



enter image description here




Tuesday 26 February 2019

ltspice - How to use .step param with more than two parameters in LTSpiceIV


I need to do three transient simulations with different values of certain resistors (conveniently called R1 and R2) in each. What I mean to do exactly is this:



  • Sim. 1: R1 = 1 k\$\Omega\$, R2 = 10 k\$\Omega\$

  • Sim. 2: R1 = 1 M\$\Omega\$, R2 = 10 M\$\Omega\$


  • Sim. 3: R1 = 1 k\$\Omega\$, R2 = 1 M\$\Omega\$


If there were just one resistor whose resistance to vary, then I would just set its resistance to "{r1}" (I use lower case letters to make it a different variable/parameter than R1) and use a command such as:


.step param r1 list 1k 1meg 1k

However, since I have to change two parameters (together) two times each, I have read here that (at least on LTSpiceIV) that a workaround to my problem could be using something like this:


.step param X list 1 2 3

.param r1 = table(X, 1k, 1meg, 1k)


.param r2 = table(X, 10k, 1meg, 10meg)

Upon doing the simulation, I get the following warnings:


WARNING: Can´t resolve .param r2 = table(X, 10k, 1meg, 10meg)
Select OK to continue the simulation with the default model or Cancel to quit now.

The same applies for r1.


For some reason, the simulation doesn´t "break" if I add one extra element to the table. In that case, the simulation takes too long, advancing more slowly every time, as it would never end. I have tried setting X to 0 1 2 instead of 1 2 3, but that does not work either.


Here are some pictures:


Circuit + commands



Error message


Your help would be much appreciated.




Monday 25 February 2019

batteries - What is the minimum charging current for NCR18650 li ion battery?




I need a rechargeable battery pack for my project, I need to know what is the minimum charging current for NCR18650 li-ion battery?


In the datasheet, it says max charge current is 2A. what is the minimum charge current?


I use tp4056 module for charging, I can change the charging current


is 300mA to 600mA ok for charge current? will it damage the battery or affect badly for a battery lifetime?


Delaying in charging time is not a problem for my application .



Answer



Li-ion batteries don't like to be exposed to charging conditions for overly long time, otherwise metal lithium build-up occurs and/or electrolyte starts to decompose. Reputable chargers (like TI BQ25896 for example) have a built-in safety timer set for 12 hours. The Panasonic NCR18650 battery specifications mention the charging conditions as "CC-CV, Std. 1925mA, 4.20V, 3.0 hrs", so a 3 hour limit seems to be preferable.


There are not much literature on minimum charging current for Li-IOn batteries. One thing is clear that the minimum should be no less than the charge cut-off current (which is listed as 55 mA for NCR18650). On the other end, it seems like exposure to charging current longer than 12 hours is not good either. So you should set your minimum such that it finishes the charging cycle in that time frame.


In general, the electro-chemistry and solid state chemistry have many variables, and life time (level of capacity degradation) of a rechargeable battery is kind of smooth curve, where the end limits are set by marketing and business goals, or by special requirements. If you are planning to launch your product for a 20-year space mission, you probably should conduct your own research. If you are concerned with 500 mA charge to reduce your junk TP4056 charger overheating, you should be fine.


What to look for in the datasheet when choosing a MOSFET?


I thought that choosing the right MOSFET for my LED strip would be easy until I discovered how many different models there are.


Basically I want a MOSFET that allows me to control with PWM a 12V 6A (MAX) led strip, but every time I see the Vgs I get confused because of numbers like +-20V.. (I'm controlling it with an ATtiny13A or ATtiny85 - 5V pin output)


I done a lot of searching a came across a lot of different models: IRFZ44N, TIP120, STB36NF06L and a bunch more.. but I not sure if they will do the job



What MOSFET should I use and how do I read in the datasheet why this is a good choice?


I am new to hobby electronics.



Answer



The 12V and 6A is a good starting point. This tells me you need a mosfet with a max drain-source voltage capability greater than 12V so 20V would be a minimum criteria for this.


You want to switch 6A and you'll want it to do so with minimum volt-drop - just like a relay contact so you are looking for Rds(on) below (say) 0.1 ohms. This means at 6A it will develop a small voltage across the device of 0.6V (ohms law).


However, that will produce a power disippation of 6 x 6 x 0.1 W = 3.6W so if you are looking for a surface mount device you would prefer a lower disippation of maybe 0.5W max.


This means Rds(on) would be more like 0.014 ohms.


So far, your application needs a 20V transistor, capable of switching 6A with an on resistance no more than 0.014 ohms.


Vgs is "like" the coil voltage on a relay - it's how much voltage you need to apply to the coil to get it to switch BUT for a FET it's a linear thing and, if you don't apply enough voltage, the mosfet will not turn on properly - its on-resistance will be too high, it'll get warm under load and have a volt or two across it when you want a nice low resistance.


You then need to inspect the details of the spec to see how much you need to apply to guarantee the low on-resistance you want. A bit more on this further down.



The IRFZ44N has on the front page of the data sheet: -


Vdss = 55V, Rds(on) = 17.5 milli ohms and Id = 49A


It's not a surface mount device therefore a little more heat generated isn't going to matter too much (with a heatsink) so it'll do what you want it to do but I'd research a device with smaller Vds (say 20V) and you'll probably find one with a lot less than 10 milli ohms on resistance.


If you look at the electrical characteristics on page 2 you'll see that the 17.5 milli ohms on resistance requires a 10V drive voltage on the gate (3rd line down in the table). Less than this drive level and the on-resistance rises as would the heat produced.


At this point I can't decide for you any more but I think you might be looking for a device that will operate from logic levels. In which case the IRFZ44N won't do.


The STB36NF06L is a little higher with the on-resistance but the spec does suggest it will work from a 5V drive on the gate - see electrical characteristics (ON) but i'd still be tempted to find one that is more suitable.


I'd be tempted by this. The PH2520U is a 20V, 100A, 2.7 milli ohm device when the gate voltage is 4.5V. If your logic levels are 3V3 check figure 9 to see it will work well at 3V3.


One last thought about things - you are wanting to PWM a load and if the frequency is high you'll find that the gate capacitance takes some drive current into the gate to get it moving up and down quickly. Sometimes it better to trade off on-resistance to find a device with lower Vgs capacitance. You're into horse-trading now. Keep as low as you can on switching frequency and it should drive ok from a 5V logic pin.


pcb - what is the current limit through a trace?


Similar questions and topics have been asked before such as



I've used PCB Toolkit in the past and I haven't had practical issues, but I also didn't have more than 1A running through signal traces before. What I'm noticing is that there is a difference between some of the calculators. I'd like to know which set of tools is more trusted.


I understand that there are alot of pictures with information all over the pictures, you can skip to the bottom of this question for a summary of the pictures show if that is easier.



With IPC-2152 modifiers enabled


enter image description here



The general window looks like this


enter image description here


I've played around with the conductor width until I was able to ~2A. My input settings are the following


enter image description here


I believe my fab house starts with 0.5oz base and then plates up.


Here are the results for external layer


enter image description here


Internal layer (I've updated my conductor width to 22 mils)


enter image description here


If I were to change the option from plane present to no plane present, I get a different set of values.



Keeping the settings for the external layer the same, and changing only plane present: no


enter image description here


enter image description here


With IPC-2152 without modifiers enabled


enter image description here


enter image description here


From a question I had asked earlier, Will forced air on PCB improve current capacity of trace? , which seems to indicate that heat dissipation improves current limits, then the presence of the plane helps with cooling and therefore can handle higher currents than without.



I would have expected that the values to have been similar between the two, but they really are not.


If I were to enter the same values I had entered for the PCB Toolkit (with the exception of the plane present status and base copper and plating copper. I get the following



enter image description here


**Summary**
The following all has a target current of ~2A with a 20C temp rise.
PCB Toolkit with IPC-2152 modifiers Internal Trace 22 mils
PCB Toolkit with IPC-2152 without modifiers Internal Trace 55 mils
Circuit Calculator Internal Trace 52.6 mils

PCB Toolkit with IPC-2152 modifiers External Trace 12 mils
PCB Toolkit with IPC-2152 without modifiers External Trace 36 mils
Circuit Calculator External Trace 20.2 mils


So my question is, which is correct because I am also trying to maintain a 50 ohm line if possible ? I'm leaning towards that PCB Toolkit is more accurate, since the online calculator is using IPC-2221A and the website does not appear to have been updated since March 2008 (last blog entry).


In the end, what I am looking for is a smallest external/trace, that can handle 2A without being excessive on copper thickness. Smaller traces make it easier to get 50 ohm line without having to increasing my board thickness.



Answer



I'm going to attempt to answer this question from my own research into this.


Many of the online calculators for trace width vs current is derived from a document that was published apparently years ago. Some sources have said it was in the 1950s, but I haven't been able to find the first date it was published. (In fairness, I didn't look that hard either). The IPC-2221 is the Generic Standard on Printed Board Design.


I found a copy of IPC-2221 here [link]


A more modern version of this document exists (I don't have the date), and its the IPC-2152 which has since updated some of the older information of the past. If the original document was published in the 1950s, then PCB design has some a long way, such as the use of planes and multilayer boards.


The PCB Toolkit software uses (by default) IPC-2152 with something called modifiers. I'll get more into that soon. Another website, (http://www.smps.us/) also provides a calculator for trace width vs current and uses the IPC-2152 as the baseline link and the body includes some explanation into the differences with the old and the new.




Until recently, the main source for calculation of the printed circuit board (PCB) trace width for temperature rise were plots derived from the experiments conducted more than half a century ago.



It goes onto say..



The new standard IPC-2152, which is based on the latest studies is much more involved. It provides more than 100 different figures and lets you take into account many additional factors, such as thickness of PCB and conductors, distance to a copper plane, etc.



The rest of the page includes a calculator and some equations and how and why the author did certain things, but one thing he says is



If you have a multi-layer PCB with a copper plane near your conductor, the actual ∆T will be substantially lower. However, for the boards less than 70 mils thick without a plane the temperatures may be higher. Therefore IPC referring to Fig.5-2 as conservative may be misleading. Anyway, to reflect the conditions of a specific application, one can introduce a correction (modifying) factor as the ratio between estimated actual and generic ∆T.




I think this is the modifiers we see with PCB Toolkit. When I plug in the the same values for both PCB Toolkit and this online calculator, I get the same result**


enter image description here enter image description here


** The internal trace width matches the the revised width of the online calculator.



That document also arbitrarily assumed that internal conductors could carry only half of the current of the outer ones. In reality, as mentioned in the new standard, inner layers may actually run cooler because the dielectric has 10 times better thermal conductivity than air.



I thought this was interesting and according to Wikipedia


Thermal conductivity, through-plane 0.29 W/m·K,[1] 0.343 W/m·K[2]
Thermal conductivity, in-plane 0.81 W/m·K,[1] 1.059 W/m·K[2]


and The Engineering Toolbox at about 20C, thermal conductivity of air is 0.0257 W/m·K


So if you have a plane, the dielectric spreads that heat out, so your trace can actually handle more current than what was previously thought.


TL;DR IPC-2152 is the new standard for trace width vs current, and includes heat dissipation with a plane so that traces can be handle more current, than what was previously thought.


PCB Toolkit (program) and http://www.smps.us/pcb-calculator.html use this new standard. So if you need to squeeze in more traces with a higher current rating, or if you are trying to hit a target impedance and be able to handle a higher load, the IPC-2152 will be able to help. However, if you can go bigger, go bigger because it's better to be conservative, but if you need to squeeze more and be considered "safe", then I think this is the way.


Headphone OUT to microphone IN for mobile phones


My AIM is to feed audio to mobile phones over MIC IN port. This audio would be coming from Laptop's headset out port. The way i am testing is making call from the test device which is connected to my laptop. What is want is to hear the audio which been played on system at the call termination mobile device. I tested the these two circuits and here are my observation :


Circuit 1 : NO audio received at the terminating mobile. May be the resistor values are too high. I didn't tired with lower resistor values.


Circuit 2 : Audio was received at the terminating mobile device but was very low. I removed resistor and capacitor both and tested directly.Audio became loud enough but quality was poor. There was too much of 'air' like audio with some high peak audio loss too. i just connected capacitor and tested. Audio became little low but quality was still poor.


Please suggest how this conversion is possible, maintaining high audio quality ? May be i am using too high capacitor and resistor?



Circuit 1:


Circuit 1


Circuit 2:


enter image description here




Different voltage drop in serial and parallel circuit with resistor


I have a circuit powered by 9V battery, I'm using two 2V LEDs. If I connect the LEDs in series with 10k Ohm resistor, the voltage before resistor is 9V, after the resistor it's 3.3V and after the first LED it's 1.65V. Both LEDs are dim, since they are at voltage lower than they are supposed to. If I connect them in parallel from the resistor, after the resistor it's 1.65V for both of them, they are still dim.


How is this voltage difference possible? I am aware of the Ohm's law, but it still doesn't make any sense to me. In my mind, a resistor can't change it's resistance, it's 10k Ohms no matter what.


Q: How is it, that I get different voltage after the resistor, depending on how the LEDs are wired? Why isn't resistor's behavior constant?



Answer




schematic


simulate this circuit – Schematic created using CircuitLab


Figure 1. (a) Just a resistor. (b) Series LEDs. (c) Parallel LEDs.



Q: How is it, that I get different voltage after the resistor, depending on how the LEDs are wired? Why isn't resistor's behavior constant?



First consider the resistor on its own - Figure 1a. From Ohm's Law we can calculate the current through it as \$ I = \frac {V}{R} = \frac {9}{10k} = 0.9~mA \$. This is the maximum we can get and adding LEDs will reduce it.


Looking at Figure 1b you can see that the same current goes through all the elements in the circuit.


enter image description here


Figure 2. A typical LED graph of current vs forward voltage. Note that even at tiny currents (< 1 mA) the forward voltage drop doesn't change much.



We can see from Figure 2 that the 1.65 V reading you are getting across each of the LEDs is correct.


Now what happens when you connect the LEDs in parallel? We will still be limited to a maximum of 0.9 mA through the resistor but now this has to split two-ways through D3 and D4. They will get about 0.45 mA each. Checking back to Figure 2 we can see that they will still drop about 1.6 V or so.




Note that adding the LEDs reduces the voltage across the resistor and therefore reduces the current available. For Figure 2b the actual current will be \$ \frac {9-3.3}{10k} = 0.57~mA \$. For Figure 2c it will be \$ \frac {9-1.65}{10k} = 0.735~mA \$ which helps a bit when the current is shared.





[From OP's comment:]Going back to analogies, I often see circuit being described as tube, current is the water in it, pump is voltage and garden hose is the resistor, lowering the voltage and limiting the current.



The water analogy is not great, but let's try. To resemble an electrical circuit the water will have to flow in a closed loop such as a hot water central heating system. The hot water pump raises the pressure at the outfeed of the pump (the battery raises the voltage). We feed through the pipes (the resistor) to two check valves which piped in series or in parallel.


enter image description here



Figure 2. The check-valve is the plumber's diode. Water can only flow one way. A certain pressure is required to overcome the spring. This causes a pressure drop across the valve but once the valve is open the pressure drop doesn't change much even at high currents. Source: Modified from Gentec image.


Now let's put some numbers on our system. The pump raises the pressure to 9. (Think psi, bar, pascals, inches of mercury or whatever you like.) The valves will open at 1.65. If we pipe them in series as in Figure 1b it should be clear that if the valves open the pressure reading at the top of D2 will be 1.65 and above D1 it will be 3.3. If we connect them as shown in Figure 1c they will both open when the pressure reaches 1.65.



1) Why, when in a series, doesn't first LED consume 2V and the second LED is not left with just the rest?



LEDs and resistors don't "consume" voltage in the same way your hose doesn't consume pressure. Voltage is dropped or "voltage decreases" across the resistor or LED in the same way that pressure losses occur in the water system.



2) When you say across the resistor, you mean this is the current inside it, but after it, it gets lowered by the LEDs themselves, because they are also, in fact, resistors, and that's why they get 0.45mA each, instead of the 0.57mA?



While they have resistance we do not call them resistors because they are non-linear just as the check-valve is. Also the current doesn't "get lowered" because what leaves the battery on one terminal must come back on the other.



I hope that helps.


Sunday 24 February 2019

LED strip brightness and its measurement - did I get ripped off?


I recently bought two 5m rolls of red and blue LEDs for building an hydroponic lettuce light. Each of them is supposed to have the following properties:



  • 300 SMD 5050 LEDS

  • 72 Watts

  • 12 Volts


  • 4500 Lumens

  • Beam Angel 120°


See Amazon


Naturally the high lumens were the thing that made me buy these ones. But I had my doubts so I started measuring their power consumption first: Red: 92,5 W Blue: 71,6W So red is drawing way to much current - still no big problem as I am interested in light intensity.


Here is a schematic:


schematic


simulate this circuit – Schematic created using CircuitLab


Then I measured all the LEDs and resistors and found the following:




  • Red: LEDs(2.1V), Resistor(2.8V),

  • Blue: LEDs(3.06V), Resistor (1.3V)


That suprised me: As there are always 3 LEDs and 2 resistors in series, the resistors in the red strip account for about 46% of power consumption. The resistors in the blue strip for 22%. Is that normal? Or is it just bad engineering?


That seemed legit from datasheets of other vendors (they did not include any data sheet). Finally I measured the luminous emittance with a Voltcraft MT-52 (cheap multimeter...). I made a box where only one LED could fit and positioned the multimiter 10cm beneath it. I measured: - Red: 55 lux ~ 1.73 lm - Blue: 115 lux ~ 3.6 lm


If you multiply that by 300 LEDs per strip you get 520 lumens for red and 1086 lumens for blue - but they promised 4500lm for each one!


I know that my multimeter isn't exactly made for measuring this and probably has a quite big measuring error - especially for LEDs. But can the error be that big? And are there even 5050 LEDs that could give me 15 lm a piece?


Finally a pic of the LED strip (notice the weird circuit: LED--R--LED--R--LED) The blue strip The label




microcontroller - Connecting the Vdd terminal in Proteus


I'm a beginner to microcontroller programming and the Proteus simulator. I have a LED blinking microcontroller circuit diagram. I'm trying to simulate it in Proteus. The problem is there is no Vdd and GND terminals.


I know it's hidden. After reading a solution I was able to set Gnd but I can't understand how to connect the Vdd terminal .


I want to know how to connect to Vdd like in the circuit diagram.


My circuit diagram:



enter image description here


This is my Proteus project so far and here is my project file if needed.


enter image description here



Answer



Several active devices in proteus have hidden power pins. To access them right click on the component you are interested in and click edit properties. In the window that opens there is a hidden pins button, click it and you will see the names of the hidden pins and the power nets they are connected to.


enter image description here


The VDD and VSS nets represent power rails of the design and are already assigned to 5v and 0v(GND) respectively.


You can see the project power rails from design -> configure power rails menu


enter image description here


enter image description here



One way to do what you want is to disconnect the VDD net from the VCC/VDD net (from the power rails screen shown above), and then connect VDD to the output of the regulator using a terminal. Note that this will effect any device on the schematic that uses the VDD net, not just the PIC.


The alternative, which can limit the change effect to the PIC only, is to create a new net (e.g VDD5 or any other name you like), connect the hidden PIC VDD pin to it (from the hidden pins button of PIC), and also connect the same net to the regulator output using a terminal.


To do what I describe, place a terminal as shown below, then right click it and select properties, from there assign VDD5 to it and click OK.


enter image description here


Then open the hidden pins screen of PIC and next to pin VDD write VDD5.


enter image description here


Finally connect the VDD5 terminal to the output of the regulator.


enter image description here


inductor - Is .95J worth of work within 1 second Equivalent to .95W of Power?


This is a question that has two parts to it divided up into two sections. It is similar to the "Is Work done to Transfer Energy?" question but has been refined to include the conversion from Joules of work to it's equivalent Power and if they are indeed identical to one another.


The two circuit schematics are real world circuits with losses. Since there is resistance in the connecting wires, capacitor, inductor, diode, and switch the circuit is 95% efficient in the end and is far from perfect. The switch is manually closed and then opened by hand.



Only 1 cycle of energy transferred from C1 to C2 will be contemplated. In general the numbers and values in the circuit are arbitrary and may not be exact due to slight changes caused by resistance. Nevertheless everything will be kept as close as possible to what is actually known to be happening in the two circuits. The best effort is being taken to fashion the most accurate question.


At any one point where there are doubts of what is occurring there will be a short note about it to acknowledge it.


I am sure there will be some details that will be overlooked and brought up and possibly some nitpicking, (For instance is a Joule a unit of Work, Energy or both?). So this will have to be forgiven and possibly overlooked as it's insignificant, or not, to the final result and answer.


Section 1: Down below is a simplistic schematic of a capacitor C1 intially charged with exactly 1J of energy. SW1 is closed for 1 second. This causes the 1J of energy to be transferred into L1 inductor's magnetic field to be temporarily stored. Work has been done to transfer the 1J of energy from the C1 capacitor to the L1 inductor's magnetic field. Because of the losses due to resistance, the C1 capacitor has done 0.95J worth of work on the inductor within 1 second of time.


(Note:) An attempt was made to match the inductance with the capacitance for a resonant frequency of 1 Hertz precisely which would translate to 1 second per cycle.


First half of Question: What is the equivalent amount of power of the 0.95J worth of work that has occurred on the inductor within 1 second of time?


Energy Transferred to Magnetic Field


Section 2: Next SW1 is opened after 1 second of time has passed. The 0.95J of energy that has been temporarily stored in the L1 inductor's magnetic field then collapses. The 0.95J of energy is then transferred from the L1 inductor's magnetic field through the D1 diode and then finally into capacitor C2 to be stored. The inductor has done 0.95J worth of work on C2. Capacitor C2 ends up with 19.43 V on it.


(Note:) It is realized the energy may have dropped again due to resistances. It is also realized that the amount of time it takes for this transfer of energy maybe considerably smaller than 1 second of time since it's a transient voltage spike, but possibly not since the C2 capacitor may or may not be acting as a load, which it is believed that it is.


Second half of Question: What is the equivalent amount of power of the 0.95J worth of work that has occurred on the C2 capacitor within 1 second of time? Also what is the exact amount of time for this transfer of energy to occur?



From what is understood, power is the rate of work done and work is force x distance. Work has indeed been done because the energy has "moved" or "changed" during it's two transfers through the circuit. There is power because of the changing voltages and currents involved.


Energy Transferred to Magnetic Field and Capacitor



Answer



Power is defined as energy per time.


By definition, if 0.95J gets transferred in 1 second, then energy is being transferred at 0.95 watts. If the transfer takes place in 1uS, then the power is 950kW.


circuit analysis - How do you determine the effective resistance of a finite grid of resistors?


Disclaimer: I am a geophysicist with limited electrical engineering background. I am not sure if this problem is incredibly easy, incredibly complex, or completely nonsensical.


My goal: Determine the bulk resistivity of a rock sample using resistor networks.



The rock sample is to be modelled using a resistor network with certain resistors having high resistance(representing solid rock) and others resistors having low resistance (representing fluid pathways in the rock).


Suppose I have a network of resistors on a uniform grid as shown below. In the example shown, each line segment has an associated resistor labelled 1 through 24 on a 3-by-3 grid. The resistances of each line segment are known.


The total length of the grid is \$L\$ and the "area" is \$A\$ (in this case it is a 2-D example, so the area is also just a length). The bulk resistivity of the sample is then given by:


$$\rho_{bulk} = \frac{R_{eff}A}{L}$$


enter image description here


My question: How do I determine the effective resistance, \$R_{eff}\$ of the network?


I have looked online but all I can find are discussions about infinite networks, source and sink currents etc. I am not interested in the current or voltage.


Can this problem be solved as it stands?



Answer



The basic idea is fairly simple. You arrange a matrix (\$V\$) that represents "nodes" or vertices in your system. Each of these nodes has a scalar-valued "voltage" associated with it that can be changed or updated as the algorithm proceeds. There will also be two nodes whose voltage cannot be changed. We are going to apply a "battery" of sorts here, so those two nodes represent the two ends of this battery.



Separately, another two matrices (\$Rv\$ and \$Rh\$) represents the edges in the system, horizontal and vertical. These are your resistance values, I guess. I'm not sure how you intend on filling these out. But that's your problem. This technique assumes you are able to populate these matrices, as well.


Depending upon the computer language you use, you may or may not be able to use negative indices. Doesn't matter. It's just a matter of keeping in mind what you are faced with.


Let's assume length \$L\$ is divided into \$N_L\$ sections and that "length" \$A\$ is divided into \$N_A\$ sections. Then you will need to construct a matrix with \$\left(N_L+1\right)\cdot\left(N_A+1\right)\$ vertices for the scalar voltage values. (or larger.) You will also need those other two matrices with \$N_A\cdot\left(N_L+1\right)\$ vertical edges and \$N_L\cdot\left(N_A+1\right)\$ horizontal edges between those vertices.


Now. Initialize all of the vertices with \$0\:\textrm{V}\$. Choose one of the vertices on the left (in the middle, preferably) and note it as a \$0\:\textrm{V}\$ value that is NOT allowed to ever change. Use whatever method you want for this. Choose one of the vertices on the right (in the middle, preferably) and change its value to \$1\:\textrm{V}\$, while again taking note that its value is NOT allowed to ever change. A technique that works here is to simply let it change normally but then replace the value each and every step. But it doesn't matter how you achieve this, so long as you do achieve it.


(There are other techniques for efficiency reasons. But it's probably not worth bothering with them here.)


Now for the algorithm, which is sometimes called a checkerboard or red-black algorithm. Moving through your node voltage matrix, process each node where the sum of the two indices, \$i+j\$ is even, performing the following simple assignment:


$$\begin{align*} V_{i,j}&=\frac{Rh_{i,j-1}\cdot Rh_{i,j}\cdot\left(V_{i-1,j}\cdot Rv_{i,j}+V_{i+1,j}\cdot Rv_{i-1,j}\right)}{Rh_{i,j-1}\cdot Rh_{i,j}\cdot \left(Rv_{i,j}+Rv_{i-1,j}\right)+Rv_{i-1,j}\cdot Rv_{i,j}\left(Rh_{i,j}+Rh_{i,j-1}\right)}\\\\ &+\frac{Rv_{i-1,j}\cdot Rv_{i,j}\cdot \left(V_{i,j-1}\cdot Rh_{i,j}+V_{i,j+1}\cdot Rh_{i,j-1}\right)}{Rh_{i,j-1}\cdot Rh_{i,j}\cdot \left(Rv_{i,j}+Rv_{i-1,j}\right)+Rv_{i-1,j}\cdot Rv_{i,j}\left(Rh_{i,j}+Rh_{i,j-1}\right)} \end{align*}$$


The above equation is nothing more than computing the voltage of a central node having four resistors connecting to it, where the voltages at the other ends of the four resistors are known. The central node voltage is then computed from the above equation. Since the divisor is the same for each term, you could just compute the sum of the numerators and then divide once by the denominator.


That will update all the nodes where the sum \$i+j\$ is even. Now you perform the same procedure to all of the nodes where the sum \$i+j\$ is odd. Once both these steps has been performed, you have completed one cycle.


If necessary, reset the special two nodes (for \$0\:\textrm{V}\$ and for \$1\:\textrm{V}\$ as earlier discussed.) Or, if you protected those two nodes, there's no need to reset them.



You are ready for the next cycle. Perform these cycles as many times as you feel is necessary for the overall state to settle down (and it will.)


When you stop the process, you can easily work out the resistance by either choosing to look at the nodes surrounding your left-side protected node or else look at the nodes surrounding your right-side protected node. (It may be a good idea to make your matrix just enough larger [by 1 in all directions] so that you will actually have four nodes surrounding either choice.) The difference in voltages between the surrounding nodes and the special node, divided by the resistance in the edges between them tells you the current leaving/entering your special node. Since this is a "battery" node, this current must be ALL of the current. Since the voltage is \$1\:\textrm{V}\$, by definition, dividing 1 by the sum of these four currents you find tells you the total resistance.


I'm staring at some code I wrote that totals, with lots of comments, just 67 lines. So it's NOT hard to write.


The "short summary" of this idea is that you apply a \$1\:\textrm{V}\$ battery and then watch as the voltages spread throughout the system. Once the voltages stabilize (your criteria for that), all you have to do is look at the current coming into, or out of, one battery terminal or the other one. They should both be the same current value (within some numerical bounds) for obvious reasons.





Why is it that you must separate the system into i+j = even and i+j = odd?



Suppose you compute \$V_{5,5}=f\left(V_{4,5},V_{6,5},V_{5,4},V_{5,6}\right)\$. This references the nodes that surround \$V_{5,5}\$. That's fine. Suppose you next compute \$V_{5,6}=f\left(V_{4,6},V_{6,6},V_{5,5},V_{5,7}\right)\$. Note that in the list of parameters is the value you just computed for \$V_{5,5}\$? This would "smudge" things a lot. It's not sound. Instead, each cycle of odd/even should "appear as if" it occurred at the same moment. So your next computation should be \$V_{5,7}=f\left(V_{4,7},V_{6,7},V_{5,6},V_{5,8}\right)\$ because none of the inputs to the function are nodes that were changed during this step. Then you swing around and compute the alternates, avoiding the smudging but now updating the alternates. You really do have to do it this way.




Also, is the formula identical for both even and odd steps through?



Yes, it's the same.



Can it all be solved in one step using some sort of linear system Ax=b where A is a linear operator and b provides the boundary conditions? Looking at it, it seems somewhat analogous to finite difference methods for solving partial differential equations..



There is a connection. I think it's called a 'matrix-free' implementation.




Here's an example. The following set of resistor values were placed into LTSpice for simulation:


enter image description here



I kept it short and simple. As you can see, the approximate computed current from the \$1\:\textrm{V}\$ power supply is given as \$30.225\:\textrm{mA}\$. (The actual value computed by Spice was \$30.224552\:\textrm{mA}\$.)


I ran the following VB.NET program:


Module GEOGRID

Const NL As Integer = 2
Const NA As Integer = 2
Const INF As Double = 1.0E+32

Sub Main()


Static Rh As Double(,) = New Double(NL + 2, NA + 1) {
{INF, INF, INF, INF},
{INF, 5, 21, INF},
{INF, 76, 10, INF},
{INF, 32, 22, INF},
{INF, INF, INF, INF}}
Static Rv As Double(,) = New Double(NA + 1, NL + 2) {
{INF, INF, INF, INF, INF},
{INF, 61, 50, 16, INF},
{INF, 56, 45, 18, INF},

{INF, INF, INF, INF, INF}}
Dim V As Double(,) = New Double(NL + 2, NA + 2) {
{0, 0, 0, 0, 0},
{0, 0, 0, 0, 0},
{0, 0, 0, 1, 0},
{0, 0, 0, 0, 0},
{0, 0, 0, 0, 0}}
Dim PDE As Func(Of Integer, Integer, Double) = Function(ByVal i As Integer, ByVal j As Integer) (
Rh(i, j - 1) * Rh(i, j) * (V(i - 1, j) * Rv(i, j) + V(i + 1, j) * Rv(i - 1, j)) +
Rv(i - 1, j) * Rv(i, j) * (V(i, j - 1) * Rh(i, j) + V(i, j + 1) * Rh(i, j - 1))

) / (
Rh(i, j - 1) * Rh(i, j) * (Rv(i, j) + Rv(i - 1, j)) +
Rv(i - 1, j) * Rv(i, j) * (Rh(i, j) + Rh(i, j - 1))
)
Dim IV As Func(Of Integer, Integer, Double) = Function(ByVal i As Integer, ByVal j As Integer) 0 +
(V(i, j) - V(i - 1, j)) / Rv(i - 1, j) + (V(i, j) - V(i + 1, j)) / Rv(i, j) +
(V(i, j) - V(i, j - 1)) / Rh(i, j - 1) + (V(i, j) - V(i, j + 1)) / Rh(i, j)
Dim idx As Integer = NA \ 2 + 1
Dim jdx1 As Integer = NL + 1
Dim jdx2 As Integer = 1

For x As Integer = 1 To 1000
For k As Integer = 0 To (NA + 1) * (NL + 1) - 1 Step 2
Dim i As Integer = k \ (NL + 1)
Dim j As Integer = k - i * (NL + 1) + 1
i += 1
If Not (i = idx AndAlso (j = jdx1 OrElse j = jdx2)) Then V(i, j) = PDE(i, j)
Next
For k As Integer = 1 To (NA + 1) * (NL + 1) - 1 Step 2
Dim i As Integer = k \ (NL + 1)
Dim j As Integer = k - i * (NL + 1) + 1

i += 1
If Not (i = idx AndAlso (j = jdx1 OrElse j = jdx2)) Then V(i, j) = PDE(i, j)
Next
Next
Console.WriteLine("R = " & (1.0 / IV(idx, jdx1)).ToString)
Console.WriteLine("R = " & (-1.0 / IV(idx, jdx2)).ToString)
End Sub

End Module


With the following result printed out: \$R = 33.0856844038614\:\Omega\$. Which is the correct answer.


The above program shows a way of setting up the resistors, vertical and horizontal, as well as the voltage matrix, so that it simplifies some of the tests for non-existent nodes and/or resistor values. The code is a little cleaner, this way, though it does require some more array elements. (I've simply made the extra resistor values infinite in value.) Just compare how I've set up the arrays with the way the schematic was laid out, as well, and I think you will be able to work out all the exact details here.


I've also hacked in the resistors and node values, of course, without making this in any way a general purpose program for reading up a table of values. But that generality is pretty easy to add. And this code should make everything I wrote absolutely unambiguous.


Note that I also just ran the \$x\$ loop 1000 types, alternating red and black within the \$x\$ loop. I just picked a number. To make this more general purpose, you may prefer a different way of determining how many iterations to perform.


And a final note. Just to prove that you can use either fixed voltage node's current to compute the resistor, I've used two lines in order to print out both values: one computed from the \$0\:\textrm{V}\$ side and one computed from the \$1\:\textrm{V}\$ side. Either way, you should see the same number.


(Okay. One more final note. This would be much better targeted at F# or any decent compiler targeting a massively parallel computing system. Each calculation in either "red" or "black" can be performed in parallel; completely independently of each other. F# makes this trivial. So coded in F#, you could run this on all of your available cores without anything special to do. It just works. Just a note in case you are collecting a LOT of data in some fashion and might want to take full advantage of a multi-core system.)




END NOTE:


The derivation is pretty simple from KCL. Place four resistors into the following arrangement:


schematic



simulate this circuit – Schematic created using CircuitLab


Apply KCL:


$$\begin{align*} \frac{V}{R_1}+\frac{V}{R_2}+\frac{V}{R_3}+\frac{V}{R_4} &= \frac{V_1}{R_1}+\frac{V_2}{R_2}+\frac{V_3}{R_3}+\frac{V_4}{R_4}\\\\ &\therefore\\\\ V &=\left(\frac{V_1}{R_1}+\frac{V_2}{R_2}+\frac{V_3}{R_3}+\frac{V_4}{R_4}\right)\bigg(R_1 \mid\mid R_2 \mid\mid R_3 \mid\mid R_4\bigg) \end{align*}$$


Some playing around with algebra gets the result I used in the code.


digital logic - Edge triggering seems to me leaving every circuit in an inconsistent state?


I was informed on this forum that edge triggering could be a solution for multiple propagation in a circuit with feedback (the output wired back to the input).


But to me edge triggering seems to leave a circuit in a completely inconsistent state. Look at this one (one-element JK flip flop ripple counter).


Let the clock input be edge-triggering signal and look at the first NAND field at J when all inputs at J are high but the clock. At the moment the clock gets high the propagation starts. The edge lasts for a nanosecond so it will probably end before the value propagates through the NAND. Anyway, a nanosecond-long low signal will travel through the output of the first NAND, preceded and followed by long intervals of high signal. That composition will get to the the second upper NAND and the NAND will change values accordingly, further branch-wired to another NAND plus an input, and it all looks like a great example of an inconsistent state of a circuit to me - who knows what is going to happen there?



I don't get properly something about edge triggering. What is that? Thank you for the time!




operational amplifier - How to operate Op-Amp[OP07CP] with 0-5v supply?


I don't know why I cannot operate Op-Amps! this is my second circuit and I'm trying to make a non-inverting amplifier by an OP07CP. This is my circuit + an example of measured values:


schematic


simulate this circuit – Schematic created using CircuitLab


And when I applied 0v to the +input, I got -5.47v in the output. and again for 17.9mv, I got 1.78v. when I change the supply to 0-5v, I just get an amount around 4.5v or 1.5v. I'm harassed! I expected to get 3153.969mv in the output when I applied 9.1mv but as you can see, I just got -1.15!(when supply is -12 - +12). Why doesn't it work correctly? Can I operate this Op-Amp with 0-3.3v or 0-5v supply? how?



Answer



Your schematic is wrong. V2 should either be +11.75V or you should flip it.



The circuit (with +/-12V-ish supplies) should work. However, you've got an offset pot- it can adjust the input offset to +/-4mV typically. If you crank it all the way down, the input can appear to be 9mV - 4mV = 5mV. Nominal gain is about 350, so this still appears to be off. You might want to parallel R2 with a small capacitor (10nF ceramic, for example) in case the op-amp is oscillating (if you have an oscilloscope, look at the output directly). Leave out the offset pot to begin with- even the cheap version is within 150uV Vos without the pot. Bypass the supplies too, near the op-amp.


The OP-07 is an ancient 'precision' op-amp with a distinguished and storied past, however it's not a rail-to-rail input or output or even a single supply op-amp. It is possible to run it from +/-5V (with some care) but not (reliably) from 0/5V.


Saturday 23 February 2019

RTOS for Arduino?


is there any project of an rtos that works on arduino ?




switches - Switch current rating AC vs DC


I'm looking for a high current DC switch (able to switch something like 5V@30A) and I've encountered several DPDT that might do what I need, however they are only rated for AC applications (3A@250VAC or 6A@125VAC). Are these rating convertible to DC? or is that something that only the facturarer would know?




resistance - What is the cause of voltage drop across a resistor?



We always assign a voltage drop to a resistor when a current goes through it in a closed circuit. I was wondering if this voltage drop is due to dissipated heat from the resistor or is there another reason?



Answer



The heat dissipation and volt drop are related, but I would not describe the dissipation as the cause of the drop. As electrons pass through a resistance, they lose energy as they interact with electrons in the conducting material. As energy is given up to the material, it gains thermal energy so its temperature rises. The moving electrons lose potential energy and hence there is a drop in voltage. This is similar to a gas passing through a narrow pipe, losing pressure and causing heating by friction.


design - Aside from cost, is there any disadvantage to using thicker wire than required?


Say I've calculated the minimum wire gauge necessary to give me an acceptable voltage drop over my length of cable run at the voltage and current my application will use.


Are there any disadvantages to using thicker cable, aside from cost? Is the answer different for AC vs DC? For power vs signal transmission?



Answer



Electrically, thicker is better in this case. However, thicker cable has other disadvantages beyond just the extra cost:



  • Less flexible. This makes it harder to install and harder to work with in general.

  • Bigger, which means it might not fit thru some small holes or tight places.

  • You get diminishing returns with AC due to the skin effect. Thicker is never worse than thinner electrically, but after some diameter the extra area gives you less and less return. This effect is proportional to frequency, so thicker cable is more useful for something like 60 Hz power as apposed to 10 kHz signal to a loudspeaker.



Friday 22 February 2019

arduino - wireless transmission underwater


I am looking into constructing a closed and small device with arduino sensors that goes underwater. It has to be submerged into water and back several times, and that is made by someone with a rope attached to it. So it needs a way to communicate to the surface that it reached the bottom, so that the person can start pulling. It is planned for it to go no more than 30 meters under the surface.


So I though that a wireless way to comunicate from underwater to the surface just for that would be nice, and not a big trouble (Like when the pressure stops changing a LED light on in the surface). But I know nothing about eletronics, so I need help. Is there a simple way to do it? What can I use? I would like to keep it small...



And I woudn't like it to have a wire...




fpga - Random bit sequence using Verilog


I want to generate a random bit sequence using Verilog. i.e. the random bit sequence would be composed of 1 and 0. Can someone guide me as to how to do it? Does anything equivalent of rand() in C/C++ exist in Verilog?


Update-1: FPGA is Spartan 3E Starter Kit



Answer



You probably do want something like the circuit shown by clabacchio.


This is easily rendered in Verilog as


reg [4:0] d;
always @(posedge clk) begin

d <= { d[3:0], d[4] ^ d[2] };
end

This is, as others mentioned, a linear feedback shift register, or LFSR, and it generates the maximal length pseudo-random bit sequence that can be produced with a 5-bit state machine. The state machine traverses 31 states (\$2^n-1\$, where n is the number of registers) before repeating itself.


Of all the states that can be encoded by 5 registers, only one is not used, which is the all-0's state. The all-0's state is a lock-up state --- if the state machine gets into that state by an error, it will be stuck permanently in the all-0's state, as you can see because 0 ^ 0 = 0. This means you have to be sure (using a synthesis directive in the Verilog or constraints file) that the registers don't initialize to the all-0's state.


If you need the all-0's state not to lock up, you can use an XNOR in place of the XOR gate, and get a sequence that includes the all-0's state and locks up in the all-1's state.


Also be aware that the longest run of 1's produced by this state machine is 5 in a row, and the longest run of 0's is 4 in a row. This can be important if you are using the PRBS to test a system with ac-coupling...longer runs will stress the system more.


In communications testing, longer sequences are more common, mainly to exercise more of the low frequency behavior of the system:


PRBS7


reg [6:0] d;

always @(posedge clk) begin
d <= { d[5:0], d[6] ^ d[5] };
end

PRBS23


reg [22:0] d;
always @(posedge clk) begin
d <= { d[22:0], d[22] ^ d[17] };
end


PRBS31


reg [30:0] d;
always @(posedge clk) begin
d <= { d[30:0], d[30] ^ d[27] };
end

Notice that it is not always the final two registers that are "tapped" to generate the incoming bit of the shift register.


Xilinx app note XAPP052 gives a handy table of connections to be used to generate any size PRBS from 3 to 168 registers.


App note XAPP211 shows how to implement them efficiently in Xilinx devices. Essentially, a single look-up table in a single logic block can be used to implement up to 32 registers worth of shift register (depending on architecture).


LFSRs can also be used to implement a counter efficiently if you don't care about the intervening states, just how long takes to count down to some terminal value.



arduino - Microcontroller soft off circuit not working - why?


I was making a board with an atmega328 mcu (to be used with Arduino libraries) to do some one wire communication stuff. Since I was etching the board anyway, I decided to try and implement a simple software off functionality, without putting much thought into it. Once I etched and assembled the board, my one-wire stuff works fine, but the software off circuit does not. I was poking around and I can't understand why it does not work.


The idea is that pushing a momentary push button (for 2-3 seconds), will connect the battery to the 5V regulator which in turn powers the MCU. The first thing the MCU does is set a digital pin high (line labeled PWR in the below diagram), to latch the N-MOSFET Q1 and bypass the push button switch. When the switch is released, the circuit should remain powered through the MOSFET.


What in reality happens is that pushing the pushbutton powers up the board as expected. The gate of the FET is driven to 5V by the MCU as expected, but as soon as the pushbutton is released, everything turns off. It seems that the FET is not bypassing the pushbutton for some reason, but I can not understand why? The FET Vgs is 1.8V, R6, R7 and D1 are there so I can use another push on the button to generate an interrupt on the BTN line, then drive the PWR line low and switch off the board.


So the question is what is wrong here? Why doesn't Q1 MOSFET stay latched once the pushbutton (connected to PWRSW header) is released? I'm certain it is not something complicated, but I just can not understand why - perhaps because I've been staring at it for too long...


Circuit Diagram



Answer



+5V with respect to GND is not high enough to turn on Q1, which is an N-channel MOSFET in the original schematic. The O.P. was thinking in the right direction, when he had looked-up the VGS. But with respect to what is the VGS taken? It's not taken with respect to GND. It's taken with respect to MOSFET's source is at +7.5V (or some such voltage required for the 7805). So, the if you drive the gate to +5V, then VGS < 0. It's negative. The N-channel MOSFET doesn't stay on, because it doesn't turn on in in the first place.


A high-side switch like this is usually done with a P-channel MOSFET and a second small transistor to control its gate. Like so:



enter image description here


(I didn't redraw all of the original circuit, but this should be enough to get the idea across.)


Measuring an AC-voltage at the ouput of a full bridge rectifier


I've a full bridge rectifier and I put the following function into it:



$$5\sin(100\pi t)\tag1$$


So, at the output I get:


$$\left|(5-2V_d)\sin(100\pi t)\right|\tag2$$


Where \$V_d\$ is the voltage over one diode.


Now, why do I measure (with a Fluke multimeter) a DC-voltage of \$1.4\$ volts and an AC-voltage of \$0.5\$ volts. Why do I measure an AC-voltage, is it not completely DC?




Thursday 21 February 2019

current source - Equivalent circuit?


Can I simplify this circuit to just one resistor? How can I find the equivalent voltage of the current source in this circuit?



schematic




frequency - What are 12.000393 MHz crystals used for?


I found them on www.digikey.com, and they're apparently made by different manufacturers, so there must be some use for them. What are they used for?


edit
and why? The 2400 baud modem doesn't offer an explanation: a 12 Mhz crystal is better for that than the 12.000393 Mhz.



Answer



Edit: After coming back to this question a week or so after the original post, I'm pretty sure that my answer here is incorrect. Please see the comments for the discussion. While most of the discussion is correct, my presumption in this answer about how frequency is specified by manufacturers seems to be incorrect. In particular, frequency is specified at the exact specified value of Cload, not at the mean frequency that can result from the range of tolerable C_load.





A crystal unlike an oscillator depends on user-provided load capacitance to determine its oscillating frequency:



Adding additional capacitance across a crystal will cause the parallel resonance to shift downward. This can be used to adjust the frequency at which a crystal oscillates. Crystal manufacturers normally cut and trim their crystals to have a specified resonance frequency with a known 'load' capacitance added to the crystal. For example, a crystal intended for a  6 pF load has its specified parallel resonance frequency when a 6.0 pF capacitor is placed across it. Without this capacitance, the resonance frequency is higher.



The capacitance tolerance range of the user-provided capacitance is centered around the capacitance's nominal value. The relationship between load capacitance and frequency, however, is not linear:


enter image description here


(For background info see the graph on page 4 and discussion on page 3)


In figure 2,



  • f is the nominal crystal frequency (in green),


  • C_load is the nominal load capacitance (in green), and

  • min and max (in red) denote the minimum and maximums of tolerance ranges.


The result of the non-linearity is that the frequency at the mean of the tolerance range of the capacitance (the purple line) does not correspond with the mean of the frequency tolerance range f.


It is conventional for manufacturers to define nominal values of components as being the mean of their highest and lowest tolerable values given a list of conditions. The given conditions for the crystal in this case are C_load +/- tolerance.


Relative the frequency at the nominal load capacitance (the purple line), the lowest tolerable load capacitance C_load_min results in a higher frequency shift upward (to f_max) than does the highest tolerable load capacitance C_load_max cause a shift downward (to f_min). This means that the nominal value of the crystal frequency f --which is defined by convention to be the mean of the highest and lowest frequencies -- will be slightly higher than the frequency that results if the load capacitance is exactly the nominal value of the load capacitance (the purple line).


That slightly higher mean frequency is where the numbers after the decimal point come from in the nominal frequency of 12.000393 MHz.


microcontroller - Issue with programming Atmega32u4 (lfuse memory not accessible using FLIP)


From my last question, I've managed to connect my Atmega32u4 to my computer.


Now, when attempted to initialise the bootloader using avrdude, I get the following error message:


j4cob-antergos :: ~ » sudo avrdude -p m32u4 -P usb -c flip1
avrdude: Warning: USB bDeviceClass = 255 (expected 254)

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e9587 (probably m32u4)
avrdude: Error: "lfuse" memory not accessible using FLIP
avrdude: Error: "lfuse" memory not accessible using FLIP

avrdude: Error: "lfuse" memory not accessible using FLIP
avrdude: Error: "lfuse" memory not accessible using FLIP

avrdude: Error: "lfuse" memory not accessible using FLIP
avrdude: Error: "lfuse" memory not accessible using FLIP
avrdude: safemode: Sorry, reading back fuses was unreliable. I have given up and exited programming mode

avrdude done. Thank you.

Now, I'm very confused. If I want to simply get a memory dump, I would've that the fact that the "Reading" loading bar reached 100% means that the memory was read, no?


I'm also not sure what the fuses mean. Am I using the wrong programmer? I'm using flip1, as you can see in the command.


Any help is much appreciated, thanks!


(If the circuit schematic is relevant, it can be found in my previous question, to which I linked at the top of this one.)





Power Supply Design - Multiple Voltage Regulators


I'm trying design a benchtop DC power supply for powering small projects, breadboards, arduino, etc. This is a list of what I want from it:



  • Fixed voltage rails for 24V, 12V, 9V, 5V & 3.3V

  • Edit: Current requirements: 1A will be alright, 2A I'll be happy with and anywhere close to the full 3A on offer from from the laptop power brick I'm using (see below) will be great.

  • Variable voltage rail from ~0V to ~24V


  • Pulse width modulation on the variable rail

  • Voltmeter panel on the variable rail

  • Power on indicator LED

  • USB ports for charging USB devices

  • (Other stuff that's not related to this question such as selectable methods for dealing with transient voltage spikes from using PWM to power inductive loads, adjustable PWM frequency ranges, etc)


I will use a 240V AC to 24V DC laptop power brick capable of outputting 3A.


To produce the desired voltages, I intend to use a linear voltage regulator for each rail, each taking 24v input from the power brick. An overview of my intended setup is shown below. Power Supply Design


The PWM circuit I'll be using will be powered from the 12V rail. The USB ports will come off the 5V rail. The power on indicator LED (not shown) will most likely come off the 3.3V rail.


Here are my questions:




  1. I'm assuming the voltage regulators should be in parallel, each taking the full 24V input, even though there will be a large difference between input and output for a few of them (eg 24V to 3.3V). I thought about putting them in series so that the 12V output of the first regulator would feed the 9V regulator which would feed the 5V regulator and so on, but the circuitry of each regulator block in my diagram above would divide away some current, leaving me with very little of the 3A max input for the lower voltage rails. Is this correct? I'm also assuming that the larger reductions in voltage necessary for the parallel arrangement as shown will produce more heat than in series, but each regulator will have a nice fat heatsink and the whole thing will be enclosed in something with at least a fan or two and plenty of holes for ventilation.

  2. The variable voltage rail will be controlled with a potentiometer into a variable voltage regulator (LM350). Should I use different fixed voltage regulators for my fixed voltage rails, or use an LM350 for each, and set their outputs with either fixed resistors or trim pots?

  3. As the laptop power brick I'm using outputs 24v already, shall I wire that directly to an output terminal for my 24V rail, or should I also put a voltage regulator in there? Ideally, there'd be no point regulating 24v to 24v, but I'm not sure how reliable the voltage is from a laptop power brick. I'm not even sure you can get out of a regulator exactly what you put in - there must be some voltage dropped along the way. If necessary, is there another way I could ensure a constant 24v output?

  4. I saw a tutorial somewhere a while ago where someone hooked up a voltmeter to a psu, but the instructions mentioned using a 9v battery and a relay to power the voltmeter rather than drawing power directly from the internals of the PSU. Should I do this? There was no reason given in the tutorial I read. As mentioned above, I was going to draw power from the 12V rail.

  5. Is there anything missing that could be considered essential to the design of a power supply? Any kind of safety features? The LM350 appears to be rated for 3A and has inbuilt overcurrent protection. I'll also be adding fuses to each rail. Will this be adequate in the event of a short circuit within any external load (eg poorly wired breadboard, etc)



Answer



I agree with others that switchers are a better choice in terms of efficiency, but they can be somewhat complicated to deal with if you're inexperienced, and there can be lots of weird effects that aren't immediately obvious (precharge sinking, beat frequencies, etc.) that can make life difficult. Assuming you've figured out your power dissipation and know how much current each rail can deliver, if the linears will work for you, stick with them (at least for the first pass).


If you're trying to achieve a variable-amplitude square wave output on your adjustable rail, the chopping may introduce noise into the main 24V rail, which could show up on the other rails. You may want to have an LC filter between the main 24V rail and the regulator input to provide high-frequency isolation, and will probably need extra capacitance on the adjustable regulator output (bulk electrolytic as well as low-impedance ceramic) if you expect the square wave edges to be sharp.



1, 5) There are some dangers with your scheme.


Power dissipation in the linear regulators will be


\$(V_{out} - V_{in}) \cdot I_{out} \$


which is significant, especially for the lower output rails. 78xx-type regulators have built-in thermal protection around 125°C, and (without heatsinking) a junction-to-air thermal resistance of 65°C/W. Your thermal management will be challenging.


Another potential problem - if the series-pass element in any of your low-voltage regulators fails or gets bypassed (shorted), you'll present the full 24V input to the output. This could be catastrophic to low-voltage logic. You should protect your low-voltage rails with SCR crowbars that can sink enough current to put the DC/DC brick into current limit and collapse the 24V rail (they'll need big heatsinks too). Fuses are unlikely to be good protection since the 24V brick likely isn't stiff enough to generate the \$I^2 \cdot t\$ needed to blow a fuse.


2) Whatever floats your boat.


4) Meters aren't huge loads. Just use one of your rails.


3) Correct - all regulators have headroom requirements. If you want the maximum 24V out, you'll need a direct connection, and will have to rely on whatever intrinsic protections the brick will provide you.


Wednesday 20 February 2019

What can happen to a relay at temperature outside of its spec?


I am building a system for measuring some parameters in a climate chamber. The test runs from -55 to +125°C. I need to switch some signals between multiple devices under test using relays. I want to avoid using exotic or expensive parts.


I can find "generic" relays rated from -40 up to +105°C. I will be switching low voltages (below 12 V) and low currents (below 100 mA) most likely with a relay rated for 230 Vac and 16 A. Switching speed is not important.


I know that the plastic can melt, but I wonder what else can happen to a relay when it is used at a higher and lower temperature than specified?




Collector currents of different BJT Models and Ebers-Moll



Per Horowitz&Hill book, the Ebers-Moll equation for the collector current in a BJT is:


Ic = Is (e ^ (Vbe/Vt) - 1) where Ic is the collector current and Is is the saturation current.


Now, I am sure different BJTs (say, 2N2222, 2N3904, BC548,...) produce different amounts of collector current for the same value of base-emitter voltage Vbe.


(Q1) Would it be fairly correct to model those differences just by taking different values for Is?


In some books, the equation includes an ideality factor in the exponent. So, the equation gets written as Ic = Is (e ^ (Vbe/(n*Vt)) - 1) where n is the ideality factor. With that, the differences in collector current values for different BJTs can be accounted for by selecting different ideality factors while taking Is to be the same. That leads to my second question: (Q2) Is it more accurate to model the differences in collector currents by taking different values for Is or by taking different values for the ideality factor?


Thanks! P.S. My context: I am writing a simple simulator for BJTs.




wearable - Cheapest, simplest way to implement a Bluetooth keyboard/mouse?


Thinking of building a device for sending text and probably mouse movement into a computer, but I want it to be wireless and compatible with many computers/PDAs/phones without a specialized dongle, etc. So I thought "Hey, Bluetooth is a standard for input devices and lots of computers/PDAs/phones have it built in!" But how to get the data into the Bluetooth on the other end?



  • I could buy a Bluetooth IC and build a PCB for it, but I can't even find a place to buy them in small quantities, or find documentation without being part of a company and signing NDAs, etc.


  • I could learn the very popular Arduino with the Bluetooth adapter, but this would cost $149.95, which is not what I had in mind, and I don't know if it can even act as a keyboard/mouse.

  • I could buy a cheap USB keyboard and take it apart, figure out how the keys map to the data lines, and just stimulate them appropriately. Mouse is not so easy, though.


The last seems like the best, but do you have any other ideas?


I do not want a generic serial-over-Bluetooth board, unless it can be configured to look like a standard Bluetooth keyboard/mouse at the other end.



Answer



You'll find this is often the case, when you try to build something from off the shelf parts that duplicates an existing product, almost always the parts alone will cost more than the existing product. The reason being that they can mass produce their product, buying parts in bulk cuts down on costs etc.


Look closely at the 'serial-over-Bluetooth boards', some of them do in fact support different profiles. What you are looking for is a module that supports the Bluetooth HID profile (Human Interface Device, aka mouse, keyboard, joystick, wii remote, etc).


Check out this previous question, it lists several bluetooth modules, which you can buy in single quantities for fairly reasonable prices, some or all of them should support HID.


microcontroller - I2C setting MCU as both slave and master at the same time


Hello everyone I'm working on a new project with the TI MSP432P401R microcontroller. I want to have 2 separate I2C buses. I2C bus 1 will set the MCU as the master, whereas the DAC and the pressure sensor as slaves. Then I2C bus 2 will set the same MCU as the slave, and the SmartPort as the master (more specifically a device that we connect to the SmartPort will be the master). I'm not sure how can I make the MCU both a slave and a master at the same time. What I tried to do was, I defined 2 different eUSCI_b modules


void I2C_init(void)
{
/* Initialize USCI_B3 and I2C Master to communicate with slave devices*/
I2C_initMaster(EUSCI_B3_BASE, &i2cConfig);

/* Disable I2C module to make changes */
I2C_disableModule(EUSCI_B3_BASE);


/* Enable I2C Module to start operations */
I2C_enableModule(EUSCI_B3_BASE);

/* Initialize USCI_B3 and I2C Master to communicate with slave devices*/
I2C_initMaster(EUSCI_B0_BASE, &i2cConfig);

/* Disable I2C module to make changes */
I2C_disableModule(EUSCI_B0_BASE);


/* Enable I2C Module to start operations */
I2C_enableModule(EUSCI_B0_BASE);

return;
}

where i2cConfig is


const eUSCI_I2C_MasterConfig i2cConfig =
{
EUSCI_B_I2C_CLOCKSOURCE_SMCLK, // SMCLK Clock Source

48000000, // SMCLK = 48MHz
EUSCI_B_I2C_SET_DATA_RATE_400KBPS, // Desired I2C Clock of 100khz
0, // No byte counter threshold
EUSCI_B_I2C_NO_AUTO_STOP // No Autostop
};

and then tried to use this function for each module I defined to add slaves. But the thing is, the function only allows me to enter one slave address, but for my I2C bus1, I have 2 slaves: DAC and the pressure sensor.


extern void I2C_initSlave(uint32_t moduleInstance, uint_fast16_t slaveAddress,
uint_fast8_t slaveAddressOffset, uint32_t slaveOwnAddressEnable);


I would be very grateful if someone can help me with this problem or show me a better way to implement the same MCU as both a slave and a master at the same time. I'm new to programming with the I2C protocol and I'd appreciate any help. Thank you and have a great day.



Answer



You are not thinking about the problem quite right. You are not setting the MCU to be a slave, you are setting one I2C interface module (one eUSCI) to be a master and another eUSCI to be a slave. The MSP432 itself is neither master nor slave, it just talks to the two eUSCI blocks.


There are two notions of slave address. One is the slave address that the master (you) uses to communicate with some other device, like a temperature sensor. That slave address is used just for the duration of the communication with the particular slave, and then is loaded with a different value when you want to talk to some other sensor or peripheral device. There is no need to store the addresses of all slave devices in eUSCI registers.


The other notion of a slave address is used when your eUSCI is acting as a slave device and some other gadget will be the master. In this case the slave address is more or less permanent and must be defined as part of the initialization, so that the eUSCI can recognize when the external master is sending a message to it.


So, you can treat the two eUSCI modules as being completely independent. Their SCL and SDA signals are independent, and the operation of the two I2C busses can be completely different.


Does lead battery + trickle charger = UPS?



I have some bits laying around and need to build a 12V constantly on power source to run some circuitry. I have a sealed lead acid (SLA) battery (12V 7Ahr) and an intelligent trickle charger specifically designed for SLA batteries. The trickle charger can supply about 1A maximum charge current. The circuitry that will run constantly draws about 100mA, but very occasionally will draw 3A for 15 minutes.


Can I just run my circuitry off the SLA whilst it is permanently connected to the trickle charger which is then permanently connected to the mains?




Tuesday 19 February 2019

Better way to divide voltage for input to an ADC DAQ?


I would like to monitor relatively higher voltages (up to 160V) using an ADC type DAQ. Most DAQs that I come across can handle around 5-10V of analog input, requiring the voltage to be divided. Here is one I like https://labjack.com/products/t7 . I was planning on running a simple voltage divider to an op-amp buffer (voltage follower) and finally into the input of the DAQ.


My thought is to use something like 3.3 MOhm (R1) and 105 kOhm (R2) to divide the 160V by ~32 (~5V). Then run that output to an op-amp voltage follower and finally into the input of the DAQ. I'm not sure how to size the resistors since the op-amp buffer should be high impedance and limit the current draw. I sized them so big to ensure I'm not drawing much current. Since I am monitoring the voltage, I do not want to load down the source. I want to know if this is a good way to do it, and if there are any better ways.



Answer



Yes, an op-amp unity-gain buffer is a reasonable approach in the ADC does not have a high-impedance input.


The minimum value of the sum of the two resistors is determined by how much current you can draw from the source without unduly affecting the accuracy. The power dissipation might also come into play if the resistors are low value.



The maximum value of the two resistors paralleled is determined partly by how much error you can tolerate due to op-amp bias current and/or leakage. Also practical considerations (resistors of lower value tend to be more stable, at least down to 1M or 100K). For example, metal foil resistors are not available much above 100K.


For relatively low accuracy applications, a few M ohms is fine, and the bias current error will depend on the op-amp you select.


If you follow their app note on the op-amp part (looks like there is an error in the plain divider calculation) they suggest an OPA344 - bias current should be less than 1nA at reasonable temperatures, which implies (for < 0.5LSB error on a 12-bit converter):


\$R1||R2 < \frac{5.0}{2^{-9} \cdot 2^{13}} \approx \$ 30K


Your 105K || 3.3M ~= 100K would have a bit more error at high temperatures, but still should be acceptable for most purposes.


manufacturing - Why are we still using resistors with %5 tolerance while they can even manufacture a 14.318182MHz crystal?



Year is 2012 and I can only find %5-tol resistors in the local market. They can make transistors at molecular scale, they can manufacture 14.318182MHz crystals, they can place trillions of flip-flops inside a memory chip.


Then why don't they start manufacturing %0.01-tol resistors? Is resistor manufacturing a more difficult job compared to the ones I mentioned above? What is the reason for still manufacturing %10-tol and %5-tol resistors?


(I'm asking this because I learned that the following circuit may not work because the resistor values may differ greatly from the rated ones.)


Schematic



Answer



One more point worth considering: Maybe there's a problem with the local market?


In my local market, I have no problems getting 1% resistors and sometimes there's a larger choice of 1% resistors compared to 5% resistors. It's not always the question of can it be made but will people buy it too. Maybe your merchants for some reason believe that not enough people will buy 1% resistors, so they don't bother having them in stock (Basically what's it worth to them to have a part in stock when others sell well enough?) or they may be just lazy*. Maybe very small amount of people actually expressed their desire to use such resistors. Maybe people are so used to 5% resistors that they don't feel the need buy more expensive resistors since they haven't actually had the chance to see them in action.


Perhaps there's a non-obvious way for those resistors to enter your local market? Here where I am, we have companies that specialize in obtaining components which nobody else has in stock in amounts low enough so that working directly with foreign distributor would be too expensive.


Since we know that 1% and better resistors are commonly available in some parts of the world, the reason could be something specific to your market.


*For the end a short story about human nature possibly related to this issue: I lived in another country for several years and found there a brand of printers that I like very much. When I returned to my homeland, I noticed that nobody even heard of that brand. It so happened that I stumbled upon the office of the distributor for that brand and talked to them for a while. I was basically told that they're not expanding since they already have enough customers to sustain their company and that they don't want to bother having more customers than it's necessary for them to continue existing.



arduino - Can I use TI&#39;s cc2541 BLE as micro controller to perform operations/ processing instead of ATmega328P AU to save cost?

I am using arduino pro mini (which contains Atmega328p AU ) along with cc2541(HM-10) to process and transfer data over BLE to smartphone. I...