Sunday 31 January 2016

usb - MCP2200 doesn't work everytime


I have designed a PCB which has LM1117 (for 3.3V), Micro USB connector, MCP2200 usb-to-uart bridge, 12 MHz SMD crystal and few passive components.


We have been observing the PCB for some weeks and observed that the PCB doesn't work everytime. When I connect to any system, sometimes system throws an error "USB Device not recognized" (in windows) or "Device read/write descriptor failed" (in Linux) and then it doesn't work for hours and start working after sometime. I have reviewed my circuit and didn't have any solution to solve this issue. After resoldering the board and replacing old components several times, we have ruled out soldering/component issue. I think somehow the crystal is not able to start or there could be some race condition between voltage at Vcc and RST pin but I am not sure how to find the real problem and solve it with MCP.


The schematic of MCP2200 is shown below:


enter image description here



The layout of my PCB: (MCP2200's Pad is in green and left side of the picture with USB connector at top left corner)


EDIT:


The crystal that I am using is this.


enter image description here




Relay vs. Transistor?


Rather basic, I'm afraid, but when would you use a relay, and when would you use a transistor? In a relay the contacts wear out, so why are relays used at all?



Answer



Relays are on-off devices. Transistors can have their voltage drop varied.


Relays are far slower than transistors; typically 50ms to switch, and probably more. Some types of transistors can switch in picoseconds (almost 10 orders of magnitude faster.)


Relays are isolated. Transistors can be (e.g. SSR), but are often not.


Relays are electromagnetic and bring problems with them - for example, try building a relay computer with many relays. You will find that relays will interfere with each other in some cases. Transistors are not very EM sensitive. They do not emit much electromagnetic interference.


Relays consume a lot of current in the "on" state, most transistors do not.


electromagnetism - How to determine the force of a solenoid based on inductance


I'm looking to potentially build my own small solenoids, I thought perhaps that I could take an Air core inductor, a spring, piece of plastic, and conductive core and build my own. Is there a way to determine force based on inductance and current (or power).



Answer



Force calculation:


\$F=(N*I)^2\mu_0\dfrac{A}{(2g^2)}\$


Where:


\$\mu_0=4\pi*10^{-7}\$
\$F\$ is the force in Newtons

\$N\$ is the number of turns
\$I\$ is the current in Amps
\$A\$ is the area in length units squared
\$g\$ is the length of the gap between the solenoid and a piece of metal


From this calculator


Inductance calculation:


\$L=\dfrac{d^2*n^2}{18d+40l}\$


Where:


\$L\$ is inductance in micro Henrys
\$d\$ is coil diameter in inches

\$l\$ is coil length in inches
\$n\$ is number of turns.


From this calculator


power - Should I multiply by time to determine Watt-hours?


I have done an experiment with solar panels over the course of the day to determine the total power output in Wh. I measured voltage and current through my solar panel circuit using a multimeter every half an hour. I multiplied these together to find the power being generated each half hour of the day. Assuming the power rises and falls linearly between each measurement, I determined the energy for each half hour is equal to 30 times the power at the mid-mark (either 15 or 45 minutes into the hour). Now, to determine the total energy in Wh the panel produced during the day, do I multiply the result of the previous operation by 0.5 hrs and then add all the interval's power together or can I just add them all together without multiplying by 0.5 hrs?




Saturday 30 January 2016

arduino - Why does my circuit work on a breadboard, but not on a perfboard? I am new to soldering


I'm a total beginner when it comes to soldering, and recently I've been trying (and failing) to solder together a simple circuit I put together for a Raspberry Pi sensor.


circuit on a breadboard


Although it works fine on the breadboard, when I solder it onto one of my perfboards, the sensor no longer turns on.



Circuit on a perfboard


Here is a topdown view of my soldered circuit:


Connections


Here is a view of the connections (the red block is just covering up old connections from past attempts):


Connections


More pictures of the connections.


What might I be doing wrong?



Answer



Everyone here is right. The perf board you are using does not contain the connections between pads like the bread board. If you got rid of the solder mask you would see something like this: enter image description here


You have to make the connections manually or buy this type of perf board. Notice how it has the connections made in copper?



enter image description here


motor - RPM counter using 8051 microcontroller


I am building a RPM measurement unit using 8051 micro controller. I want to measure RPM of AC motor. I have connected proximity sensor to get the pulse for each turn.


I have connected the proximity sensor output to the counter of micro controller. And I am calculating the 1 sec delay using Timer.


For each second I am calculating the RPM = pulse count[counter value] * 60.


Ex: If pulse count = 16, I am getting RPM = 960 r/m If Pulse count = 17, RPM = 1020 r/m.


Here I am getting difference of 60 r/m.


Using the above method, I can't measure RPM of 1000 r/m. Since pulse count * 60 will not be 1000 at any given point of time.


Please advise me how I can measure RPM in precision manner.



Thanks Umesh




Friday 29 January 2016

hardware - What are the most common ways to fry an arduino?



I've fried two Arduinos before: one was an Uno, which I killed with too high of an input voltage, and the other was the ADK version of the Mega, which I never was able to conclusively determine what went wrong. This got me thinking: what are some things (perhaps not immediately obvious) that will damage Arduinos?




stm32 - USART6 STM32F746NG isn't working


I'm having trouble configuring the USART6 in my STM32F746NG. I am setting up the USART6 to enable UART comunication, using the code below to initiate it and also create an echo function.


    __USART6_CLK_ENABLE();


GPIO_InitTypeDef GPIO_InitStructure;
GPIO_InitStructure.Pin = GPIO_PIN_7;
GPIO_InitStructure.Mode = GPIO_MODE_AF_PP;
GPIO_InitStructure.Alternate = GPIO_AF8_USART6;
GPIO_InitStructure.Speed = GPIO_SPEED_HIGH;

GPIO_InitStructure.Pull = GPIO_NOPULL;
HAL_GPIO_Init(GPIOC, &GPIO_InitStructure);

GPIO_InitStructure.Pin = GPIO_PIN_6;
GPIO_InitStructure.Mode = GPIO_MODE_AF_OD;
HAL_GPIO_Init(GPIOC, &GPIO_InitStructure);

static UART_HandleTypeDef s_UARTHandle;

s_UARTHandle.Instance = USART6;

s_UARTHandle.Init.BaudRate = 115200;
s_UARTHandle.Init.WordLength = UART_WORDLENGTH_8B;
s_UARTHandle.Init.StopBits = UART_STOPBITS_1;
s_UARTHandle.Init.Parity = UART_PARITY_NONE;
s_UARTHandle.Init.HwFlowCtl = UART_HWCONTROL_NONE;
s_UARTHandle.Init.Mode = UART_MODE_TX_RX;
HAL_USART_Init(&s_UARTHandle);

char generic_buffer;


for (;;)
{
HAL_UART_Receive(&s_UARTHandle,generic_buffer,1, HAL_MAX_DELAY);
HAL_UART_Transmit(&s_UARTHandle,generic_buffer, sizeof(generic_buffer), HAL_MAX_DELAY);

}

But the code is not working, is there something missing in the configuration? I'm using the same code that worked in my STM32F407VG, changing the USART name and pins.




rohs - How to calculateestimate thermocouple junction of a solder junction between a PCB and a component


Thermal junctions between two dissimilar metals on a PCB can create voltages. How do I estimate or bound (by estimating a max voltage via a max temperature) the thermocouple effect on a pcb?


Most solders don't list a number for the Seebeck coefficient. AOE does list Sn-Pb solder as 5uV/C but not lead free (Sn 97%).


How can I calculate the thermocouple effect for lead vs lead free solders? Is there a way I can minimize this effect?


enter image description here



Answer



I found this post here which contains some really useful experimental for thermal EMF values for different solders.



Measurements have been done between water ice point and boiling point with Agilent 34401A. I don't expect the curves be linear, but here it's assumed they are.



Copper - Sn96.5/Ag3/Cu0.5 -> 3.35uV/K
Copper - Sn95.5/Ag3.8/Cu0.7 -> 3.22uV/K
Copper - Sn60/Pb40 -> 3.34uV/K
Copper - Pb92.5/Sn5/Ag2.5 -> 3.02uV/K
Copper - Sn99.3/Cu0.7 -> 3.43uV/K
Copper - Sn96/Ag4 -> 3.33uV/K
Copper - Sn42/Bi57.6/Ag0.4 -> 4.43uV/K (thanks to Herbert)
Copper - Sn100C (Sn-Cu-Ni+Ge) -> 3.45uV/K (thanks to Dan)
Copper - Brass -> 3.30uV/K
The best one keeps to be the Pb92.5/Sn5/Ag2.5, the best between the lead free ones is the Sn95.5/Ag3.8/Cu0.7.



If someone has other alloys to suggest me to test I'll be happy to do it (I have just ordered the Sn97/Cu3 to see if higher copper content is relevant).


I'll be very happy to pass all the samples to a fellow who wish to repeat the experiment, provide that he/she will post results here and in turn, will pass everything to the second one who will do the same.


Andrea



Source febo.com (again)


So in my case: By switching to a lead free solder, I am only going to be 10% worse in my thermal error source. But only if I get a lead free solder with a silver alloy. Bismuth is clearly something to stay away from if thermal EMF is a concern with an error of 45% more than lead solder.


The best way to minimize thermal EMF in a post lead world is with Sn95.5/Ag3.8/Cu0.7 solder.


vlsi - Why delays cannot be synthesized in Verilog?


I have always read that delays declared in RTL code can never be synthesized. They are meant only for simulation purpose and modern synthesis tools will just ignore delays declarations in the code.


For example: x = #10 y; will be considered as x = y; by the synthesis tool.


What are the reasons delay declarations in any hardware description language (for example, VHDL, Verilog or Sytem-Verilog) cannot be synthesized?




pcb - Disposal of the used acid/hydrogen peroxide etchant?


This thread repeated the question how to dispose the used acid/hydgogen peroxide etchant. So how can I dispose acid/hydrogen peroxide etchant?


Perhaps interesting thread to other readers, Disposal of ferric chloride etchant.



Answer




Disclaimer: This suggestion does not cover all aspects that may be required by your local regulations.


However, with any type of etchant, the most troublesome part is the one about the dissloved copper ions.


As long as you don't pour big amounts of strong basic or acidic solutions down the same drain, no heavy recation will start and cause dangers. Thinning any base or acid by adding large amounts of water will usually make them easy to handle. (Think concentrated acetic acid vs. salad sauce: Same chemistry, just a different concentration!) This applies to pure bases or acids. Your used etchant is more than just a hydrogen donor (acid), it contains copper salts!


Long story short: The pure etchant is usually not a very big deal, the copper ions are very toxic to anything in the nature (including yourself).


Related: Safety of making PCBs


capacitor - How to calculate equivalent capacitance to a battery?


I have a 1.25V 2Ah battery and I'm trying to calculate a equivalent capacitance with rated voltage of 2.7V for each of those batteries. This is what I did:


Work of Battery = \$1.25V \cdot 2A \cdot 3600s = 9000J\$


From the capacitor work equation:


$$W = 0.5 \cdot C \cdot V^2$$


$$9000J = 0.5 \cdot C \cdot 2.7V^2$$


$$C=2469.1358F$$


Is this correct?




wifi - Wireless Sensor to Internet


Looking for a low cost implementation to post ambient temperature readings from a sensor to servers via a COTS router.


1) Have a temperature sensor connected to a micro controller which sends data via a Wifi Module with a TCP/IP Stack to servers 2) Have a temperature sensor communicated via Zigbee to a coordinator that is plugged into a router and communicates with the servers.


