Thursday, 31 December 2015

Using a TVS diode instead of, or in addition to a MOV for AC line protection?


For 220 V AC mains voltage, is it good practice to replace a 300 V MOV with a 300 V bidirectional TVS diode (like in here http://www.littelfuse.com/products/tvs-diodes.aspx), or connect both in parallel? Are there any points that need to be considered?



enter image description here



Answer



It comes downto what are you trying to protect against


There are four main types of transient suppression devices


Gas Tube



  • Protection time: > 1us

  • Protection Voltage: 60 - 100V

  • PowerDissipation: Nil

  • Reliable Performance: No


  • Expected Life: Limited

  • Other: Only 50-2500 surges, can short powerlines


MOV



  • Protection time: 10 - 20ns

  • Protection Voltage: > 300V

  • PowerDissipation: Nil

  • Reliable Performance: No

  • Expected Life: Degrades


  • Other: Fusing required. Degrades


Avalanche TVS



  • Protection time: 50ps

  • Protection Voltage: 3-400V

  • PowerDissipation: low

  • Reliable Performance: yes

  • Expected Life: long

  • Other: Low power dissipation. Bidirectional requires dual



Thyristor TVS



  • Protection time: <3ns

  • Protection Voltage: 30-400V

  • PowerDissipation: Nil

  • Reliable Performance: yes

  • Expected Life: long

  • Other: High Capacitance



http://www.onsemi.com/pub_link/Collateral/HBD854-D.PDF


( http://web.archive.org/web/20051001082352/http://www.onsemi.com/pub/Collateral/HBD854-D.PDF )


http://www.vishay.com/docs/88440/failurem.pdf


power supply - Name of the HP Female Adapter Socket In My Laptop


I have this HP powerbrick with a 90W capacity (19v 4.7A) that I want to use in my project. I am planning to use it as a power source for my 50W LED. But I want to keep the male socket it has rather than chop it off.


What I need is to know what specific socket name should I search in EBay to use it? Or can anyone recommend me a link and I can search it from there.


I search for HP Power socket and I get this result: http://www.ebay.ph/sch/i.html?_from=R40&_sacat=0&_nkw=HP+power+socket&LH_PrefLoc=2&_arm=1&_armm=63&_ruu=http%3A%2F%2Fwww.ebay.ph%2Fsch%2Fi.html%3F_from%3DR40%26_sacat%3D0%26_nkw%3DHP%2Bpower%2Bsocket%26_arr%3D1


I'm not sure if this is what I am looking for.


Picture of the HP Power Brick The Power Brick Socket Socket




stm32 - External power to STM32F4 Discovery board


I've recently finished programming the STM32F429ZI DISC1 board. I'm fairly new to this and now want to move away from connecting it to the PC via USB and power it up via a power supply.


At present I have connected a 5V supply to the 5V pin. This seems to power the board fine in that the LCD screen comes on (blank white), the PWR LED(LD2) lights up. However my program fails to initialise and stays blank, the COM LED(LD1) also flashes red at 1hz approx.



Has anyone experience with powering this board or other STM32 boards without a USB connection? And if so which Pin did you connect to and with what voltage.



Answer



I've figured this out (or rather I've found a solution), after pouring over the schematics and some general diagnostic work (measuring voltages, shorts etc)


In the user manual UM1670 (by ST) it has a page (19) on solder bridges


"SB10 (STM_RST) OFF No incidence on NRST signal of STM32F429ZIT6. ON NRST signal of STM32F429ZIT6 is connected to GND."


The solder bridge is not connected by default but as it was related to a STM reset I decided to short this to see if I could get the whole system to reset. It worked.


I've since soldered SB10 together permanently and the board runs as expected. (I'm not sure exactly how this fix works I need to read into it and then edit this response)


IMPORTANT NOTE: YOU WILL NO LONGER BE ABLE TO FLASH CODE TO THE DEVICE THROUGH USB ONCE YOU HAVE SOLDERED SB10, I'VE NOT YET CHECKED BUT IMAGINE DESOLDERING WOULD ALLOW FOR YOU TO PROGRAM THE MCU AGAIN


memory - DDR1 Layout Considerations - DOs and DONTs


I am novice to high speed design.


Before getting in to DDR, I recently learned about impedance matching and how it is done, likewise I learned about length matching and how it is done.(Baby steps towards Signal Integrity)


Now, I need to Place and Route a DDR system within 50x40mm. I have been asked do to it in six layers.


What are the things I will have to learn before doing this? The document I am currently using for reference is AN2582 from FreeScale Semi. Frankly speaking, I dont understand many terms and technologies mentioned in it.


So please list out the points crisply, books and links would be helpful.


Specifically I am looking for suggestions on:



1.StackUp(Gnd, Power Plane location) with reference to Impedance matching(if necessary)


2.Routing principles I will have to follow:


2a) what are the signals that needs to be Length matched in my circuit(details given below). There are 3 to 4 signals falling under the category of address and data group(adding more to my confusion).


2b) routing considerations on address, control lines.


3.Checklist after completion of the entire design.


enter image description here


enter image description here


enter image description here


The third screen shot illustrates signals from Processor.(Kindly zoom-in for part numbers and bear with me)


The crystal used as clock source for Processor is 13Mhz(low speed board isnt it?)



At this time, I have no idea about rise time .


Thanks in advance.




integrated circuit - Does there exist an IC that allows on-the-fly routing of signals?


Do there exist ICs with N input pins and N output pins which, either via EEPROM setting or via on-the-fly control by a microcontroller, allow one to route each of the N inputs to ANY of the N outputs?


In other words, for example, one might use it to connect the incoming line on Input1 to the outgoing line on Output6, and connect Input2 to Output3, and Input3 to Output1, and so on (regardless of whether the signals are SPI, or I2C, or standard digital lines, etc)... And later change up the order.


If it exists, what are such ICs called?



Answer



What you're looking for is called a "crossbar chip". Since this is a fairly inefficient way to use silicon resources, the emphasis these days seems to be on using such chips to route very high speed LVDS signals.


Wednesday, 30 December 2015

USB composite device driver


I am wondering if it possible to create a USB device (in following the device) composed from




  • a custom circuit (eg arduino) and

  • a flash storage


in such a manner that the device is recognized as a standard usb flash storage (and as such is operable with standart OS drivers), while said storage holds the utilities to operate with the custom circuit (dispalying the data colled by the circuit); and if so, how?


My first thought was to smack a cheap usb-hub and usb-pen before my circuit but that solution, is not pleasing to me.


My goal is to eliminate the need to carry an extra flash-drive just for the operating software, and use default os drivers, make it plug-and-just-work:



  1. i plug the device in

  2. the os (windows) mounts a new flash-drive without needing a special driver

  3. is start (manually or via autorun) my custom.exe from that flash-drive


  4. i recive data measured by the circuit



Answer



Your first step is to find a USB microcontroller that has all the peripherals you need to accomplish your task.


The second step is to correctly set up your USB descriptors. The descriptors will tell the PC that your device is a composite device. I have not seen very much support for multiple configurations. So you will need one configuration descriptor.


Typically, composite devices are described by using multiple interface descriptors. So your one config descriptor will say it has 2 interface descriptors. The first interface descriptor will be for your Mass Storage Device. The second interface descriptor will be your custom interface.


EDIT: here's a couple links that might help you out with the descriptors. The USB Generic Parent Driver is what Windows uses to enumerate composite devices. Lots of good stuff here. http://msdn.microsoft.com/en-us/library/windows/hardware/ff539234%28v=vs.85%29.aspx


Here's a link to an Atmel app note which shows an example of a composite device. http://www.atmel.com/images/doc7805.pdf


Microchip has a free USB stack for their microcontrollers. It also contains examples for composite devices. Unfortunately, the link to the Microchip examples is the type that will likely change over the course of time, so your best bet is to google "Microchip Application Libraries"





With that said, you probably don't need a custom interface. If you're just passing around bytes, you can use standard HID drivers to transport your data to and from the device, no custom drivers necessary. However, host-side software will be required to use the OS-specified interface for reading/writing HID reports (in the case of Windows, this is usually ReadFile and WriteFile from the Windows API)


Tuesday, 29 December 2015

power - Voltage drop on Solar Cell MPPT


I'm trying to build my own MPP Tracker on Solar Cell, here's my schematics enter image description here Explanation :



  • PA6, PB0, PB1, PB2,PA3 : I/O Pin

  • PA 7 : PWM Pin

  • PA4 : Used to measure voltage

  • PA0 and PA1 : Differential ADC to measure current



The problem with this circuit is, voltage drop on solar cell is too big (about 2V from 5V solar cell). I am sure that there is no problem with the solar cell since it works perfectly using MPP tracker commercial module. I've try changing the transistor several times, and also change it into a P channel trench mosfet PMV65XP, which is the same transistor used by the commercial module (it took me 1 month to get it).
enter image description here So my question is, what did I do wrong? My assumption is I am using wrong kinds of diode. If yes, what diode I should use? or perhaps did I do something wrong with this arrangement?


The solar cell output is on GND and VCC, used to supply MCU and load Here's one of the test result :


Solar Cell V-open circuit : 4.91V - 0mA
Load resistance : 220 ohm (non capacitive)


Using commercial module :
V and A on solar cell : 4.20 V, 40mA
V and A on MPP output : 3.00 V, 45mA


Using my module :
V and A on solar cell : 2.60 V, 42mA

V and A on MPP output : 2.38 V, 37mA


I've tried to change both diodes from Fast Recovery diode FR104 into Switching diode 1N148, but still there's no significant change


Just for information, at first, I also doubt my algorithm and my code, that's why I put a potentiometer (on PA3) so I can manually adjust the PWM (works on 15kHz). And as for @Maximus suggestion, here is the graph (mine is on the left side, and the commercial on the right): enter image description here
The graph data is taken by changing PWM duty cycle per 10% and observing the voltage and current of solar cell output (VCC) and MPP output (J1 on circuit). And here is some of the PWM output as suggested by @laptop2d: enter image description here
It appears that the Vpp of PWM signal is increased along with the Voltage of solar cell (which used as VCC supply of uC)


----Edit----
These is the PV characteristics: enter image description here



Answer



The characteristic of a loaded solar cell is just about a constant current source until you hit the a maximum voltage and then it drops off fairly quickly. The trick with MPPT is to get to the top voltage end of that constant current region.


I believe that you are probably taking just a little too much current. Your algorithm should be seeking a maximum for V*I for the solar cell.



Your current sensing is at the battery end of the circuit it should be looking at the current from the solar cell. I also do not see where you are sensing the solar cell voltage.


Your switching transistor is connected back to front as per your diagram, the body diode will be conducting giving you a straight transfer from input to output with a bit of voltage drop. Allowing for current for the LEDs this explains your input to output characteristic.


You need much bigger smoothing capacitors on the input and output in addition to the ones you show depends on your frequency but >=220uF.


operational amplifier - What is the largest gain configurable with an opamp?


With an LM358, is a gain of 5,000,000 possible? or by cascading several opamps?




Monday, 28 December 2015

arduino - Can L293D be replaced with SN754410NE?




I have a circuit that is set up to run motors using an Arduino and an H-Bridge chip. It works fine with the L293D chip but when I replace it with the SN754110NE chip it stops working.


As far as I can tell, the pinouts for both chips are identical so I'm not sure what the problem is.


Does anyone know what are the differences that would make one chip work but not the other?




integrated circuit - When a datasheet specifies output current is it per pin or aggregated for all pins?



When a datasheet specifies something like output current, as with the 74FCT244 or for example, is this referring to the aggregated output current between all pins or the capacity of a single pin ?



enter image description here


enter image description here


enter image description here



  • Other device example


enter image description here


Also, it specifies above for the 74FCT244 that with an output HIGH, the max current is -15mA, while with output LOW the associated current shall be no more than 64mA. Clearly one of these refers to the capacity of the device to source and sink current, but the relationship between current sign and output voltage appears backwards to me. Namely, the datasheet says with a HIGH output then it appears to allude to sinking 15mA (indicated by the negative sign). Similarly, the LOW output voltage has a capacity of 64mA .. sourcing? (positive sign).





LEDs in Parallel, each with its own resistor


I am currently planning a project to light up a model of a cruise ship. I've done this before with some success.