Would like to keep the cost of the solution below $20. Another constraint is the battery life. Wifi modules with TCP/IP consume more power and cost more.


What particular devices/chips/microcontrollers would you recommend to solve my data communication problem and fit within my budget?




Thursday 28 January 2016

Speed control for PSC induction motor


I would like to control the speed of my PSC induction motor.


I found a similar topic here: varying run capacitor for speed control of single phase motor


However I would like to modify the speed while the motor is running.


Something based on Temic's U2008B perhaps?


Any suggestions?



Thanks,


Juan



Answer



If you want to control a fan blower, then a phase control is most suitable for inexpensive approach. I have seen poultry houses running ventilation on single phase induction motors with U2008 circuit. Also the small fan blowers in the home pellet/wood burners, they all use shaded pole fan with phase control.


In theory, using the phase angle control, reduces the voltage on the motor thus the output torque is decreased with square of voltage. Also the required torque for fan is square related vs speed, so if you combine both voltage control of induction and fan load, then you have a good result.


Also the VFD, when used to power the fan is usually adapted to give a quadratic V/f output characteristics.


IMO, don't spend money on VFD for fan blower if it's not bigger than 2 kW.


books - How does one get started with electrical engineering?




Total beginner here. I know absolutely nothing about anything, but I want to build stuff. Preferably for cheap. Books, kits, anything?




high voltage - Why does arcing occur on helicopter power-line repair



I saw this video, where a guy did power line inspection from a helicopter, which is isolated from ground. When he held out a "magic wand," a small amount of arcing came off of the power line to the helicopter.


Helicopter Repair magic wand



This got me confused, though, because I thought since he was isolated from ground, the power would not want to go anywhere. enter image description here


The helicopter simply has no relationship to ground.


So, why does the Magic Wand arc to the helicopter?




mosfet - Parasitic Capacitor current of an inductor


LS turn on with load ind of lower parasitic capLS turn on with load inductor of higher parasitic capacitanceI am doing a double pulse test on SiC MOSFETs from 100-800 V and current from 20-80 A. The schematic is shown in figure (the values are not correct though). In my first round of tests (Figure 2), I was getting rather oscillatory switch current for lower switch (measured with rogowski coil of 30 MHz bandwidth). When I replaced the inductor in circuit to an option with lower parasitic capacitance (had more distance between winding turns), the switch current curve improved considerably (Figure 1). This made me believe that a part of those oscillations were because of parasitic capacitance of the inductor. To confirm this, I wanted to check the inductor current difference in both the situations, so I probed with another rogowski coil at the inductor with each inducor but IL wasn't really oscillatory and there was no difference in IL with either of the inductor. I repeated this with a current probe (50MHz) but still no difference. The figure with load current is not attached. Is this a bandwidth issue? My ride time and fall time are ~50 ns



MOSFET DPT




Bleeder resistor: switch resistance on when capacitor is powered off?






Possible Duplicate:
How to discharge smoothing capacitors?



I have an aluminum capacitor (~600-800uF) smoothing a DC current (~60-70V, ~50-70mA). I have a resistor in parallel to drain the capacitor when powered off. It is important that this capacitor is drained quickly (under 3 sec) when powered off and also that it provides maximum power when powered on.


I've learned that using a lower resistance drains the capacitor quicker but sacrifices running power as wasted heat. On the other hand, a higher resistance provides optimal power and minimal heat but simply drains the capacitor too slowly.


Is there a simple (cheap and small) way to switch a resistor on only when the capacitor needs to be drained? This way maximum power can be achieved and the bleed time can be precisely controlled.


Thanks!




pcb design - Hide particular airwires/nets in eagle


Is it possible to hide particular airwires in eagle, without hiding all of them?


So if there's a net I am not currently interested in, but it has a lot of connections, confusing where other airwires go, I can hide it. I am wanting to do this for GND and +V but, don't want to run ratsnest resulting in a pour.


Any ideas?



Answer



Yep, and it's pretty straightforward. Just click on the Info button enter image description here, select the airwire you want to hide, and click on the "Airwires hidden" checkbox. All airwires on that same net will be hidden. enter image description here


Obviously this is a do-at-your-own-risk. You'll have to remember to explicitly un-hide the airwire later to do the routing.



configuration - Error when using debugging under Atollic TrueStudio / STM32



I'm using



  • STM32F103C8T6

  • Atollic TrueStudio

  • STLink2.1


Error I get when debugging:


enter image description here


Debug configuration set in TrueStudio:


enter image description here



What worked before was in SW4STM32/Eclipse, with the following settings. I always had to change the reset mode from Connect under Reset to Software System Reset. However, this option is not available in the debug configuration of True Studio.


What can I do to use debugging successfully with STLink2.1 on Atollic TrueStudio?


Pic



Answer



I found the answer elsewhere but I will repeat it here for other people:



  • Close Atollic TrueStudio (not sure if this is needed)

  • Startup ST Utility

  • Press the Reset button and keep it pressed

  • Select Erase Chip (in Target menu)


  • Release the Reset button

  • The chip is erased

  • Close ST Utility

  • Startup Atollic TrueStudio


Debug should work now


over current in 26 AWG (pulsed)


I am using a 26AWG wire for an application. As per specifications a 26 AWG wire can carry, 2Amps max. Supposing I connect a load of 3Amps. For how long will tis be sustained by the said wire ?


The current is applied in pulses in this application, of 25 mSec max.


I mean is there any way I can calculate the time taken before the wire burns out ?




Answer



It is nice to see all theoretical considerations and suggestions for experiments to determine thermal constant of insulated 26 gauge wire. Of course the precise result will depend on ambient condition, whether it is in still air or under some airflow, etc. However, all this work already has been done in Electrical Engineering, and results are well documented. For practical considerations I would suggest the following Wikipedia page.