To keep things simple I want to wire in Parallel. (Assuming I've understood the difference correctly; Each LED will have a direct connection to the power source)


I will be using a mix of colours; White, Warm White, Blue, Red, Green. Every LED is pre-wired or will be fitted with a resistor (470) to allow them to be run from a 12v source.


Every online simulation I run and my own previous experience says this will work perfectly fine, but every article I read seems to scream "no don't do it" and even then, opinions seem to differ.


enter image description here


Above is an example of my wiring diagram, forgive the crudity. There will be a lot more LEDs used than this, but this gives you an idea of my plans.


Any thoughts?


Thanks


{{{}}}


EDIT:


This is the overall schematic that I have planned:



enter image description here


Sadly I cannot provide the direct link for this circuit as it is too long for browsers apparently.




dip - Prototyping with SMD components?


In response to the answers here: How much longer should we expect DIP (or DIL) Packaging to be around?


If DIPs are phasing out, how would one proto their boards quickly and cheaply? Does this mean we have to all start learning to build surface mount boards? Is there something I'm missing because that sounds like a lot of work for simple proof of concepts...



Answer



Several vendors offer tiny PCBs that adapt SMT devices to match DIP footprints.


Typically, the SMT part and a set of pins must be soldered to the PCB.


A representative vendor can be found here.


Sunday, 27 December 2015

Should I discard my inventory of old electrolytic capacitors?


I have been doing hobby electronics for more than 10 years, and some of my electrolytic capacitors are easily that age. They seem to work just fine and do not show corrosion or other visible defects, but they are usually used in prototyping rather than production.


Knowing that these have a limited shelf life, I'm curious if I should just discard what I have and purchase new inventory, and rotate it.


How best can I tell that my old caps have failed, are out of spec, or perhaps are going to fail?



Answer



The best way to tell that an electrolytic cap is bad or about to go bad is to use an ESR meter.


An ESR meter directly measures one of the biggest reasons electrolytic caps fail: when ESR gets high, P=I²R tells us that power dissipation goes up, so heat gets produced, which boils off more of the electrolyte, which causes ESR to go up, which... Eventually, poof-bang, it isn't a cap any more.


Read the cap's datasheet to find out the expected value of ESR. It varies considerably among capacitor types and capacitance values. As a rule, the cheaper and smaller the cap, the higher the expected ESR. I've seen values ranging from 30 mΩ to 3 Î©. The only reason I even give numbers is to show this 100:1 ratio, not to set your expectations so you can go measuring without having read the cap's datasheet, however.


You can re-form the dielectric of electrolytic caps. There are two major methods.


Re-forming the Dielectric Using a Bench Supply



One school of thought is to charge the cap up over many minutes via some current-limiting scheme to its rated voltage, then leave it there for many more minutes.


There are several methods for doing this, all with the major goal of limiting the currents to levels that prevent the capacitor from blowing up in your face if the capacitor simply cannot be restored.


The Resistor Method


The simplest way to achieve this is to put a large resistor in series between the capacitor and the voltage supply. Use the RC time constant formula (Ï„ = RC) to calculate the proper resistor value. The rule of thumb I was given is based on the fact that a capacitor is nearly fully charged after five time constants, so we set Ï„ = 1500 in the above formula: 5 minutes in seconds × 5 time constants. We can then rearrange that to R = 1500÷C. Now simply substitute your capacitor's value into the formula to get the minimum required resistor.


For example, to re-form a 220 Î¼F cap, you'd want to charge it through a resistor no smaller than 6.8 MΩ.


Set the power supply's voltage to the normal working voltage for the capacitor. If it's a 35 V capacitor, it probably has about 30 V across it in normal operation, so you'd use that as your voltage set point. I can't see a good reason to push the capacitor beyond its normal working voltage; the dielectric strength will increase over time to some physical limit and stop there.


This method is nonlinear, charging fastest at the start, then slowing asymptotically as you approach the power supply's voltage set point.


The Constant-Current Method


A more sophisticated method would be to use a current-limited bench power supply, achieving the same end. The formula for that is I = CV÷Ï„. If we always want to charge over 30 minutes, Ï„=1800.


To re-work our 220 ÂµF example, we also need to know the ending voltage, which we'd select the same way as above. Let's use 30 V as our target again. Substituting that and our charge time into the above formula gives the necessary charging current, which in this case is 3.7 ÂµA.



If your power supply can only go down to 1 mA for the current limit setting, you then need to decide whether you want to risk recharging over only 6.6 seconds, which we get by a simple rearrangement of the formula.


This method is linear, increasing the voltage across the capacitor a fixed amount per unit time until it hits the voltage set point. The main consequence of this is that the ending charge current will be higher for a given total charge time than with the resistor method, but the starting charge current will be lower. Since the danger of damaging the capacitor increases as you approach the voltage set point, that makes the resistor method safer, with the charge time being equal.


Combined Method


That brings us to the combined method, which was used in the link above: a constant current power supply charging the capacitor through a resistor. The resistor slows the charge current as the voltage rises, and the current-limited power supply can limit the charge rate at low voltages below what the resistor would do alone.


Leakage Current


If you do this with a good bench supply, once you hit the charging voltage limit, if the power supply continues to show any current flow, that is your capacitor's leakage current, which you can compare to the spec in the cap's datasheet. An ideal capacitor has a leakage current of zero, but only the best capacitors approach that ideal. Electrolytic caps are far from ideal. If you leave the capacitor in the charging setup, you may find that the leakage current drops for some time after hitting the voltage limit, then stabilizes. It is that point that you know that the dielectric is now as strong as it's going to get.


Re-forming the Dielectric In-Circuit


The second method also raises the capacitor voltage slowly over a long period, but it does so in-circuit. It only works for AC-powered equipment, and it is best used to re-form the dielectrics in linear power supplies, whether regulated or unregulated.


You pull this trick off using a variac, which allows you to raise the AC supply voltage to the circuit slowly. I would start off at a volt or two, then tweak it upward a volt or three at a time, with many seconds between changes. As with the methods above, expect to spend at least half an hour on this. We're dealing with wet chemistry here, not semiconductor gates; it takes time.


The more "linear" the circuit you do this with, the more likely it is to work well. Switching power supplies and digital circuitry are likely to be annoyed by the slowly rising rail voltage produced by this method. Some circuits can even self-destruct under such conditions, because they're designed with the assumption that the supply voltage will always rise rapidly from zero to its normal operating value.



If you have a digital circuit powered by a linear-regulated power supply, you might want to re-form the power supply separate from the powered circuit. You might want to put a resistive load across the output of the power supply while you do this.


pwm - Calculate DC motor frequency



I am driving a DC motor with H-Bridge Mosfet using PWM. The problem is I don't know exactly which frequency should I use.


1- Do the DC Motors have a very specific frequency for their best performance at all or they have a range of the frequencies they are able to work with?


2- What happen if I work with a DC Motor with Higher or Lower frequency that it can work with? Am I damaging that? (Because I have done that and with higher frequency my Motor make a strange noise like zzzz and with lower frequency it is shaking)



Answer





  • The PWM frequency supplied to a (presumably) brushed DC motor needs to be high enough that the combination of mechanical inertia and inductance of the coils is sufficient to smooth out the mechanical impulses of each pulse. This minimum would differ from motor to motor. Too low a frequency, and the motor motion will be perceived as a series of jerks, or a rattle.




  • The frequency needs to be not so high that the switching device (MOSFET, other) and connecting wiring do not waste significant power in switching losses. Too high a frequency, and the efficiency will drop. This maximum would differ depending on the switching mechanism, the length of wires to the motor, the drive voltage (higher voltage = slew-rate limitations), shielding, perhaps some other factors too.





  • The frequency should, if possible, avoid the audio spectrum: below 20 Hz (not a good idea except for really massive motors) or above 20 KHz, so that the magnetostrictive vibration in windings or sympathetic vibration in the mechanical rotor, will not be heard by humans.




  • In addition to all of this, a specific motor + load + mounting combination will have a resonant frequency at a given temperature. While this is likely to be not as high as the 20 KHz+ applied for typical motor PWM, certain types of rigid mounting can indeed reach ultrasonic resonant frequencies. If the PWM frequency matches the resonant frequency, resonant oscillations can cause the motor to vibrate uncontrollably. This is why rubber / nylon / elastomer buffers are commonly applied for motor mountings.




This last issue is somewhat self-curing though, since after a bit of resonant oscillation the mounting tends to give / wear, even if it is rigid metallic mounting, and this changes the resonant frequency.


How to use a flyback diode on a +/-12V motor


I've got a motor hooked up to +12V on one side and -12V on the other, being driven in both directions by a Motor controller (link). We were getting voltage spikes in the common ground after sending big impulses to the motor, so we put a flyback diode from the negative cable to the positive cable. However, this caused the motor to be less responsive in the reverse direction. How do we correctly prevent voltage spikes in the ground from this type of motor?



Answer



This question is very like Snubber diodes for a DC Motor with 2 relays but may turn out to be different when you supply the missing information - your switching arrangement.


schematic


simulate this circuit – Schematic created using CircuitLab



Figure 1. Possibly the schematic of OP's circuit.


schematic


simulate this circuit


Figure 2. Using snubber diodes. In this configuration the maximum voltage that can appear across the contacts is 12 V + 2 x 0.7 V = 13.4 V.


schematic


simulate this circuit


Figure 3. Back to back Zener diodes. Zener diode voltage should be a few volts above supply voltage to prevent turn on or high leakage around the knee voltage.


The solution of Figure 3 is probably the most elegant as it uses only two components which can be placed at the motor and requires no additional wiring.


The snubber diodes or Zener diodes must be rated at full motor current as that is what will be diverted through them when the motor is switched.


attiny - How do I set the clock speed fuses on an ATtiny85 when using an Arduino as a programmer?


I'm following this tutorial, programming the ATtiny85 with an Arduino, using it to play some tones (through a piezo speaker). I'm struggling with getting the tones at the right pitch (I'm creating the wave forms manually, as the tone() function is unsupported on the ATtiny85).


I believe the problem may be down to differing clock speeds on the Arduino and ATtiny. I understand the clock speed can be altered on the ATtiny, how do I accomplish this using the arduino environment?



Answer



I believe the Arduino software (libraries and all) assumes you are operating at 16MHz. If you apply that assumption to the clock you are actually running at... things should work out. Assuming you are running the Tiny85 on it's internal oscillator I think it runs at 1MHz, so just multiply all your delay statements (and other notions of time) by 16.


If you need better accuracy than the internal oscillator provides you should think about using an external crystal or a resonator, but you will need to change the fuse settings of the AVR for that to work, and I think you will need a programmer like the AVRISP mkII to do that with AVR Studio (my recommendation).


I don't know much about the ArduinoISP sketch but to me it looks like it bit bangs the ISP protocol to upload a program to the target chip (not the on board Mega328), not sure it is equipped to manipulate fuses. ArduinoISP is documented here http://arduino.cc/en/Tutorial/ArduinoISP, fwiw. Note that you can't use a UNO currently to run the ArduinoISP sketch. It doesn't look to me like you can use the sketch to make the Arduino a viable interface for using the AVR Studio GUI tools.


EDIT: It looks like stuff has caught up and an UNO is viable for ArduinoISP now - thanks for the comments all


transmission - How are multiple signals propagated in a coaxial cable?


I am reading that coaxial cables can carry hundreds of MHz signals at How Stuff Works. How are these signals propagated and how are they deconstructed once they reach their destination?


One idea that comes to my mind is that the RF signals of each frequency are translated into voltage waves that are then superimposed onto one, thereby creating one electrical signal that is sent through the cable. At the destination this signal is deconstructed using some form of correlation, to get the corresponding frequency?




Answer




the RF signals of each frequency are translated into voltage waves that are then superimposed onto one, thereby creating one electrical signal that is sent through the cable.



On the one hand, I think you've got it. On the other, I'm not sure you understand what's going on well enough to get it for the right reasons.


If we want to broadcast an rf signal through space, we have to emit that signal from an antenna. To get the signal from our generating equipment to the antenna we use a transmission line, typically a coaxial cable. The voltage signal on the transmission line excites the antenna, which generates EM waves that travel to the receiving antenna.


At the receiving antenna, the EM waves are delivered to another transmission line (again, typically coax) to get them to the receiving equipment.


Sending signals over coax is just like that, but without the antennas. The generating equipment is just connected to the receiving equipment by the cable. The same voltage signals in the cable that would have excited the antenna, travelled through space, been collected by the other antenna, etc, are just delivered straight to the coax that feeds the receiving equipment.


My point is there's no fundamental difference between the signals in a coax cable and "rf signals". Both are just voltages (or electric fields) varying with time.


And there's no need to "translate" rf signals into voltages. The RF signals already are (or started out as) voltages before they were broadcast as EM waves.



In fact you can also look at the signal in the coaxial cable as an EM wave, but it just happens to be travelling in a dielectric sandwiched between two conductors instead of travelling in free space.


Saturday, 26 December 2015

Looking for a good freeware/open source PCB design software equivalent to Altium



I am familiar with Altium PCB design software in my workplace. But thats an expensive suite to maintain. Is there any decent enough free software which I can use at home for my pet projects? I have tried ExpressPCB but not satisfied with it. Any suggestions are much appreciated. I usually design upto 4 layers of PCB for my home projects.




operational amplifier - Why use an opamp for the variable Q feedback in a Twin-T notch filter?


In the following circuit, for a Twin-T notch filter, the author is using an additional inverting op-amp for the T-filter "feedback", that is connected to a potentiometer (pot).


enter image description here
Image credit: here


Why are they using this extra opamp instead of just the pot or fixed voltage divider circuit?




UPDATE:


I see there are some good info from the answers of this question:





Answer



As the pot is varied, the effective resistance 'seen' by the bottom of the twin T circuit will vary if the feedback amplifier is not present, changing the frequency response of the circuit.


Even for a fixed voltage divider, the analysis would be complicated by the effective resistance; using an amplifier means it does not have to be considered.


The amount of variation if the amplifier were not present will depend on the ratio of the effective feedback resistance to the resistors used in the main twin T section. A relatively small feedback resistance will cause a small variation, but to get the notch back to normal would require varying all the resistors to maintain the necessary ratios.


The use of a buffer amplifier means that the driving impedance from the feedback path will remain very low (and consistent) for all potentiometer settings.


flash - Creating programmable look up table on STM32


I am trying to define a look up table that is not a constant on an STM32F103. Basically I want to have a page of flash that acts like a constant lookup table in normal operation, but every once in a while (think days apart) I want to be able to erase that table and write a new one to the page of flash. I believe I understand how to use the HAL to functions to do what I need in my program, but it seems like I would need to declare this block of memory in the linker file and I'm having a lot of trouble finding an example that covers that. The default mem.ld from CubeMX looks like this:


MEMORY
{
FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 128K
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 20K

}

It seems like I need an output sections block after that where I commit a keyword to >FLASH but I don't know what keyword that would be or how I would declare the table in the code to give it the right address.


I have seen the emulated EEPROM application note, but it seems like a lot of extra overhead for memory that will not see enough erase/write cycles to be concerned about the memory's lifetime. Help!



Answer



Note: linking is not a part of the C language standards, so each compiler implements linker files differently. You seem to be using GCC, so I will share some code that works with it.


linker.ld:


MEMORY
{
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 8K

FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 31K
/*(1)*/ FIXED_DATA(rw) : ORIGIN = 0x8007C00, LENGTH = 1K /* your LUT here*/
}
............
.FIXED_DATA (NOLOAD):/*(2)*/
{
*(STATIC_DATA);/*(3)*/
} >FIXED_DATA /*(4)*/

In C:



__attribute__((section("STATIC_DATA"))) 
const static volatile statistic_static_data_t staticData;

What this does:


(1) create an area named FIXED_DATA of given location and size. Note that my code is from a different device. Check your datasheet do see what size your blocks are (they may not even be equally sized inside a device!). Make sure to reduce the size of FLASH accordingly, otherwise you will get an error about them not fitting into memory.


(2) create a section named FIXED_DATA. It doesn't have to be called FIXED_DATA actually, but it helps keep track. Attribute NOLOAD tells the linker to not fill the area (see below).


(3) put all variables marked STATIC DATA into this memory section


(4) put everything in this section into the area named FIXED_DATA that we created way above


In the C file, you just have to tag the variables you want put into the area. I recommend calling them const because you don't generally want to write to flash directly. Volatile helps with compiler optimizations that assume const data never changes.


Why go through all this trouble, instead of using the much simpler solutions in other answers? Because it's upgradeable. If, in the future, you want to do a FW update, you may want to keep the stored data in memory. The NOLOAD instruction in the linker file does just that: the linker does not fill the data with 0, as it would normally do if you have a global variable living there.



You can find out more about the arcane ways of the linker if you search for "ld syntax"


Friday, 25 December 2015

How to realize constant acceleration control for BLDC motor?


I would like to realize a constant acceleration control of BLDC motor so that its speed can rise from zero to target speed in a predefined time period. I understand that the motor should be able to generate enough torque so that J*dw/dt can be satisfied. Let's assume this condition is fulfilled. To implement this control with a MCU, what I can think of is to use a timer to generate fixed time interval deltaT interrupt, say 10ms, and every time the timer interrupts, the next speed target is calculated using next_speedref = current_speedref + acceleration * deltaT.



My questions are



  1. I can give new speed reference value, but how can I make sure the actual speed can settle to the target value within deltaT?

  2. If I have to use a speed closed-loop control, when acceleration*deltaT is small, which means the speed error going into the PI controller will be small, do I need to set Kp and/or Ki to be big enough to make sure the speed can be reach the target within deltaT?

  3. For industrial motion control, normally how would they realize constant acceleration?



Answer



schematic


simulate this circuit – Schematic created using CircuitLab


The block diagram is simplified industrial drive position control loop. For your app. you can ommit certain stages, you would neeed current controller PI and velocity controller PI. From your open loop trajectory planner you calculate the velocity according to your formula, then you give a velocity setpoint to the velocity controller.



schematic


simulate this circuit


Now if you own a functional BLDC FOC kit, this should be no problem since the current loop and velocity is yet implemented. What you might add is the torque (current) feedforward. As you said \$M=J\alpha+M_{load}\$ we can anticipate the dynamic torque setpoint before the velocity lags the setpoint. So there is a torque feedforward path that forwards the torque setpoint "a priori". \$M_{ffwd}=J\alpha=\frac{d\omega}{dt}J;\; I_{ffwd}=M_{ffwd}*k_i;\; k_i[A/Nm]\$
\$I_{ffwd}=\frac{d\omega}{dt}J*k_i\$


Since the velocity loop "a posteriori" can't immediately follow the dynamic change in speed, there should be introduced a first order LP filter before the the velocity PI controller (it's ommited in the picture), to delay the action until there is a system response due to the feedforward loop action.


The other thing is a simple trajectory calculator, which calculates a ramp. This should be a recursive algorithm that increments the speed and checks limits each itteration loop. This part doesn't have any feedback from real speed or position, it just computes in open loop. It's all up to regulation loops to follow the speed setpoint.


Thursday, 24 December 2015

sensor - Can a differential ADC replace an instrumentation amplifier?


Greeting Everyone ,


I am doing a project of data acquisition system Let me explain project in simple terms Step 1) Sensor : A strain gauge type PRESSURE sensor (Wheatstone bridge)Specs : 2mV/V output I am applying +- 5Volts (10 Volts) The output swings from 0mV to 20mV(full pressure)


Step 2) Instrumentation amplifier : Output of the sensor is given to an instrumentation amplifier which i made using 3 OP07 opamps i have also added a filter at the end of amplifier to reduce noise.Specs : the circuit has two ZERO pots (to adjust Zero output)(Connected at zero net ) and an Gain adjustment pot .Gain adjustment pot is connected at R5


enter image description here Step 3) ADC : The output from this circuit is gain adjusted (typically gain =100) and given to ADC ADS1115. ADS1115 has capability to take the differential input directly and also has provision for programmable gain Upto 128 Which looks something like this : enter image description here


so i just interface my controller device with the above setup to get data (Data Acquisition ) and plot graphs etc


------Question-------            

Can we Totally bypass instrumentation amplifier and directly (maybe add a filter)connect the output of sensor to ADC ?
1) adc will do work of converting the differential signal into binary data
2) We can avoid the instrumentation amplifier circuitry
3)ADC has programmable gain which we can set to 100

Any suggestions and reviews are welcome ! Thank you in advance !!




switches - 5v Electret microphone to PC mute switch pop help


I've got a PC microphone that fires off a loud pop when muted. Upon taking it apart it appears that its mute circuit is really simple and therein may lie the issue. I've combed this board for fixes and and can't find one. There is this page on the web. The fix seems intuitive but it involves the internal circuit, which is beyond the scope of the mute button; it's inside my sound card and I'll be damned if I have to get in there to fix this. Furthermore, that fix involves a 3 lead mic, where mine is 2. I figure there's clean way to kill this pop without changing (much) the impedance or voltage going to the electret mic.


Please see exhibit A: Exhibit A