From this page, the 26 AWG wire will burn up at about 20 A in 10 seconds, and hold up to 218 A for 32 ms.


So, to answer the direct OP questions, there is nothing to worry about 3 A for a surge of 25 ms long.


Wednesday 27 January 2016

Chaining limit for shift registers in large led matrix


I am thinking of trying to build a large led matrix in a way that is both modular and scalable (maybe up to around 100x100, or 500x16).


My thought is to make a single 8x8 module that I can make a few at a time as budget allows. Each module will simply pass its rows and columns through to the adjacent modules. I will use shift registers (595 or similar) on the end modules only to drive the columns and the common cathodes on the rows.


Is there a limit to how many shift registers I can chain in a row, or will they pretty much extend indefinitely? Are there any limits other than the time required to shift out an increasing number of bytes? As the number of columns increases the time to shift out that many bytes increases, so I could imagine needing a heavier microcontroller to shift out larger displays at higher refresh rates. I am not too worried about that. My initial design will use an arduino, but I can move to a heavier 32 bit mcu as I need it.


My main concern is current. If I only am driving one row at a time, does it matter how many rows I have connected to each column? Do I need to adjust my resistor values as the matrix scales up, or add more resistors per column? Does my power supply need to get bigger the more leds I add?



Answer



As the number of shift registers grows, it will become necessary to shift data through them faster in order to achieve a particular frame rate. This will in turn increase the amount of current required by each shift register.


It would probably be a good idea to use a partially-parallel arrangement. If the CPU can clock out eight or sixteen bits in parallel, that will reduce by a factor of eight or sixteen the number of bits that have to go through each shifter. It may also be useful to design a circuit which will take every eight or sixteen bits shifted in and send one to each of eight or sixteen shifters. Applying such circuits even one or two deep will greatly minimize the number of rapidly-switching signals required.



My inclination would probably be to use boards of e.g. 64x8 LEDs, multiplexed 64x8. Boards could be chained to a certain depth, but I probably wouldn't recommend chaining all 64 boards together. If the goal is a 128x64 grid, it might be reasonable to have eight pairs of 64x8 boards chained together, and output one bit to each pair simultaneously (so 128x8 bits for each 1/8 frame). I would suggest that the mutliplex timing be controlled by a master device, but each 8x64 panel should include its own row drivers along with some circuitry to limit each row's duty cycle to a maximum of 16% or so (when all is working properly, the duty cycle should be 1/8).


diy - inkjet cartridge control



I would like to build this:


https://www.youtube.com/watch?v=UjlHtHAN0DU


I.e. a programmable stamp/printer that you slide along a piece of paper. I would like for it to use easily obtainable cartridges, such as HP.


I looked around and found this: http://spritesmods.com/?art=inker&page=1 which is really cool and all, but I would like to better understand and control the cartridge. (The way he discovered how to control the cartridge was to cover some parts with sticky tape and "probe" to see what part does what.)



Does anyone know of some commercially available electronics that allows you to control the cartridges?



Answer



There are commercially available chips but... you need to be a volume customer to get at them. My suggestion to you would be to go get the cheapest possible HP inkjet printer, the cheaper printers have simplier control systems. Then probe the lines that go to the black and white cartridge with a scope.


The internal resistive elements are driven by firing pulses from an IC on the mother board. Usually around 24-36V but it varies. These short pulses heat the element and spew ink out the nozzle. There's a matrix for the simple cartridges that lets you select each element.


It's simple enough that even in the lab you can use a power supply to put a short pulse on a firing line and the cartridge will spit ink for you. The length of the firing pulse is important, too short no ink, too long way too much ink, way too long burned out element.


Behind the chips that drive the head is a controller, it's job is to take the print data, be it an image or the image data sent down from the print data and convert it to low voltage versions of the firing pulses. Of course there's image processing magic in there too but if you're just doing a stamp you don't have to worry about that. Anyway the controller comes up with the firing pulses that are then fed to the high voltage pulse creating circuitry (a custom IC in the printers case). Here's one that can be found at digikey albeit out of stock...


So that's kind of what you'll need to come up with. A method to convert your picture or drawing into firing pulses, and some circuitry that will convert those low voltage pulses into higher voltage pulses to drive the heads.


I should also mention that there's more to inkjets than just printing, maintenance is an important part of keeping the head from drying up. That's that strange thing your printer does whenever you turn it on or before it prints. Usually this involves spewing ink out of itself into a pad at the bottom of your printer, then having a wiper arm wipe itself off.


You won't find any datasheets on inkjet heads, it's all under NDA, even then they won't tell you anything too useful and you have to reverse engineer a lot of things. So that's what you're in for, I've reverse engineered many inkjet systems and wedged my own electronics in there to control things so it can be done.


If you're a company and not just a guy working on this, there are programs for low volume custom inkjet based products but you need to have $$$ or connections to find your way in.



I've always thought inkjet printers are more complicated than most people think :)


switches - Programmable point to point connections


I have an idea for a programmable breadboard, but I am not sure of the feasability of it. My thought is to connect each strip of a breadboard to some type of circuit that can make arbitrary connections in software. This would eliminate a lot of the tedious wiring associated with quick prototyping.


I have a few ideas, all of which seem prohibitively cost or wiring heavy.


For a breadboard with N strips I could:




  1. Use an array of analog switches for each possible combination of wires. This is not quite N^2, but its not far off. A lot of switches may get expensive fast.

  2. Make M connections possible with 2M N:1 analog muxes. Not sure how feasable this is.

  3. Set up a bunch of rows of parallel headers and use little jumpers to form connections. Probably cheaper than 1 or 2, but not programmable.


I started thinking if maybe there was a way to use an CPLD or FPGA to do something like this. At the very least if I had one with enough IO I could do some input->output following design that could get pretty close for slow digital circuits, but wouldn't handle analog very well.


What I really want is a chip that can take a large number of IO and let me program in arbitrary connections between them. Does something like this exist? Preferably easy to program, even from a pic or something.


The board I am looking at now has 3 rows on each side and two power rails so that's 64 distinct connection points, or 2016 analog switches.




Voltage relativity


As I understand (I'm new), voltage is always relative. From the negative side of metal to the positive side, there is some voltage- but the negative side does not have a voltage alone. Why is it then that people say electrons flow from the higher voltage to the lower voltage?



Answer



wbeaty's response brings up the fact that reality is complex and that we need methods to simplify that reality and reduce complexity in order to get down to the everyday business of engineering things that manage what's important to us and will just work relatively consistently. Despite the fact that reality may be very much more complex than the workable tools we apply to think about it.


I'm going to take a stab at your question from a completely different perspective than wbeaty's, though. One that is based upon ideas that are a little closer to reality (though we cannot ever say that any of our theories actually represent reality -- that is forever beyond our reach -- consider Plato's cave allegory.)


But I'll also try and keep it understandable, too, and not just go off on a litany of terms and ideas with no explanation of them.




Matter is essentially neutral once you look at it from a distance away of more than a few atomic diameters. This fact is a testament to the incredible forces that begin to be applied when you separate charges from each other.


Now add the idea of conduction band electrons. These are electrons that would normally just orbit their neutral atom. But because of thermal agitation and the exact kind of atom and nearby atoms, can be kicked "up" in such a way that they are more easily mobile, but where they are also still near the atom and nearby atoms who "lost" them. So the matter stays neutral, as the conduction band electrons don't actually leave and go somewhere. It's just that there is a kind of thermally agitated "dust cloud" of electrons very close to their atoms but just far enough away that they can be accelerated by even a very small electric field gradient.



That's the setup. Matter is essentially neutral. But some of the electrons can be thermally agitated and because of this can respond to very modest gradients in the electric field. (Lightning is one of those tremendous results that can happen when charges get separated.)


In the case of copper for example, and at room temperatures we usually experience, the number of these conduction band electrons is about \$8\times 10^{28}\$ electrons per cubic meter, or about \$10^{23}\$ electrons per milliliter of copper. And because all these charges repel each other and can move so freely as well, they will spread out fairly uniformly throughout the material. The density of conduction electrons in copper will be uniform, in other words.




Imagine a very simple circuit that includes a battery and wires that connect it to a resistor. It's a simple circuit:


schematic


simulate this circuit – Schematic created using CircuitLab


However, let's assume for purposes here that the resistor is also mounted in such a way that it is initially parallel in orientation to the battery (as shown in the above diagram.) I want to point out that this schematic is both behavioral as well as physical, for the moment.


Electrons will flow here. From the negative terminal to the positive terminal (and we might also assume inside the battery as well.) It's a circuit. How are electrons motivated to move, though? (They must be, since they are moving.)


For conductors, it must from differences in charge balance in matter leading to a gradient. But somehow this also means that something must not be as neutral as something else.


The Coulomb force law has a very simple formula:



$$\vert\vec{F}\vert = \frac{1}{4 \pi\cdot \varepsilon_0}\cdot\frac{\vert Q_1 Q_2\vert}{r^2}$$


\$Q_1\$ and \$Q_2\$ would be the net charge balance of matter at two locations in space separated by a distance of \$r\$.


Look at the above circuit. I've placed the resistor "far away" from the battery. If we assume that the charge differences exist at the battery ends, then it would logically follow that if we brought the resistor closer to the battery then more current would flow because clearly the distance \$r\$ is now much less. But we don't observe this. It doesn't happen that way.


We might also consider rotating the resistor so that one end is closer and one end further away. We might expect a change in current from this. But that also doesn't happen.


At least some of the charge balance differences must not be at the battery, itself, we can conclude. But where?




As a current flows through a wire, each electron must move in exactly the right direction to flow along the wire. But the above equation is, without the absolute value signs shown there, is a vector. So the direction an electron takes will be pointing in some fashion. But wires bend, make loops, etc. How do the electrons follow around all these changes?


Earlier, I said that the electrons were spread out uniformly in copper. But it turns out that in the above circuit there will be a slight difference in charges at the surface of the wire or conductor. Just enough, in fact, to motivate nearby electrons to move (which means a current.) If you move along a wire from one point to another, there will be a tiny difference in the charge balance between them ... just enough in fact to cause the observed current. Here's an example using a very tiny segment of wire to show the slight differences on the surface of the wire:


wire charges


That answers the where question asked above.





How much charge is enough? Well, to get the idea across of just how small the charge difference is, imagine bending a wire so that it forms a bend as in the following image:


bent wire


For such bends, there is an accelerating force required to cause all those electrons in the current to also make that same turn. The force is \$\frac{m_e\cdot v^2}{r}\$, where \$r\$ here is the radius of the bend and \$m_e\$ is the mass of an electron and \$v\$ is the mean velocity of the electrons. To achieve this force, a SINGLE EXTRA ELECTRON at the surface of the bend can be enough!! Seriously! It can be as little as that.


This again emphasizes the sheer magnitude of the forces we are talking about when bringing in electric charge repulsion or attraction!


There is a video worth watching here that will demonstrate these slight charge balance differences that set themselves up on a wire in order to motivate a current. It takes a very large voltage between two ends in order to create enough charge to be easily demonstrated. So the Weismann Institute has to use a high voltage for their demonstration. Smaller voltages yield such tiny charge balance differences that detection is very difficult.




Reality is complex. And a real circuit is likewise going to mean a very complex arrangement of these surface charges in order that the current will seem to mysteriously follow all the twists and curves. The details are sufficient so that currents of electrons entering a node will also divide up correctly at a branching point in a circuit. If you get into the tiny details, it all still works. But then it is more physics and less electronics.


The reality is that the charge balance differences do set themselves up, and quite quickly (order of nanoseconds) in order to cause all the right motions and direction changes.





Now you realize that there are actual classical physical forces operating to make circuits work. But the details are myriad and complex and electric and electronics engineers don't go around worrying about any of that (most of the time.) Somehow, they just design.


Luckily, it turns out that we can avoid knowing about all those details almost all the time. Sure, varying charge balances in matter do form at the surface of conductors. But a designer is usually dealing with such small voltages in a circuit, and/or such large number of electrons, that they can completely ignore those details. Only very high voltage engineers worry about it (insulators are exposed on their insides to these charges and are, in fact, the weak point to be watched.) Also, these tiny differences automatically set themselves up very quickly, and do so in just the right way, that none of it matters at the emergent scale we live in and you can simply and only examine things from a node perspective without getting mired in such unhelpful details.


At a node, the important things to know are the assignment of some quantity called voltage (energy per unit Coulomb of charge) and that all the current entering a node (in equilibrium, which is the usual case for conductors) must equal the current exiting that node (nodes don't accumulate charge.)


At this heightened viewpoint, eliminating a world of unhelpful detail just works right.


Now, a potential difference is actually an integral along the wire of all those infinitesimal charge balance differences between two nodes. And one could just write down all the individual potential differences between all the nodes. But this would be a rat's nest of differences and the circuit would, once again, still be rather complex-looking. Lots and lots of potential differences along myriad point-to-point "edges" or connections.


It turns out that it is always easier to get rid of all that mess (our minds don't like it) and to turn it into a clean "node voltage" given at each node. You get the same information from that. No difference. But it's a LOT easier to read and understand.


But there is one remaining problem here. Before, you had potential differences between each node pair. And those are all relative values. But when you assign voltages to nodes, those numbers are absolute, not relative. So you need to make one node special in your mind. By convention, the convenient value of 0 is assigned to this node and often referred to by ground or the phrase reference node. Now, it's just fine to give all the other nodes definite, time-varying magnitudes relative to that reference node.


It just makes things a lot easier to handle.


operational amplifier - How to clean/remove distortion/noise in my LM1458 Op-Amp?


I've made a LM1458 Op-Amp based on this video.



  • it amplifies the input music but it produces noise and has low volume.



How can I remove the noise and how to increase the volume?



  • when i parallel 2A333J Mylar Capacitor or 104 ceramic capacitor in the input sound it removes the noise but produces whistle sound.


Does adding gain and bypass on LM1458 or/and decoupling can remove the noise? but how to add?


In case anyone could help me how to remove noise, i want to add base and treble adjustment but how?


Schematic Diagram:


schematic


simulate this circuit – Schematic created using CircuitLab


Update: I've made LM386 amplifier with gain and bass boost which is far better than LM1458 amplifier. Thanks for all the comments and suggestions.




Answer




  1. I'm not going to watch a video of some wiener building a circuit then try to extract the schematic from a blurry screen shot of a video, and you shouldn't either. You need cleanly drawn schematics to work from, and a written explanation of the circuit function would be good, too.

  2. The 1458 is a dual version of the 741, commonly known as "that piece of crap that people should stop using because there are so many much better alternatives."

  3. The 741 cannot drive a 4 ohm speaker with any kind of power. The datasheet for the ua741 gives the output resisitance as 75 Ohms. This cannot really deliver any useful power to the speaker.

  4. Regardless of how much power the 1458 could put out, that jiggery pokery with R1,R2, and C1, C2 that you've connected the speaker to would make it impossible to get any real amount of power through the speaker.

  5. Your circuit diagram is hard to read. You generally start on the left with the input and work your way to the right for the output.

  6. Your circuit diagram makes no sense. There are so many non-sensical parts that I can only assume you've copied the circuit incorrectly from a fuzzy video.


In short:



If you built the circuit as you've drawn it, then it is a wonder that your circuit does anything at all. Expecting it to work correctly is just too much.




I would suggest you start with clear and correct circuits. Here are two simple circuits that will be much easier to build:



  1. Suggested circuit from the datasheet of the LM386 This is a simple IC that can directly drive a speaker. Use the first circuit from page 5 of the linked document: enter image description here

  2. This is a stereo amplifier that can drive two speakers and still has fewer parts than that mess built out the 1458. This amplifier can output 2.5Watts per channel, and can be built to provide 5Watts to one speaker. See the circuits given in the Tea2025 Datasheet for more information.


Tuesday 26 January 2016

operational amplifier - How to analyze this circuit in the time and frequency domain?


I came across this circuit in another post and started looking at the op amp filter and how to apply traditional circuit analysis ( using 1/jwc for capacitors) and couldn't derive the transfer function. Image of Circuit


Question: How would we derive the transfer function for the filter topology? Ignore the HP Filter on the V+ terminal and ignore the components beyond (and including) the zener diode. Use the Generic names, C1, R1, etc.


assume Vin = V+ and we want to find Vo = output of OpAmp.



Answer




While formulating my answer to that question, I analyzed that circuit in some detail. It looks like a standard second-order bandpass filter, but used in a non-inverting configuration. Since a non-inverting amplifier cannot have a gain less than 1, I was intrigued to know what it's response should actually be.


The form of the transfer function is:


\$\dfrac{V_o}{V_{in}} = \dfrac{\mathrm s^2+a\mathrm s+\omega_0^2}{\mathrm s^2+b\mathrm s+\omega_0^2}\$


You can do some inspection by mentally removing or shorting the capacitors from which it is apparent that the LF & HF gains will be 1 as the equation predicts.




OK, here goes:


To simplify things a bit, we can guess that the ratio of R17 to R18 is important, so lets call it k (401.6). So if we replace R18 with just R, we can replace R17 with kR. Also since C1 & C5 are the same we can just call them C. Also, putting s=j\$\omega\$ is cleaner (and we get a Laplace transform).


Calling the voltage at the R18, C5 C1 junction Vx and summing the currents into that node we get :-


\$\dfrac{0-V_x}{R}+\dfrac{V_{in}-V_x}{\dfrac{1}{\mathrm sC}}+\dfrac{V_{out}-V_x}{\dfrac{1}{\mathrm sC}}= 0\$


\$V_x.(\dfrac{1}{R}+2\mathrm sC)=(V_{in}+V_o).\mathrm sC\$



\$V_x=\dfrac{(V_{in}+V_o).\mathrm sC}{\dfrac{1}{R}+2\mathrm sC}\$


Now the voltage at the inverting input of U1 is Vin (if the circuit is stable!) and summing the current at this node we get :-


\$\dfrac{V_x-V_{in}}{\dfrac{1}{\mathrm sC}}+\dfrac{V_o-V_{in}}{kR} = 0\$


So :- \$V_o=V_{in}.(1+\mathrm skRC)-V_x\mathrm skRC\$


Substituting for Vx, we get :-


\$\dfrac{V_o}{V_{in}}=\dfrac{1+\mathrm skRC-\dfrac{\mathrm s^2kR^2C^2}{1+2\mathrm sRC}}{1+\dfrac{\mathrm s^2kR^2C^2}{1+2\mathrm sRC}}\$


And :- \$\dfrac{V_o}{V_{in}}=\dfrac{\mathrm s^2+\mathrm s.\dfrac{2+k}{kRC}+\dfrac{1}{kR^2C^2}}{\mathrm s^2+\mathrm s.\dfrac{2}{kRC}+\dfrac{1}{kR^2C^2}}\$


(The plot for this exactly matches Telaclavo's graph.)


Now we can see that the natural frequency is given by :-


\$\omega_0 = \dfrac{1}{RC\sqrt k}\$ (ie \$f_0\$=14.5kHz)



... and that the maximum gain when \$\mathrm s^2+\omega_0^2=0\$ is given by :-


\$G_{max}=\dfrac{2+k}{2}=201.8\$


As for the time domain, since we have a Laplace transform, we can just take it's inverse to get the impulse response. In traditional textbook style I will simply say that this is left as an exercise for the student (ie too damn hard :)


operational amplifier - Input impedance of low pass filter on LTspice must be constant in it's pass band?


I have single supplied sallen-key filter more that have nice 3MHz flat LPF response. I tried to compute the resistance directly by dividing the input voltage by input current which is the voltage and current of source but it seems not ok: enter image description here


I know this "transient analysis" must give me impedance of this frequency. but this blue trace is weird trace!


AC. Analysis: enter image description here I think I have low pass filter then resistance must be constant in pass band, isn't that? why if not?


Filter response: enter image description here What should I do? In transient analysis: There is current lag, use shifted current? or what?


I've also seen somewhere replaced voltage source by current source and simply plot input voltage bode diagram!!! but it's single supplied and we have constraint?!


Buffered RLC filter input impedance in transient analysis (According to "Andy aka"s nice answer): I think AC analysis show input analysis is ultralow, then we need buffer in input and output, isn't it? enter image description here Frequency response that is very good for me: enter image description here


I think this arrangement is correct: enter image description here Why this have high resistance change in pass band(0-3MHz)? then we can't model it as a constant load in our simulation?




Answer




Do you think the AC analysis extracted the correct impedance?



Yes. it looks likely that the graph starting at about 30 kohm and falling to 3 kohm is precisely the input impedance of the filter design. The only problem is that your filter design is unrealizable because the bare-bones input capacitance of the AD8029 is 2 pF (typically) and your model is attempting to use a capacitor from the non-inverting input to ground of 0.5 pF i.e. your design relies almost entirely on the internal parasitic capacitance of the op-amp being 2 pF (+ 0.5 pF in parallel) and stable. That is a poor way to design a circuit and will lead to disappointment.


You should also rethink having a 120 ohm resistor as the output load because you will get poor results from this op-amp with a load this low in value. If you need to drive a load of 120 ohm, use a suitable line driver circuit added to the output.


But if you are going to do this you might just as well dispense with the AD8029 altogether and use a passive filter approach rather that an op-amp sallen key filter because op-amps used in this configuration never really deliver the goods when operated close to their full bandwidth and it seems like you need that bandwidth.


Use and RLC low pass filter followed by a buffer amp is my opinion.


pic - Water Sensing Circuit


I'm working on a circuit board driven by a PIC18F; one of the components on the board is a water sensor. This is pretty straightforward, there are two electrodes on a probe; when immersed in water, there's enough conductivity to complete the circuit, and it pulls a pin high on the PIC. Below is a sketch of the relevant portion of the circuit. The electrodes are CN4-1 and CN4-2, the board is powered by a 3.6 V battery.


As it stands, it works as intended, but I'm seeing some undesirable behavior. The system is highly sensitive to anything touching the second electrode, CN4-2; I'm assuming this introduces stray charge to the system, and I can get a false positive detection (even if nothing is touching CN4-1, so the circuit is not completed). In particular, there's an LED that signals the presence of water, triggered by this circuit. If CN4-2 is touched by a conductor (either water or something else, like a hand), the I/O pin gets pulled high enough to trigger the LED, but in some cases just having the LED lit is enough to pull some current from the battery, letting the signal to the I/O pin get pulled low enough that it turns off again, and we end up switch back and forth between states. Tying the ground of the board to an external ground helps reduce this, but doesn't always eliminate it.


Reducing the size of the resistor pulling the pin low reduces these false positives, but then makes it hard for the circuit to pull it high when there's a legitimate signal. Simultaneously reducing the size of the resistor that pulls it high can fix that, too, but then the total resistance of the circuit is low enough that when the circuit is connected across CN4, there's a significant current draw, which will shorten the battery life significantly.


I inherited the board design, so I won't be offended if you tell me that there's a completely different way to handle this that would be better. I'm ideally looking to have the system very responsive to a connection across CN4, minimal power draw whether CN4 is open or closed, and preventing a false positive signal when only a single electrode has some contact. If it can be done without requiring tying the system to an external ground, that would be convenient.


Water Sensor Circuit





colour coding - Resistor Value Help


ResistorsI have two resistors that I'm trying to figure the values of.


One is black blue silver gold black


Second is black orange silver gold black


Can anyone help with these values?





Monday 25 January 2016

operational amplifier - Transimpedance AMP, Active HPF, phototdiode (updated)


The original post is here Transimpedance AMP, Active HPF, phototransistor


I decided to change back to a photodiode instead of a phototransistor since I have used one for a similar experiment in the past. I also took the suggestion to remove the feedback capacitor.


In this setup I am using a VISHAY BPW34. Should the Rf be good enough for good readings? And is non inverting high pass good enough to pass only 995Hz frequency and amplify the signal? Should this setup work in terms of op amp and output?



enter image description here




relay - Using Triac to control solenoid


I have to design a 4 relay or 4 triac switch.


First would control a 12V solenoid for water flow. Second would control 230V for a complete device which contains a small boiler as well.


After reading this: Triac versus Relay


It is still not clear to me if triac circuit like this:


http://www.instructables.com/id/Small-Triac-Switch/



are safe to use here. I read that triacs can break then let current flow (which would be catastrofic in my case at controlling the solenoid). This can never happen to relays, if the relay broke then that only means it wont turn the device on.


So can I rely on triacs for long time period (years)?




voltage - Mistake in published paper about magnetic levitation?



As I was reading through this paper: Nonlinear Model & Controller Design for Magnetic Levitation System, I stumbled cross section 3.3 which I could not follow.


Summarizing section 3.3 Non Linear Model.


The magnetic levitation system can be described in terms of the following equations.


enter image description here


Equation (2) indicates that L(x) is a nonlinear function of the ball position x. Therefore we need to approximate the inductance for the MLS. The authors chose the following approximation:


enter image description here


They then proceeded to substitute into equation 2.


enter image description here


Should it be 2*C or simply C in Eq.5?


How did they end up with equation 5, from equation 2? I am having trouble understanding the origins of the negative sign (which I am sure that there is an explanation to) in the second equation of the image above, but also where the 2 in front of C has gone.



Is there a mistake here, or am I missing something? Can someone help me with the math and show how this was worked out?




Sunday 24 January 2016

isolation - home brew isolated oscilloscope lead


The ground clip for an oscilloscope lead is normally connected within the instrument to the power supply earth, and there are surprising circumstances where this could matter. The situation is very well explained in "EEVblog #279 – How NOT To Blow Up Your Oscilloscope!"


Leads with galvanic isolation are very expensive, so, is there a good home-brew design or kit available? I realise that protection against high voltages might put this outside the home-brew area, but one for lower voltages would protect against dangers, such as that, described by Dave Jones in the EEVblog, of destroying the on board regulation of an Arduino via the ground connection of a USB lead.



Answer




Another choice is if your have a multi input 'scope, take two leads, connect their grounds leads together (and tape if needed to prevent shorting) and then use one as "signal" and the other as "ground" and use the A + (inv. B) functions of your scope to measure the signal and to remove the ground signal. It means you use more leads and can interfere with some scope functions. BUt it's another choice for you ...


How are OLED screens driven?


How are OLED screens such as the ones on my cell phone, driven?



From my understanding, an OLED screen is basically a matrix of tri-coloured LEDs. LEDs can be dimmed by using PWM. So does that mean that each color of each pixel on the screen has it's own separate PWM circuit or are they multiplexed in some way or is it all together much more complicated than that?




capacitor - How does the MAX232 double the voltage?


MAX232 Datasheet


Hi, I am currently a student so bear with me please!


I'm currently using a powering the MAX232 with 5V DC, and when I measure from VCC to lets say, pin 3, I am getting a voltage reading of around 13V on my voltmeter. Using a power source that is higher than 5V. What is going on? I know it says in the datasheet that there is a voltage doubler, but I am not quite sure how voltage doublers work, other than we need the capacitor.



Answer




It uses one charge pump to double the supply voltage, and the second charge pump to invert it. The idea behind the charge pump doubler is that capacitors are first charged in parallel, then they are switched such that they are connected in series.


enter image description here (Source of picture: datasheet for ICL232, which is similar to MAX232.)


As an aside, I've seen hacks where +10V and -10V generated by the MAX232 were also used as supply rails for OpAmps. It's not the best power supply, and it's got switching noise from the charge pump. But it may still work, if the analog section is not very sensitive, and it needs a negative supply rail, and there is no other option for generating the negative supply rail.


signal processing - Am I using Shannon-Hartley Theorem and thermal noise correctly here?


I'm trying to learn about noise, sensitivity, and the Shannon-Hartley theorem, and I'm using some specs for a LoRa node IC to try it out.



The Shannon-Hartley theorem says that the maximum data rate \$C\$ is given by


$$C = BW \ log_2 \left(1 + \frac{S}{N}\right).$$


Where \$S\$ and \$N\$ are the signal and noise powers within the fully-used bandwidth \$BW\$. LoRa occupies the bandwidth using a rather cool Chirp Spread Spectrum which you can read more about in this great answer and the question there as well.


The fundamental floor for noise in small signal analog electronics is usually thermal noise, and if I understand correctly that's usually given by


$$N \ = \ k_B \ T \ BW. $$


I calculated the Shannon-Hartley limit for the theoretical maximum data rate possible for the various values in Table 12 of the data sheet, and compared to the bits per second actually implemented at those quoted sensitivities, I was really happy to see that I'm in the right ballpark and tracking the trend nicely.


The Shannon-Hartley limit is always a factor of about 20 to 30 faster faster than the rate listed.


I'm just curious; could this be a safety margin, or conservative spec (did they pad the sensitivity to make sure they could meet it) or is there a factor I've forgotten?


Question: Am I using Shannon-Hartley Theorem and thermal noise correctly here?


As a bonus, any idea if the 14 dB is a safety margin, or if the noise floor is actually not thermal?



note: At these rates, the signal is well below the noise which is also pointed out in the data sheet.


Table 12 from Rev. 5 - August 2016 of SEMTECH's SX1276/77/78/79 Datasheet. ©2016 Semtech Corporation www.semtech.com


enter image description here


enter image description here


def log2(x):
return np.log(x) / np.log(2.)

import numpy as np
import matplotlib.pyplot as plt


kB = 1.38064852E-23 # Joules K^-1 "Boltzman's Constant"
T = 298. # about 25C

BW = np.array(2*[10400] + 2*[20800] + 2*[62500] + 2*[125000], dtype=float)
SF = np.array(4*[6, 12], dtype=float)
bps = np.array([782, 24, 1562, 49, 4688, 146, 9380, 293], dtype=float)
dBm = np.array([-131, -147, -128, -144, -121, -139, -118, -136], dtype=float)

lines = np.arange(1, 9)
noise = kB * T * BW # Joules K^-1 * K * s^-1 = Watts

signal = 10**(0.1*dBm-3.) # Watts

Shannon = BW * log2(1. + signal/noise)

plt.figure()

plt.plot(lines, bps, linewidth=2)
plt.plot(lines, Shannon, linewidth=2)

plt.yscale('log')


lfs, tfs = 16, 16
plt.text(6, 50, 'bps', fontsize=tfs)
plt.text(5, 250000, 'Shannon', fontsize=tfs)
plt.xlabel('line in Table 12', fontsize=lfs)
plt.ylabel('rate (Hz)', fontsize=lfs)

plt.show()

Answer



Looks reasonable to me.



Dont forget that you are calculating the maximum possible THEORETICAL performance for that channel assuming it is in fact thermal noise limited, at VHF and up that is not usually the case.


The radio front end on a cheap chipset at UHF will not have particularly state of the art performance, and getting real modulation and coding performance anything close to the theoretical limit is a big ask and is not likely to be possible using such a simple coding scheme.


They have in effect traded information bandwidth for simplicity, low power and some interference rejection, not a bad trade for the intended uses (Some form of COFDM would have better channel coding efficiency but needs linear amplifiers in the transmitter for example, much harder to do).


Saturday 23 January 2016

What is the difference between a transformer and a coupled inductor?


Transformers and coupled inductors seem very similar. Is there a difference in construction? Or only in use?


This question asks something similar, but the answers don't address my question: Coupled inductor vs an actual transformer?



Answer



The two are basically the same class of device, although each will have parameters optimized differently. The two names are to explain the different intended usage, which also gives you a quick guess of how some of the parameters may differ. Of course only the datasheets would tell you what the parameters are for sure.


A transformer is specifically intended for transferring power from one winding to another. You want the coupling between windings to be as good as possible, the leakage inductance zero, and the absolute inductance of each winding with the other open is often not a large concern.



With coupled inductors, each winding is still used for its inductance alone, although of course some coupling is being utilized else there would be two separate inductors. Generally leakage inductance is less of a issue. In fact, it can be useful to have some minimum guaranteed individual (non-coupled, or leakage) inductance for each winding. The absolute inductance of each winding with the other open is also a important parameter that will be well specified.


power supply multimeter voltage test differ from the label


I have a router's power supply. 12 Volts is written on the label. When I use a multimeter the voltage is 16.80V. Should I use it to power a small LED strip that requires 12V?



Answer




I trust the meter, and I assume the power supply is a 'wall-wart' style encapsulated blob which provides a few tens of watts at most. (A picture would certainly help.)


Also, since you didn't specify conditions, I assume you measured the output of the power supply with no load.


My guess is that it's a loosely-regulated one which drifts high as the load decreases. Read the label and apply the rated load (i.e. if it's 12V / 2A - apply a 2A load) and see what the output voltage is.


The suitability of this power supply for your LED strip is going to depend on a number of things, including how much current the strip is going to need. If the supply is rated higher than what the strip needs, the voltage will likely be higher than 12V and you may get more current than you bargained for (brighter LEDs maybe).


Friday 22 January 2016

integrated circuit - How are crossing lines implemented on microchips?


I always imagined the photolithographic microchip manufacturing to be a 2D layer creation process without layering, thus creating a topological problem for circuitry when you have some \$K_{3,3}\$ or \$K_5\$ in it, which would certainly be the case for any non-trivial design.


And there are papers out there talking about producing "3D" chips with multiple layers to save space, thereby adding to the confusion.


Yeah, that's sad, but that is what I learned in school, a bunch of mysterious riddles. It's no wonder people start conspiracy theories about aliens catering those technologies to us.


So how can we build complex processors and chips just using a 2D topology ?



Answer




It turns out that there are layers, but people sometimes skip those when talking about how a microchip works.


The process that introduces layers is called Back end of line, or BEOL.



It basically works like this:



  • Create the 2D chip layer using photolithography

  • Apply an insulating layer

  • Drill holes into that layer

  • Apply a conducting layer, also filling the created holes and create circuit paths or interconnects

  • Repeat those steps as often as needed and your manufacturing process and maybe other considerations such as thermal design allows



circuit design - Measuring weight on a gym machine



We're doing a school project where we have to measure weight on a fitness machine.


enter image description here


The user can select how many weight plates to use by moving a rod like shown in the picture.


How would you do it?


We've talked about the following solutions:



  • a strain gauge measurement unit beneath the stack, be we doubt that it will be robust, and it will be expensive.


  • an IR distance sensor that counts the spaces between each plate.

  • inductive proximity sensors

  • Some kind of electromagnetic solution?




Thursday 21 January 2016

driver - How can I effectively drive multiple LEDs with multiplexing?


I am interfacing my microcontroller (AVRmega32U4) to a 4x4 LED array. There are 2 control lines to operate columns (passed to a 2 to 4 demultiplexer) and 4 control lines to operate rows. I bring a column high and a row low to illuminate a specific LED. I pull either the column low or the row high to turn off an LED.


This design works fine for around up to 4 LEDs at once. However, when I try to light all 16 at once with this strategy, the LEDs are noticeably less brighter (they're on a 1/16 duty cycle after all!).


What are some ways to more effectively light larger numbers of LEDs in this array? Say, 10+?


I am considering writing a lot of code to handle the different situations, but that will consume more space on my microcontroller than I am comfortable with. I was considering adding another micro with 16 control lines to manage these LEDs, one at a time, but this seems like a lot of overhead to introduce.



enter image description here



Answer



I used valuable information from Telaclavo's answer to adjust mine. If you like his, don't forget to upvote him.


If your duty cycle is 1/16 then you would have to give each LED 16x its nominal current to get the same average brightness. This will decrease your LEDs' life. High brightness LEDs can be PWM controlled at their nominal current at 1/16 duty cycle and still be as bright as a common indicator LED.
The easiest solution is to keep that duty cycle fixed, so that you can also have the current fixed. Each column driver will have to drive 4 LEDs simultaneously, so that's 4 times nominal current.


The 7404 you have in your schematic is not suited for this. First TTL can source very little current: 0.4mA. But even sinking won't do, that's also only 16mA, most LEDs, also high brightness are specified for 20mA. You need a driver which can source that. In your 4 columns x 4 rows each of the 4 columns has to supply 4 LEDs with 20mA each, that's 80mA. There exist high side drivers, but you may have to work with discrete components (BJT or MOSFET). The current won't result in a high dissipation, since its average per high side transistor is only 1/4 of that: 20mA, and that's worst case, if all LEDs are on.


edit
A BC807 is a good choice for this, and has an \$H_{FE}\$ of 100 minimum, so that a few mA of base current will drive it in saturation. You don't need the 7404 anymore to invert the active low output from the 74S139, since the BC807 is driven by a low voltage. The 74S139 (why not LS?) can sink the required current, also a 74HC139 will do.
While most microcontrollers are able to sink 20mA, this doesn't seem the case for the ATMega32U4. The datasheet doesn't give maximum current as a parameter (a lacune), but minimum and maximum output voltage are specified at 10mA. So for the low side you'll an extra driver. The 74LVC07A is specified for sinking currents to 32mA.


In quantities the 74HC139 + 74LVC07A + 4 \$\times\$ BC807 + 8 resistors cost less than 35 cent at Digikey.



batteries - How to power a GSM Modem from a Li-Po battery?


I want to integrate an AirPrime SL6087 GSM modem into a design, this is my first try at working with a GSM module. The datasheet states that the modem draws 2A for 1mS every 4mS (max) at 3.6V, the problem is that I intend to run this project from a single Li-Po battery and want to use a buck-boost regulator so I can keep the unit alive for as long as possible (running it down all the way to 3V). The only regulator I can find capable of this is the LTC3113 but there doesn't seem to be stock anywhere. The LTC3112 is also a possibility but it's 2.5A output current is rated at 5V input not down to 3V.


My question is this, there's a lot of small GSM products on the market, how do these go about keeping the power supply stable while running on a single Li-Po battery? I have this nagging feeling that I'm over complicating this...


The complete datasheet for the module is only available after logging in, registration is free however. Here's a quick recap (page 20):



In connected mode, the RF Power Amplifier current (2.0A peak in GSM/GPRS mode) flows with a ratio of 2/8 of the time (around 1154uS every 4.615mS)




Answer



My experience (across four different cellular modems, both GSM and CMDA), is that they are intended to be run directly off the battery. For the AirPrime SL808x series (as an example as I haven't worked with the SL6087), VCC_3V6 (which is used for the power amplifier), is rated at 3.3v min to 4.3v max, with a typical value of 3.6v -- this closely matches a nominal 3.7v Li-Po battery which may reach 4.2 volts on a full charge.


The digital section of the cell module (logic levels), on the other hand, runs off a 1.8v rail which is internally generated. It is also output on the VREF_1V8 pin (1 ma max).



So you don't really need a high power buck-boost regulator at all. If you need more than 1 ma to power your logic level conversion circuitry (assuming 3.3v logic levels elsewhere), you will need to provide an LDO regulator to generate 1.8v from the 3.3v rail.


Does the capacitor dielectric experience heating due to rapid charge/discharge cycles?


Does the dielectric in a capacitor when subjected rapid charge/discharge cycles heat up?



Answer




Yes, but only to the extent it is not a perfect capacitor. A perfect capacitor is not capable of dissipating energy, which means it can't be heated by the current thru it since that would represent a loss.


Real capacitors have a spec called equivalent series resistance, or ESR. That is various physical factors lumped together. You can for most purposes think of the capcitor as ideal with a series resistor of the ESR value. A resistor dissipates power proportional to the square of the current thru it.


Real capacitors can get hot with sufficient current and can eventually fail as a result. Electrolytics are particularly susceptible to this. Not only is their ESR high relative to other cap technologies, but they are more sensitive to high temperatures. Some electrolytic capacitors are specifically designed for higher currents, such as the Panasonic FK series. Look at the FK series datasheet in comparison to other types and you will see the FK can tolerate higher ripple current. They are also somewhat physically bigger and more expensive than the other types.


Ceramics generally have very low ESR, but it's not zero. I once got a ceramic disk capacitor so hot it hurt to touch it, and that was at only 1 MHz. (Maybe the 10s of volts from a RF transmitter I was putting accross it had something to do with it :-) )


Dielectrics store energy in the D field by sloshing electrons around at least a little bit. Some also flip atoms between different energy states. Any time you move energy around, even at the scale of a few atoms, there is the opportunity to lose some of it as heat. Some ceramics lose less than others, and ceramics as a whole lose very little, but they all lose some.


Air capacitors don't lose any power in the dielectric since there isn't any (basically vacuum), but unless the leads and plates are superconducting there will be loss there as charges slosh back and forth.


resistors - Buck Converter for 59V to 58V?



Some batteries last twice as long if they are kept to 80 percent of their maximum charge. It's good to add a small adjustment to undervolt a charger output by 0.5 - 1V. Myself i have a CC/CV charger that is .5 volts too high for a given BMS.


How can I take the voltage down by .5 - 1V at the output?



Answer



schematic


simulate this circuit – Schematic created using CircuitLab


Figure 1. \$ V_{OUT} = V_{IN} - 0.7 \$.


A silicon diode will drop about 0.7 V when more than a few milliamps is running through it.


Wednesday 20 January 2016

How much space does a 220V AC input power supply save compared to a 120V one?


For a given output voltage & current, how much space is saved by using 220V instead of 120V input?


Specifically, I want to know is it expected for 220V only welders to be much smaller than equivalent ones that have to work with both 120V & 220V. Here's a comparison. It's not exactly fair because the 220V machine has less cooling and only allows 25% duty cycle. Another comparison I could've done is compare a 220V only computer power supply vs a 120V one, but it appears there are no 220V only PSUs.




  1. 220V: Bossweld 200 Amp TS200 (25% duty cycle @ 200A)





    • 145mm x 280mm x 410mm = 16.6L




    • 7kg







https://www.bunnings.com.au/bossweld-200-amp-ts200-tig-stick-inverter-welder_p6380047




  1. 120V: Weldpro ACDC 200GD AC/DC 200 Amp, 40% duty cycle @ 200A




    • 447mm x 201mm x 406mm = 36.5L




    • < 27kg







https://www.amazon.com/Weldpro-Digital-Voltage-welding-machine/dp/B07LCSXYN5


So the 120V machine is 2.2x bigger.


Assuming a welding power supply uses the same design as a computer power supply like described here and here.


Then it's obvious a 220V supply would only use 0.55 the current in all stages before and up to the primary coil of the transformer. Everything after that would be the same for both 120V and 220V.


So is it fair to conclude that the high voltage, non isolated side will be 1.8x bigger in a 120V design? What fraction is taken up by the other isolated, low voltage side?


I'm also assuming having to support variable input voltage shouldn't cost anything extra, because you don't need any extra hardware, just a different duty cycle.





Identifying a USB charging port without enumeration


Is there a low cost and reliable way to identify a USB charging port?



I plan to charge a device via the USB port. The USB Battery Charging Specification 1.1 allows 1.5A current draw when connected to a Dedicated Charging Port (DCP) and 500mA when connected to a Charging Downstream Port (CDP). A DCP is typically a wall wart and a CDP is typically a computer. As far as I understand, a DCP is identified by shorted D+ and D-lines, a CDP id identified by D+ and D- being pulled to ground through 15k resistors.


It seems like identifying these ports takes quite a bit of extra hardware. I could probably bias the D+ line and connect D- to an ADC input to look for a DCP. And some similar arrangement to check for a CDP. I assume I would also need to disconnect the bias and ADC when done to not interfere with USB communication. The USB pads on my mcu are not 5V tolerant and are dedicated USB pads (I'm using an LPC1343).


Identifying the non-standard Apple and Sony chargers would be an added bonus, but not critical.


Does anyone see a simpler or better way to do this?


USB charge ports


From this datasheet



Answer



Although I don't have direct experience with this, from what I've read, IC's that perform this function usually sample the D+/D- lines on application of power with some sink on the D+/D- to detect the charger type, and disconnect their detection logic once a determination has been made of the connected source, AC adapter or USB port. More information is available from a TI app note here.


I sure from my previous part searches that some battery charger IC's have built in charger type detection, but I couldn't find an example part when searching just now.


There's the MAX14578 which also does the job, but it may not fit your criteria of low cost.



kirchhoffs laws - Basics of Transistors



something has been bothering me for awhile. When I look at a circuit involving anything more complicated than RLC components (and perhaps op-amps) I struggle to figure out what it's doing unless its a configuration I've seen before.


In contrast, I feel pretty confident that no matter how complex an RLC circuit I'm given I could eventually figure it out.


Now when I'm analyzing an RLC circuit my tools are basically




  • \$V = IR\$




  • \$I = C \frac{dv}{dt}\$





  • \$V = L\frac{di}{dt}\$




  • Parallel and Series combinations of those components (I guess this isn't really separate from Kirchoff's laws but...)




  • Kirchoff's Laws





So what I'm asking is what tools am I lacking for analyzing more complex circuits? Mainly I want to know how to analyze circuits involving BJTs and FETs. It seems like there are so many modes of operation for transistors its hard to keep them all straight. Anybody know a good website that lays out everything?


Thanks


EDIT I also want to mention that in practice there are things like \$V \neq IR\$ when temperature changes. I don't care about that for now, I agree with stevenvh that simulation is needed, but I want to be able to have the concepts down well enough to design a circuit which I can then tweak with a simulation etc.



Answer



Transistors are not hard to understand at the first approximation, and that is good enough to at least understand what's going on in many circuits.


Think of a NPN transistor this way: You put a little current thru B-E, and that allows a lot of current thru C-E. The ratio of a lot to a little is the transistor gain, sometimes known as beta and sometimes hFE. One minor wrinkle is that the B-E path looks like a silicon diode, so will usually drop about 500-700mV. The C-E path can go down to about 200mV when it would allow more current than the external circuit is providing. The details go on and on, but you can get a lot done with that simple view of a NPN transistor.


A PNP is the same thing with the polarities flipped around. The emitter is at the high voltage instead of low. The control current goes out of the base instead of into it, and the collector current goes out of the collector instead of into it.


Let's stick to bipolar transistors for a bit and understand them first, since that seems to be what you're asking about more. FETs are equally simple to understand at first approximation, but I don't want to confuse things at this point.


While the model above is useful for understanding most transistor circuits, it suggests a lot of ways transistors can be used that may not be obvious. The conceptually obvious way to use a NPN is to connect the emitter to ground and the collector to the positive supply with a resistor in series. Now a little change in base current can cause a large change in the collector voltage.


The tricky part is not in understanding how the transistor works, but to imagine all the cool things you can do with a device that works like that. Getting into all those would be way too much for a post here. I suggest you think about the simple model I described above, then look up some common transistor circuit topologies and think how the simple properties of the transistor are utilized to do useful things.



Things to specifically look up and analize according to the simple model are:



  • Common emitter configuration. This is the basic amplifier. A particular issue is how to keep the transistor in the middle of its range to use its amplification capability effectively. This is called "biasing".

  • Emitter follower. Gain is not just making a higher voltage. In this case you get slightly less voltage but higher current and lower impedance.

  • Now look at some multi-transistor circuits and try to follow what they are doing, how the transistor is used to advantage, but also what trouble the designer had to go thru to run the transitor in a way to be useful.

  • When you feel more comfortable, look at more unusual configurations like common base. Its not often used, but has its specific advantages.


c - Kp, Ki, Kd for software PID control


I am designing a software PID control. Logic is almost final but I wonder how do I decide the value of \$k_p\$, \$k_i\$ and \$k_d\$. Also, I need to determine the max and min value for the Pterm Item and Dterm. How do I do that?. Also, I am trying to implement the inverse control. Also, am I going in the right way in designing the software PID? Also, if integral time and \$k_i\$ both are same? The code I wrote so far is given below.


Calculate_Error();
P_Term = Percnt_Error;

P_Term = KP * P_Term;


if(P_Term >= PMAX)

{
P_Term = PMAX;
}
else if(P_Term <= PMIN)
{
P_Term = PMIN;
}

// Integral calculation


if(Integraltime==1) // Take integration at every 1s
{
Integraltime = 0;
Error_Accum = Error_Accum + Percnt_Error; // Error Accumulation over time
if(Error_Accum >= MaxAccumError)
{
Error_Accum = MaxAccumError;
}

if(Error_Accum <= -MinAccumError)

{
Error_Accum = -MinAccumError;
}

I_Term = (Error_Accum)*KI;

if(I_Term >= IMAX)
{
I_Term = IMAX;
}

else if(I_Term <= IMIN)
{
I_Term = IMIN;
}
}


Best most efficient motor type to be used as a DC generator



I'm trying to design a system that requires a very light weight very efficient generator to be used from converting rotational motion into DC voltage(for say charging batteries) As far as I know BLDC's are the most efficient and light weight to convert the other way around electrical power to rotational energy


What would be the best motor type to be used in this app in term of weight and conversion power?(AC, BLDC, brushed DC?)


Thanks for helping.




Debugging a 16x2 LCD Display on an Arduino


I have a standard 16x2 LCD display (I believe it is Hitachi HD44780 compatible - see summary and specification below), hooked to an Arduino Uno using 4 data pins, as described here, though I've added 2x 220ohm resisters in parallel (ie a 110ohm resistor) on pin 16 (Backlight ground), and replaced the Pot with static resistors to create 4V on Vo.


In short, RW is wired to ground, and RS, Enable, and Data4-7 are connected to Arduino pins, while Data 0-3 are floating.


I have other things (sensors, a transistor with an optoisolated SSR and a mains relay, some buttons) connected to different pins on the Arduino. The code I use writes text to the display a number of times a second, and normally, the display works perfectly.


However, when the relay closes (it takes about 10ma, and is controlled by a transistor which is in turn controlled from one of the Arduino pins), sometimes the LCD becomes garbled. It remains garbled usually until the relay next closes, but sometimes when the relay opens, or after a few more cycles of open/close to reset. The garbling always starts and stops at the same time as the relay either opens or closes.



By "garbled", I mean that every time I write to it following it becoming garbled, rather than writing english characters, I get a string of characters, that I usually cannot identify in the datasheet (though some I can). This string of garbled characters tends to move left along the screen as I write new text to the LCD.


I am confident it's not the Arduino itself getting confused, as I write the same text to the Serial monitor at the same time, and it is not garbled.


I've since experimented with wiring the RW pin to an Arduino output, and Data0-3 to ground, but this doesn't help. I've powered the whole device with a 9V battery or with USB, and it doesn't help. I've replaced the battery... no change.


The only thing that seems to work is having no load plugged in to the relay, but that defeats the purpose :-)


I don't have a signal analyser or anything more sophisticated than a multimeter, a laptop and an arduino... Does anyone have any hints for helping me debug this?


LCD Summary Sheet: http://oomlout.com/LCDD/LCDD-SUMM-BC1602A.pdf


LCD Specification: http://oomlout.com/LCDD/LCDD-DATA-BC1602A.pdf


Example of garbled text: garbled text




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...