This seems to be all the involved circuitry of the microphone (Style #1 is its original form).


I figured I could try bridging the ground to the signal upon muting, so I shorted the 2 points in Style #2. This only increased the pop seen on the audio end of the business (audio is mic signal. Mic is open and working then at red line is turned off).


Any suggestions as to how to quell this pop? Many thanks in advance for your time and consideration.



P.s. Ideally, I would like to add a band pass filter for 60hz hum and high-end static. If I'm going to be wiring up more resistors and capacitors for the filter, couldn't 2 birds be killed with one stone?



Answer



I think you've misinterpreted the circuit shown on the web page. It applies to any electret. Basically it shorts out only the AC (signal) by using a large capacitor but avoids switching the DC bias voltage which is the source of the pop.


enter image description here


When the mic is plugged in C1 experiences a step voltage (from the 5V supply/R2) which brings both terminals of the capacitor to the DC bias level of the electret.


The negative terminal of the capacitor then discharges through R1 (100k) back to (nearly) 0 volts leaving no voltage across R1 (after more than 5 time constants). From the microphone's perspective it 'sees' a parallel load of 100k (the impedance of the large capacitor being negligible). This is so large it has no effect on the mic's output.


When the mute switch is operated (closed) there is no large DC step because the voltage across R1 is 0V and hence no large POP. The microphone now 'sees' only the 100uF capacitor as a load because the 100k has been shorted out. This effectively shorts out any AC (signal) and hence mutes the mic. The DC bias circuit (R2) is not shorted out because C1 is effectively an open circuit to the DC signal.


current - Can electronics be damaged by under-currenting it?


Someone just asked Can electronics be damaged by undervolting it?, so now I am going to ask under-current. Let's say something requires 10A, 12V, if I limit the current to 5A, could anything go wrong?



Answer



Conceivably yes. Limiting the current means that the circuit will attempt to draw the current but the supply limiter will reduce its output voltage in order to balance the higher demand of current.


We are back to a lower voltage or under-voltage scenario and I can envisage a situation where a weakly designed circuit will potentially be damaged.


A buck convertor may be specified to run from (say) 20V. It's output may be 5V to a load that might be 1A (5 watts to the load). Ignoring losses, it will take 0.25V from the 20V supply in order to do so and it may be fused for say 0.5A. An associated part of the whole circuit may nominally require 2A and if you current limited the supply to 1.5A and the voltage dropped to (say) 6V the buck convertor could be taking 0.833A.


It's a tortuous example but it could happen and the fuse blows. Maybe there wasn't a fuse - the buck convertor transistor will get too hot and if it is a BJT type it will destroy itself.



spi - Why are all the slave select lines are high on a SC18IS602B chip?


The SC18IS602B chip is an I2C slave device that bridges to a number of SPI devices. I'm using this to talk to 3 SPI devices that use TLC5925 constant current LED sink drivers. These devices are known good (tested in another setup). The problem I'm trying to solve is that when I send data out of the first SPI port all the LED rings change at once. I have confirmed with a multi-meter that all the slave select (SS[0-2]) lines are high. And using a bus pirate I confirmed they stay high most of the time. Briefly dropping low near the SPI transmission point.


This is the circuit:


Wiring http://memecode.com/hw/mc2/images/i2c-spi-wiring.png


The code I'm using to setup the bridge:



        uint8 MsbOrder = 0, Mode = 2, SpiClockRate = 1;
WriteI2C(SC18IS602B_ADDR,
0xf0,
(uint8)
(
(MsbOrder << 5) |
(Mode << 2) |
(SpiClockRate)
));


// Enable GPIO on SS3
WriteI2C(SC18IS602B_ADDR,
0xf6, // GPIO enable
#if DEBUG_USE_GPIO
(uint8) 0x0F); // All SS pins GPIO
#else
(uint8) 0x08); // SS3 is GPIO (output enable)
#endif

// Set mode on SS3

WriteI2C(SC18IS602B_ADDR,
0xf7, // GPIO config
#if DEBUG_USE_GPIO
(uint8) ((1 << 6) | (1 << 4) | (1 << 2) | (1)) ); // Push pull mode for all SS pins
#else
(uint8) (1 << 6) ); // Push pull mode for SS3
#endif

I tried setting the select lines to GPIO and just driving them high as I needed. That code is selected by defining DEBUG_USE_GPIO to 1. However when I try that no SPI data is transmitted into the LED driver chips.


I'm using the last select line as GPIO to turn off the LEDs until I have finished updating all the data strings.



The code to actually transmit the data is:


    typedef char LedRingBits[6];
LedRingBits r[2];

ZeroObj(r);

#if DEBUG_USE_GPIO
// Turn off output enable, turn on select line
WriteI2C(SC18IS602B_ADDR,
0xf4, // GPIO write

(uint8) (LED_OUTPUT_DISABLE | Channel) );
#else
EnableLedRing(false);
#endif

#define SetLedBit(out, in, comp) \
if (Col##in.comp()) \
{ \
int Bit0 = LedRingAddr[Led##in].comp; \
r[out][(Bit0>>3)] |= 1 << (Bit0&0x7); \

}

if (Led0 >= 0 && Led0 < 16)
{
SetLedBit(1, 0, r);
SetLedBit(1, 0, g);
SetLedBit(1, 0, b);
}

if (Led1 >= 0 && Led1 < 16)

{
SetLedBit(0, 1, r);
SetLedBit(0, 1, g);
SetLedBit(0, 1, b);
}

if (WriteI2C(SC18IS602B_ADDR,
Channel,
(uint8*) &r[0], sizeof(r)))
{

// This forces the SPI transfer to complete before we do anything else
ClearIntLedRing();
}

#if DEBUG_USE_GPIO
// Turn on output enable, turn off select line
WriteI2C(SC18IS602B_ADDR,
0xf4, // GPIO write
(uint8) 0);
#else

EnableLedRing(true);
#endif

Where 'channel' is 0x1, 0x2 or 0x4. Basically the bit that should drive just one slave select line high (not all).


I don't even know if I can say it's hardware or software at this point. I've triple checked for shorts or misplaced lines in the hardware. Voltages seem good (except for the slave select lines themselves).


I'm not sure if I need a decoupling cap on the power rails of this chip. Could that be a problem?


The bar/reset line is just attached to +V... which I assume is ok? (Active low according to the spec).


I've swapped the SC18IS602B chip out for another one, and got the same results. (Just in case the chip had gone bad).


Edit: Here is v2 of the breadboard:


Wiring http://memecode.com/hw/mc2/images/i2c-spi-wiring-v2.png



This is working better. The main difference is that the slave select lines are inverted with a 4011 NAND IC. Also there is now a 100nF cap between the GND and +V pins of the bridge chip. The result is that SPI output #1 is now independent of #2... but changing #2 affects #1. So half way there.


Edit2:


The final issue where changing LED ring #2 also affected LED ring #1 was traced back to an intermittent short on LED board #1 that only occurs when the PCB board is slightly flexed, as it is in the chassis (the screws are on the very edges pulling the PCB towards the chassis, and the LEDs in the middle act to prevent that). This would pull the latch enable line (LE) high all the time, resulting in that board always responding to SPI data, even when intended for another LED ring board. OMG it works!



Answer



Fret, those parts are working exactly as they should - but they aren't really compatible with regards to chip-enable.


As is standard with both I2C and SPI, the chip-enables on the SC18IS602B are all low-true. They would all be high when idle, and only one (the selected one) should be low when transferring data.


The TLC5925, on the other hand, has a latch that is transparent when LE is high, and latched when low. It's the opposite polarity from the chip-enables. That's why you are seeing what you are seeing.


What you need is an inverter between each chip-enable and its respective LE.


Wednesday, 23 December 2015

connector - Why are the contacts for the Data lines in USB A and B plugs shorter than the contacts for Ground and Power?


I was reading up on USB connectors on Wikipedia and I've noticed that the contacts for the data lines (D+ and D-) are shorter in both the Type A and Type B plug. USB A and B plugs


What could be the reasoning behind this design?



Answer



Hot plugging. You want the power supply to be connected before the datalines. Some chips may latch if a signal is supplied to the signal pins before power is applied. This means the chip will internally short out and may get destroyed when subsequently power is applied.


In the old days you had to power off you computer before you could add a peripheral to it, that is not necessary with USB (and some other interfaces).


radio - Drift auto-corrector for any microcontroller




I've made multiple microcontroller circuits in the past, but now when I look at everything, drift has become a problem. I know this when I try to connect two micros together serially via wireless modules. I also know drift is an issue because communication is only perfect when the programs in both microcontrollers run at the correct time.


So now what I am trying to come up with is a way to adjust time on one board so that it can synchronize with any board of my choice.


Based on this circuit, what I'd like to happen is for the 8051 microcontroller to load a value into P1 to define the drift offset, then set that value by bringing P3.5 low. This will then give a resistance value which is fed into the 555 timer to alter its timing (hopefully) which in turn alters the timing of the microcontroller itself.


The problem with this setup is that when I use the serial port, I need to run at a rate in which standard baud rates above 19K can be used. In my previous designs, I used a 22.1184Mhz crystal with 33pF 5% NPO capacitors but that didn't help with timing for syncing multiple boards. I don't think the 555 has the ability to be stable at a frequency higher than about 2Mhz.


Is there an alternate circuit I can use besides this that achieves the functionality I'm looking for but also allows the microcontroller to be driven at 22.1184Mhz speed?


circuit




microcontroller - How to drive a MOSFET with an optocoupler?


What's the proper schematic for driving this MOSFET from a microcontroller pin through this or this optocoupler? The MOSFET will drive a motor @ 24V, 6A.



Answer



The suggested MOSFET is not well suited to this application. There is a severe risk that the result will be a smoking ruin :-(. Principally, that FET is only very very marginally suited to the task. It could be made to work if it was all you had but there are much much much more suitable FETs available, probably at little or no extra cost.


The main issues are that the FET has a very bad (= high) on resistance, which leads to high power dissipation and a reduced level of drive to the motor. The latter is not too significant but is unnecessary.


Consider - the data sheet says that the on resistance (Rdson - specified at top right on page 1) = \$0.18 \Omega\$. Power dissipation = \$ I^2 \times R\$ so at 6A the power loss will be \$(6A)^2 \times 0.18 \Omega =~ 6.5W\$. That is easily handled in a TO220 package with an adequate heatsink (somewhat better than a flag type preferably) but this much dissipation is totally unnecessary as much lower Rdson FETs are available. Voltage drop will be \$V = I \times R = 6V \times 0.18 \Omega =~ 1.1V\$. That's \$ \frac{1}{24} =~ 4%\$ of the supply voltage. That's not vast but unnecessarily takes voltage that could be being applied to the motor.



That MOSFET is in stock at digikey for $1.41 in 1.s.


BUT


For 94 cents in 1's also in stock at Digikey you can have the ultra magnificent IPP096N03L MOSFET. This is only 30V rated, but has \$I_{max} = 35A\$, \$R_{DS(on)}\$ of \$10 m \Omega\$ (!!!) and a maximum threshold voltage (turn on voltage of 2.2 volts. This is an utterly superb FET both for the money and in absolute terms.


At 6A you get \$P_{diss} = I^2 \times R = (6A)^2 \times 0.010 \Omega = 360 mW\$ dissipation. It will feel warm to the touch when run without a heatsink.


IPP096N03L data sheet


If you want a bit more voltage headroom you can get the 97 cents in stock 55V, 25A, \$25 m \Omega\$ IPB25N06S3-2 - although gate threshhold is getting marginal for 5V operation.


Using Digikey's parameter selection system let's spec the "ideal FET for this and similar applications. 100V, 50A, logic gate (low turn on voltage, \$ R_{ds(on)} \$ < \$ 50 m \Omega\$.


Slightly dearer at $1.55 in 1's in stock at Digikey BUT 100V, 46A, \$ 24 m \Omega\$ \$R_{ds(on)} \$ typical, 2V \$V_{th}\$ ... the utterly superb BUK95/9629-100B where do they get these part numbers from? :-)


Even with only 3V gate drive, at 6A \$R_{ds(on)}\$ will be about \$35 m \Omega\$ or about 1.25 Watt dissipation. At 5V gate drive \$R_{ds(on)} ~=25 m \Omega\$ giving about 900 mW dssipation. A TO220 package would be too hot too touch in free air with 1 to 1.25 Watt dissipation - say about 60 to 80 C rise. Acceptable but hotter than needed. Any sort of flad heat sink would bring it down to just "nice and warm".


This circuit from here is almost exactly what you want and saves me drawing one :-).



Optocoupler driving FET


Replace BUZ71A with MOSFET of your choice as above.


Input:




  • Either: X3 is the input from the microcontroller. This is driven high for on and low for off. "PWM5V" is grounded.




  • Or: X3 is connected to Vcc. PWM5V is driven by the microcontroller pin - low = on, high = off.





As shown \$R1 = 270 \Omega\$.




  • Current is \$ I= \frac{(Vcc-1.4)}{R1}\$




  • or Resistor is \$ R = \frac{(Vcc-1.4)}{I} \$





For Vcc = 5V and \$270 \Omega\$ I here =~ 13 mA. If you wanted say 10 mA then \$R = \frac{(5V-1.4V)}{10mA} = 360 \Omega\$ - say 330R


Output:


R3 pulls FET gate to ground when off. By itself 1K to 10k would be OK - Value affects turn off time but not too important for static drive. BUT we wil use it here to make a voltage divider to reduce FET gate voltage when on. So, make R3 the same value as R2 - see next paragraph.


R2 is shown gointo +24 Vdc but this is too high for the FET maximum gate rating. Taking it to +12 Vdc would be good and +5Vdc would be OK if the logic gate FETs mentioned are used. BUT here I will use 24 Vdc and use R2 + R3 to divided the supply voltage by 2 to limit Vgate to a safe value for the FET.


R2 sets the FET gate capacitor charge current. Set R2 = 2k2 gives ~10 mA drive. Set R3 = R2 as above.


Also, add a 15V zener across R3, cathode to FET gate, Anode o ground, This provides. gate protection against over voltage transients.


The motor connects as shown.


D1 MUST be included - this provides protection against the back emf spike which occurs when the motor is turned off. Without this the system will die almost instantly. The BY229 diode shown is OK but is overkill. Any 2A or greater current rated diode will do. An RL204 is just one of a vast range of diodes that would suit. A high speed diode here may help slightly but is not essential.


Switching speed : As shown the circuit is suitable for on/off control or slow PWM. Anything up to about 10 kHz should work OK./ For faster PWM a properly designed driver is required.


microcontroller - Checking how many inputs (reed switches) are active using minimal GPIO pins



I've been a programmer, for a while, but I am new to the hardware aspect of things so I apologize for my lack of knowledge.



Just for a fun project to try to get better with hardware, I've decided to make an electronic chess board that records your moves.


I'm using reed switches for this project (they activate when they are near magnets) and I have a question.


In chess, there are 64 tiles which means I need 64 reed switches. I realized that connecting each reed switch to its own GPIO pin is inefficient and annoying considering that I'll need to get more pins (I'm using a RPi B+, so I have 27 pins to work with currently). I decided to check if anybody else has done what I'm trying to do using reed switches to see if they had any workarounds to this. Nobody has gone into too much detail about how they did it, but it appears that some people have gotten away with using 16 pins (one for each row/column).


All I really need to know is how many reed switches are activated on each row and column. I'm assuming there is a way of connecting everything in such a way where every activated switch adds to the voltage, and then I can read the voltage for each input. However, my RPi only allows me to see if there is a high or low voltage supplied to the input.


Any tips? Thanks!



Answer



As mentioned by others, it can be done using an 8x8 matrix. If you look at the internet you will find plenty of picture where they are used for keypads.


However those standard schematics are assuming you press only one key at a time. Some combination of two switches are also possible. But in your case need to be able to detect any combination if pressed switches.


I worked on that problem a while ago and found you can do it with an 8x8 matrix, but, as also mentioned by WhatRoughBeast, it requires a diode in series with each switch.


enter image description here



Tuesday, 22 December 2015

resistors - What does "5k1" in the given schematic mean?



What does the "5k1" stands for it is a normal 5k Ohm resistor?


(Marked with "A" in the picture)


The chip is an MAX13020 LIN-transceiver.


Schematic with markes question



Answer



Resistors are often marked using the letter k (or letter M) instead of the decimal separator, so 5k1 means 5.1k\$\Omega\$ or 5100\$\Omega\$, while for example 1M2 means 1.2M\$\Omega\$.



A unique letter for each type of element can substitute for a decimal point in small values. For example, 6R8 is used to indicate a 6.8 \$\Omega\$ resistor. Similarly, the letter V substitutes for a decimal point in voltages such as 3V3 for 3.3 volts.


That same marking style is often used on ceramic or polyester capacitors, where for example "2n2" stands for 2.2nF.


About the diode, that's not just a B, there's written "BAT46" that is a specific kind of diode. A datasheet from Vishay can be found here.


Is a capacitor a high-pass filter or a band-pass filter?


This has been bugging me for a while now... Does a single capacitor, on its own, behave as a high-pass filter or a band-pass filter?



In a crystal radio set, you use a single capacitor as the tuning element, to select which radio frequency the radio will receive. This strongly implies that a capacitor is a band-pass filter.


But reading Wikipedia, it is suggested that a capacitor is actually a 1-pole high-pass filter.


Well, obviously it can't be both. So which is it?


(Bonus points for anybody who can point to an actual frequency response curve.)



Answer



A capacitor by itself is not a filter at all, neither high pass, low pass, nor anything else.


A capacitor can be used as part of a high pass, low pass, or band pass filter, depending on how it's connected to other parts. For example, a capacitor with a resistor can be a high pass filter:



or a low pass filter:




Together with a inductor and some additional impedance (represented by the resistor), it can be a band pass filter:



Or a band rejection filter:



A crystal radio works like the left band pass filter. C1 and L1 form a resonant tank that has high impedance at the resonant frequency and low impedance at other frequencies. Even that by itelf is not a filter, since just a changing impedance isn't a filter. It is the changing impedance working against some other impedance that forms a voltage divider that then makes a filter. In the example above, R1 is that other impedance. In a crystal radio, it is the impedance of the signal coupled to L1 magnetically by the antenna coil. In that case the antenna coil is the primary of a transformer, and L1 is the secondary, which resonates at a particular frequency depending on the value C1 is tuned to.


Added about crystal radio:


I see from the comments that there is some confusion about how the capacitor in a crystal radio works and how such a radio is tuned. There are different ways a crystal radio can be made, but I'll stick to the very common configuration you can find all over the web, and that is implemented by most crystal radio kits:



The inductor is a single coil, ususally magnet wire wound round something like a carboard toilet paper roll. The coil is essentially a transformer. The transformer primary is the left section between the antenna and the tap. Since the tap is grounded, there is no direct flow of current between the two sections of the coil. Voltage is induced in the right part of the coil by transformer action. The only way for the signal to get from the left part of the coil (the transformer primary) to the right part (the transformer secondary), is by the magnetic coupling between the two parts of the coil.


The transformer creates a higher voltage at its right end, although at a higher impedance. Typical antennas have impedance in the 50-300 Ω range, whereas the crystal radio is intended to drive old style headphones that have a few kΩ impedance. The higher voltage at a higher impedance is a better match to the headphones, and allows the very limited power from the antenna to be used more efficiently.



The inductance of the coil together with the capacitance form a high Q tank circuit. The radio picks up a station when the capacitor is adjusted so that the tank resonates at the station's carrier frequency. Due to the finite impedance of the antenna driving the tank as seen thru the transformer, and the impedance of the headphones loading the output, the capacitor and the coil together form a narrow band pass filter.


noise - Why are there two sets of ENBW correction factors?


For calculating the equivalent noise bandwidth of a non-brickwall filter, I can find two different sets of numbers, both of which claim they are similar things:




Order   EqNBW
1 1.5708
2 1.1107
3 1.0472
4 1.0262

5 1.0166
6 1.0115
7 1.0084
8 1.0065
9 1.0051
10 1.0041






1 1.57
2 1.22
3 1.16
4 1.13
5 1.12


Which is correct?


Or are they both correct; just used in different calculations?




After figuring this out, I made a chart of the different factors and the types of filters they work for: ENBW Filter correction factors vs order



Answer



The effective noise bandwidth depends on the shape of transfer function. It's easy to calculate it numerically.


See my Matlab script below that calculates the ENBW for a Butterworth lowpass filter. You can adapt it to your needs.


for N=1:10
[b,a] = butter(N, 1, 's');
f = @(x) (abs(freqs(b,a,x)).^2);
bw = integral(f, 0, 1e6);
fprintf('Order: %d, ENBW: %g\n',N, bw);
end


In case you don't have Matlab, the output is given below


Order: 1, ENBW: 1.5708
Order: 2, ENBW: 1.11072
Order: 3, ENBW: 1.0472
Order: 4, ENBW: 1.02617
Order: 5, ENBW: 1.01664
Order: 6, ENBW: 1.01152
Order: 7, ENBW: 1.00844
Order: 8, ENBW: 1.00645

Order: 9, ENBW: 1.0051
Order: 10, ENBW: 1.00412

USB powered device with multiple Decoupling Capacitors


I have a USB powered device with multiple IC's. From what I've read it's standard practice to use a combination of multiple range capacitors for decoupling each individual IC, with the smallest being as close as possible and larger capacitors not too far away.


However, I'm running into a dilemma:



According to this source, the maximum allowed decoupling capacitance for a USB device is 10uF. With several IC's all having a combination of 0.1uF and 2.2uF/4.7uF decoupling capacitors, I'm easily exceeding this limit because they're all in parallel.


The only solution I can think of is to reduce/eliminate the larger decoupling capacitor and/or try to clump a few IC's larger decoupling capacitors together while keeping the smaller decoupling capacitors close to each IC.


In my mind neither of these solutions seem ideal. What is the recommended decoupling layout for multiple IC's on a USB powered device?


The theoretical power consumption of all the IC's under use is still below the limit that can be supplied via USB 2.0.



Answer



While not exactly what you're looking for, I have used power-management ICs to accomplish this. For instance, the TPS2113APW. I prefer this specific chip because it allows me to make dual-powered devices that can operate with either a wall-wart or off the USB, automatically preferring wall-power if it is available.


If you don't need dual-powered, you could use something like the MIC2545A


Ultimately, any capacitance "behind" the power-management IC (i.e. hooked up to the IC outputs) isn't "seen" by the USB; the bus only sees the capacitance "in front of" the IC (i.e. hooked up to IC inputs).


You still have to worry about inrush current - the "plus any capacitive effects visible through the regulator" part of the spec - but those ICs also have variable current limiting. Figure out the parallel resistances that you need to have 100 mA limitation and 500 mA limitation (and optionally n mA limitation if you want to limit wall-power), and then use FETs to short out the resistors as needed to enable various limitations.


Through these chips, I have attached PCBs with several hundreds of uF to the USB, and a DMM set to fast current max verified that the inrush during attachment did not exceed 100 mA.



measurement - Does the AD8495 thermocouple amplifier allow for grounded thermocouple probes?


I recently purchased a MAX31856 thermocouple-to-digital chip for a project. However, I discovered that the chip does not support grounded thermocouples. I am looking for an alternative and the AD8495 appears to be the only similar option. However, I cannot tell from the datasheet whether it supports grounded thermocouple probes. How can I tell?



Answer




You can use it.


In the 1st paragraph at pg 12 it tells how the IC deals with the problems coming from single-ended (i.e. grounded one end) TC usage.


The last sentence of that paragraph is the answer.



The excellent common-mode rejection of the AD849x prevents variations in ground potential and other common-mode noise from affecting the measurement.



ohms - Increasing resistance on speakers


My amplifier is rated at 8ohms for my surround sound but my speakers are 6 ohms. The owners manual says that if the speaker resistance is too low the power protector will blow and that is exactly what happens when I raise the volume on my amp. I want to increase the resistance on my 5 surround sound speakers and my subwoofer by 2 ohms from 6 to 8. I was thinking about inline resistors. My question is do I use 2 ohm resistors to take 6 to 8 and do I put them on both the positive and negative speaker lead or just one of them. If both would I put 1 ohm on each lead to get 2 ohms total?




Monday, 21 December 2015

Density of ROM vs Flash


Let's say I had a very large static dataset that I'd like to distribute via solid state memory to a lot of people. Let's say it's on the order of terabytes. What would be the densest type of storage I could use?


I read somewhere that in Intel's 14nm process they can fit ~37 million transistors on a square millimeter which would mean that about 400 MB could be stored on a square centimeter. This assumes one transistor per bit, which I assume is as good as you can get for ROM. (is this a good assumption?)


But then I notice that you can buy a 256 GB microSD card which is smaller than my hypothetical ROM. How the hell is the flash so dense and would it be possible to make a ROM that dense (or denser)?




transformer - Power LED bed lamp from mains


I'm attempting to build an LED bed lamp that will be powered by 240V mains. The LEDs are these ones which if I use with a 12V supply and have calculated correctly will draw 0.24W each. I plan to use 5 or 6 of them in the lamp so will consume a maximum of 1.5W.


Initially I thought I'd use a transformer and bridge rectifier to get the required 12V DC but the transformer weighs a ton and is too bulky. The next option was to use a plug pack but I'm wondering is there is a better way?


I think it would be possible to power the LEDs directly from mains using only a rectifier without mains and stepping down the voltage but then it's not safe. Are there any smallish components that can both isolate the mains and supply a DC voltage?



Answer




You could use a directly coupled power supply if the unit is completely sealed. Any part of a directly coupled supply and the circuit using its power could be floating at line voltages, so this is not something you want to do for general purpose. As long as everything is sealed in the same unit that just has a line cord coming out, then these types of supplies can be appropriate.


A very simple circuit for driving two LEDs from 240 Vac 50 Hz line power is:



The capacitor will allow about 7.6 mA RMS to flow thru the two LEDs. Each LED protects the other from backwards voltage, and they light on opposite polarity half-cycles of the power line. Not only does the cap need to be rated for the indicated voltage, but it must also be rated for power line use.


This circuit is very quick and dirty in that it doesn't protect the LEDs from power line spikes. The LEDs will limit the voltage, so a power line spike will cause a burst of current thru the LEDs. If that happens too often, it will eventually degrade their lifetime. However, these LEDs are rated for 30 mA continuous and this circuit runs them at 8 mA continuous during normal operation. That will still be plenty bright at night. There is a lot of current headroom, and a occasional higher current spike of short duration really won't hurt them much. LEDs are also cheap and available, and the simplicity of this circuit makes it easy to just try it.


Again, everything needs to be sealed so that it is not possible to touch any conductive parts during normal operation.


The main advantages of such a direct coupled power supply is that it is simple and very efficient. A ideal capacitor doesn't dissipate any power. Just about all the power drawn from the line is used to run the LEDs.


Calculating capacitor value:


One way to calculate the current in this circuit is by dividing the voltage accross the capacitor by its impedance magnitude. The impedance magnitude is:


R = 1 / (2 π F C)



When F is in units of Hz, C in Farads, then R is in Ohms. In this case the capacitor impedance magnitude, assuming 50 Hz, is 32 kΩ. Figure the LEDs drop about 2 V, so 238 V is put accross the capacitor. 238 V / 32 kΩ = 7.4 mA.


It should be obvious how to work this process backwards to find the capacitance that causes a particular current.


Sunday, 20 December 2015

microcontroller - How to split a floating point number into individual digits?


I am helping a friend with a small electronics project using a PIC microcontroller 16F877 (A) which I am programming with mikroC.


I have run into a problem which is that I have a floating point number in a variable lets say for example 1234.123456 and need to split it out into variables holding each individual number so I get Char1 = 1, Char2=2 etc etc. for display on LCD. The number will always be rounded to 3 or 4 decimal places so there should be a need to track the location of the decimal point.


Any advice on how to get this split would be greatly appreciated.




Answer



There's numerous ways of doing it. You may find your compiler has a library function to do it for you. It may be possible with:



  • sprintf() / snprintf()

  • dtostrf()

  • dtoa()


Alternatively, it's not too hard to write your own routine to do it. It's just a case of first working out how many digits before the decimal point there are, dividing it by 10 that many times, then taking the integer portion repeatedly while multiplying by 10, making sure you add the decimal point in at the right place.


So in pseudo-code it may look something like:


If the value < 0.0:

Insert - into string
Subtract value from 0.0 to make it positive.
While the value <= 10.0:
Divide by 10
Increment decimal counter
For each digit of required precision:
Take the integer portion of the value and place it in the string
Subtract the integer portion from the value
Decrement decimal counter
If decimal counter is 0:

Insert decimal point
Multiply the value by 10.

driver - How do I find out which current/voltage to use for an unlabelled LED panel?


I have a 600mm x 600mm LED panel with 576pcs 3014-type SMD LEDs in some unknown configuration/topology (edge-lit, similar to this one here: http://i01.i.aliimg.com/wsphoto/v0/1990066259_5/Wholesale-3PCS-Lot-48W-Led-Panel-Lights-60x60cm-Led-Panel-600-600mm-Ceiling-Panel-lights-LED.jpg ). I thought the standard way to power it would be a constant current driver, like the one I use for my smaller COB lights. I tried a 300mA driver, which resulted in 34V voltage drop (for the whole panel). The panel was fairly dim and clearly needs more power, but I don't know how much, as I have no data sheet of the panel or the individual LEDs.



How do I find out how best to power this panel without damaging it?


One idea was to try varying the current in a friend's lab (with his adjustable power supply), but where to stop? Is there perhaps a voltage limit over a single (white) LED that I could watch out for? Or is there some other useful measurement I could make with a standard multimeter?


I am looking for a method that does not involve a soldering iron because I do not have one suitable for SMD to re-assemble the LEDs.


(This question is related to Easy way to figure out a LED's Vf in order to pick an appropriate resistor but not quite the same, so I have opened a new question.)



Answer



I think you're on the right track.


Electronic components tend to die from overvoltage or overheating. An overvoltage can jump across an area meant to insulate and the spark can damage the insulation or conductive areas, or the high current from the spark can melt/damage nearby structures. Too much current tends to cause overheating, which causes similar damage.


If you can keep the heat out of a device (sometimes by extreme means) you can get incredible performance out of them. Think of the overclockers who use mineral oil or the LEDs which you can send a 10A pulse through at a 10% duty cycle. Operating limits are largely defined by what you intend on doing, and for most people that is continuous operation.


For your LED panel you're already off to a great start. You've got it glowing dimly. If you look at the data sheets of similarly sized panels (and look at as many as you can find) you will start to notice trends in their ratings. There is a very good chance that yours will follow the trend.


I would guess that the panel is meant to be bright, and it is also probably meant to operate safely in a 20C ambient. MOST components (not assemblies) are rated to 70C, and depending on the nature and quality of the assembly you may get a good portion of that. Try to determine if the panel is meant to be actively cooled or if it's meant to be attached to a heatsink or operated on its own in the open air. Since you're guessing, you'll be conservative.



If it were me, I would crank up the current slowly. Set it to 350mA and give the panel a good 10 minutes to come up to operating temperature, keeping an eye (or hand in this case) on it to see if it gets hot. Bump it up 50-100mA at a time, depending on how fast you feel the thing heating up and see where your comfort level is. A rule of thumb I've found is that if you can keep your hand on it, it's under 50C. something that is 50C above an ambient of 20C is operating at 70C, which is very likely an upper limit unless you know otherwise.


The cost, necessity and desire not to blow the thing up will determine your personal definition of maximum current for the panel, which in this case is the only value that matters. :-)


transistors - Biasing in common-emitter amplifier


I'm having trouble understanding the biasing of the common-emitter amplifier as depicted below:


common-emitter amplifier schematic


(Image source: Electronics Tutorials - Common Emitter Amplifier)


I keep reading that we should bias the collector voltage to be around half of Vcc, but I thought we should be biasing the base voltage to half of Vcc? In other words, I don't understand why we enforce Vc-Ve = (1/2)Vcc; I thought we should enforce Vb - Vin = (1/2)Vcc.


My reasoning is that the whole point of biasing was to prevent clipping and so biasing the input to half of Vcc would give us maximum swing. I am very lost on understanding this circuit so any step-by-step assistance would be appreciated.




Saturday, 19 December 2015

Splice high current charge source into USB cable?


Normal computer USB max current is much lower than needs of modern smartphone to charge while running, commonly needing ~2 amp chargers.


I want to be able to have my phone connected to my computer via usb for data purposes, but it maintain it charge.


Is it possible to do something like this to a usb cable, so instead of the 5v coming from computer, it comes from phone charger instead ?


schematic


simulate this circuit – Schematic created using CircuitLab




Answer



While it is possible to do something like this, there are 2 immediate problems I see:


1) Your device no longer has a common ground with the computer. This will likely result in your computer not 'seeing' the device, or complaining that it cannot communicate with the device.


2) Assuming the above was not an issue, certain phones (Apple products for sure), have a unique method to detect if the charger they are plugged into supports high(er) current charging. As you mentioned, the USB standard officially supports up to 500mA charging. The way Apple handles this is by adding a resistor divider on the D+ and D- lines (in their charger accessories) to bias the DC voltages to different values. The phone is able to detect the voltage ratios and then determine the type of charger it is plugged into, activating the supported charging mode.


Here is an image of the resistor divider that was used in a nifty product:


https://learn.adafruit.com/system/assets/assets/000/005/971/thumb160/adafruit_products_usb4res.png?1396830863


To find out more about, check out the project on ADAFruit: https://learn.adafruit.com/minty-boost


So in summary, it's not as simple as your schematic. As others have suggested, your best bet would be to look into USB hubs that support high-current charging.


eagle - Arrows on connections in schematics


Im using eagle, and was wondering how i'd produce arrows like this:
arrows in schematic


Is there a specific name for these? That show connections between many schematics.



Answer



In Eagle, right click on the label (or add one to the net first), choose properties and check the Xref box and click OK. I think the accurate name for these is Cross-References.



enter image description here


Friday, 18 December 2015

plated through holes - What is the meaning of this drill notation on datasheet PCB drawing?


Drawing the land pattern for a through hole part and am seeing this extra information below the main hole diameter (and tolerance):


through-hole PLC spec


For example, let's look at the one drawn right below the LED symbol (this is for a RJ45 connector with embedded status LEDs). I see the main part is diameter 0.89mm but...



  1. What is the 0.035mm beneath it?

  2. What does PLC stand for? It's not the first time that one has showed up on these datasheets, but I cannot for the life of me find the meaning of this acronym. I noticed the diameter was quite small, so wondering if this is a pilot hole location. My guess was "pilot location center" but that turned up nothing in Google either.

  3. What are the numbers beneath that, in the box, with the ZYX?


Have always had PCB components fit my landing pads, so curious what the engineer was trying to communicate with all this seemingly extraneous info.



Note: It is unfortunate that the word PLC means something else regarding electronics. That has made searching for this on stackexchange or elsewhere practically impossible with all the noise.


Thanks for the future edification!



Answer



0.89mm = 0.035 inches. 4 PLC means in 4 places, that is, there are 4 such holes. The box around the 3.43 dimension indicates that this is a basic dimension, that is, the ideal position of the hole. The Z, Y, and X are the primary, secondary and tertiary datums that the basic dimensions are referenced to. The cross-hairs looking symbol in the box below the hole dimension means this is a position tolerance for the location of the hole. The center of the actual hole has to lie within a 0.1mm circle that is located at the "true" position. The M in the circle means that the position tolerance is for the hole at "maximum material condition" which for a hole means it is on the small side of the allowable diameter (0.81mm in this case). If the actual hole is bigger, then that much extra is allowed on the position tolerance.


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