text
stringlengths
83
79.5k
H: Are FT2232 interfaces completely independent? Reading through the FT2232 dual USB UART/FIFO datasheet, it is unclear to me if the two interfaces are completely independent. In other words, can I configure interface A as MPSSE and interface B as a UART ? The D2XX programmer's guide mentions the FT_ SetBitMode function in order to configure the operating mode of an interface through its handle, but what happens with dual or quad interfaces ICs like the FT2232 and FT4232: do we get multiple handles for a single device (i.e. one for each interface) ? AI: can I configure interface A as MPSSE and interface B as a UART ? From the datasheet you have provided Section 3.4.5 Page 16 The FT2232H channel A and channel B each have a Multi-Protocol Synchronous Serial Engine (MPSSE). Each MPSSE can be independently configured to a number of industry standard serial interface protocols such as JTAG, I2C or SPI, or it can be used to implement a proprietary bus protocol. For example, it is possible to use one of the FT2232H‟s channels to connect to an SRAM configurable FPGA such as supplied by Altera or Xilinx. The FPGA device would normally be un-configured (i.e. have no defined function) at power-up. Application software on the PC could use the MPSSE to download configuration data to the FPGA over USB. This data would define the hardware function on power up. The other FT2232H channel would be available for another function. Alternatively each MPSSE can be used to control a number of GPIO pins. When configured in this mode, the pins used and the descriptions of the signals are shown Also in section 4 page 20 ...The FT2232H has two independent configurable interfaces. Each interface can be configured as UART, FIFO, JTAG, SPI, I2C or bit-bang mode with independent baud rate generators. In addition to these, the FT2232H supports a host bus emulation mode, a CPU-Style FIFO mode and a fast opto-isolated serial interface mode. So they can be set independently but I can't provide further info about D2XX programming
H: Using NPN transistor as switch Before I ask my question, I should say that I am very new to working with electronics and I may not quite know how to describe my problem. I am trying to use a pin on my msp430 microcontroller I have as a replacement for a pushbutton on a device. The msp430 is 3.3v and the device I am switching is 5 volts. I was under the impression I could use a 2n3904 transistor in place of the button by applying current by turning on the pin on the msp430 which would let current go from the collector to the emmiter, and hopefully "push" the button. This is my current setup However, turning the pin on does not activate the circuit. When I connect the jumper for the onboard LED, I can verify the pin is working. also, when I connect the 5v from the collector to the base using a wire, I can activate the transistor. What other information am I missing to solve this? Thanks in advance EDIT: After reading the comments, adding a 4.6k resistor between the base and IO pin and connecting my 3v ground and 5v ground allowed me to control the transistor without any noticeable problems. Thank you! AI: It looks like you need a current limiting resistor between your output pin and the transistor base (assuming you didn't omit it on purpose, for brevity). Without the resistor, when you set the output pin to HIGH, you are causing a short-circuit to ground. That may damage the pin, if it hasn't done so already. I would guess that a 10K resistor would do it. That's what I use with my ATmegas and ATminis. But check your MCU datasheet for appropriate values. It's quite a common mistake to think that the base-emitter junction already has some sort of current limiting property, but it doesn't. It has very low impedance. I usually think of it as a plain wire. That helps me avoid these kinds of mistakes. Same applies to collector-emitter junction. By the way, your collector-emitter path has no current limiting resistor or load. Watch out!
H: Reducing power supply ripple for GSM modem I'm powering a SM5100B GSM modem from a 5A bench supply (peak current is 2A). The required supply range is Vmin=3.3V, Vnom=3.6V, Vmax=4.2V, so I'm giving it 4V. Every so often, the module will reboot (a problem I've had with all three GSM modules I've tried: this, SIM908 and ADH8066). I presume that it's a power issue. My power is not dropping below 3.3V, but I saw in the SM5100B data sheet that the maximum ripple is 50mV\$_{PP}\$ for freq <200kHz and 2mV\$_{PP}\$ for freq >200kHz. I have a ripple that's generally around 40mV, but it does spike upwards sometimes. I put it on my DSO in pass/fail mode with a 50mV\$_{PP}\$ pass rule: I get a chirp every two seconds or so, and they look to spike up to about 100mV or so. I thought I might be able to fix the problem with a couple of capacitors, so I added a couple of 16V 1000\$\mu\$F electrolytics across the power supply rails on the breadboard, close to the GSM module. Unfortunately, it doesn't seem to have made the slightest bit of difference. What else can I do? Is the ripple really likely to be the problem, or am I chasing a red herring? AI: It is more than likely that what you see on your scope, is not the problem you are chasing. From the description, my first suspect would be the breadboard itself. Breadboards are notorious for having extremely bad contact resistances (like, 1 ohm, or similar), which may be of good service to provide power separation BUT only in case you have proper bypass capacitors on the load side. From the documentation of the GSM module, it looks like it has a small, fine-pitched SMD PCB connector. So, there must be some kind of interconnecting board this module is plugged into, and that board should host your low-ESR 470-2200uF electrolytic capacitor (as close to the connector as possible), not the breadboard.
H: Create a simple flip flop circuit I am just taking a electronics course, and i am trying to understand how to build a flip flop circuit. I would like to build a circuit that has one push button, and one led. Each time the push button is pressed the state of the led would change on to off or off to on. I found this circuit http://www.josepino.com/light/led-flasher-circuits1 and i built it and it worked, but i was wondering if i could possibly adapt it to suit my purposes since it says it is similar to a flip flop. Additionally, because i am short on supplies i would like to use only transistors, resistors, capacitors, diodes, leds, and switches in the construction of the circuit. The only examples i can find online of a flip flop is a flip flop where a manual reset is necessary. I believe what i currently have is an astable multivibrator, and i think what i am trying to build is a bistable multivibrator. AI: Here is a schematic for a typical T flip-flop. Every time you press the button, the output switches. All you need to do is to build the logic gates! You can use diode-transistor logic, resistor-transistor logic, whatever. When you're all done, connect the inverted output (Q#) to the data pin and connect your button to the clock. You might consider debouncing the switch. This can be achieved using a resistor and a capacitor.
H: Radios and Power RF newbie here. Lately I've been experimenting with RF. I built some simple oscillators, managing to get a tank circuit working as well as buffering the 1 megahertz output of a tin can oscillator. Great. Then I attached a spool of wire and a listened to a nearby AM radio tuned to 1000 kilohertz. Upon connection of the wire antenna, it silenced (due to the lack of amplitude modulation from my little circuit). Wonderful. But one thing is nagging me...how do I increase the power of the transmission? Now everything online says something about power, blah blah, watts, blah blah. But nothing really explains how it works. How do you increase the power? I could make the antenna the right length. That would help. More voltage or amplitude of the carrier frequency? Right now it's running on 5 volts. It'll probably have an effect to some degree, but I don't really think this is the right way to do it... More current? This doesn't make sense. It's just a wire connected to an oscillator! Nothing is flowing into the wire. How would you increase the current to the antenna? This just does not make sense at all. So how do you inject more power into the antenna? More current doens't make sense, so I guess the voltage must be increased. But...that doesn't make sense either. Those commercial stations broadcasting on kilowatts must use a extremely dangerous amount of volts! Could someone explain this to me? More specifically, how does radio power work? How would one amplify signal going into an antenna? AI: Power is the product of current and voltage. $$ P = IE $$ Impedance is the ratio of voltage to current (plus their relative phase). $$ Z = \frac{E}{I} $$ Your antenna has some impedance. If this were an engineered antenna the impedance would probably be \$50\Omega\$, by convention. If your antenna is just a random spool of wire, its impedance is something else. It probably isn't even purely resistive. However, it has an impedance, and that impedance does not change unless you change the geometry of the antenna. Your transmitter is a machine designed to deliver electrical power into a load, and that load is your antenna. Your antenna is designed to accept that electrical power and efficiently couple it to free space such that it radiates away. If you want to deliver more power to the antenna, then you can increase voltage or current. But, the impedance of your antenna is fixed (unless you design a new antenna). Thus, the ratio of voltage to current can not change. Thus, to increase power, you must increase voltage and current such that their ratio remains the same. Or, you can change your antenna. If you design a more efficient antenna, more of the electrical energy will be radiated away, and less of it lost as heat in the antenna and the transmitter. And yes, high power broadcast stations do use dangerous high voltages.
H: How to test capacitors of non working circuit board using capacitor meter? I bought broken sega megadrive 2 clone console. Something wrong with 7805 IC supply (I changed to another, but no result). But now I want test electrolitic capacitors and resistors, because I thing somewhere short/open circuit exits. I have chinese made capacitor meter. If I measure some capacitors with meter it show good capacity. But if measure some other so tester shows "1". But if i remove that capacitor tester shows correct capacity. So how realy test capacitors in board? I need to buy other equipment ? Or something else ? Megadrive 2 circuit board: My capacitor tester: I'm trying to test 100 uf electrolitic capacitor with 200 uf setting set on tester. Thanks AI: It is not possible to test the capacitors while they are still soldered onto the board. Because the capacitors are connected to other things, the measurement will not be accurate. This is especially true of power decoupling capacitors, where the measured capacitance will actually be the sum of all the decoupling capacitors. As an alternative I would suggest using a continuity device to check for shorts. Since your meter does not have that feature, you can use the ohm-meter to check that out. An excessively low number will indicate a capacitor short.
H: Confused about the input voltage in specification sheet? I am quite new to arduino .Something in the specification list makes me confused : I am confused about the following : Input Voltage(recommended)7-12V Input Voltage (limits) 6-20V Operating Voltage : 5V Is Operating Voltage is the voltage that is used to power up the board ? If So,What does Input Voltage(recommended) and (limits) refer to? Are they regular analog input voltages? Any Help regarding "Operating Voltage" and "Input Voltage" is highly appreciated ! AI: The MCU itself and associated circuitry runs at 5V. In order to provide a proper power supply for this, the Arduino has a voltage regulator on-board. This regulator should be supplied between 7V and 12V from an external source. Putting less than 6V or more than 20V into the board can damage it permanently.
H: How does a switching power supply reduce its power output? How does a switching power supply reduce its power output? For example, suppose a CPU ends some task, reducing its power consumption. What happens internal to the computer's power supply to cause it to put out less power? AI: The power supply's job is to maintain a constant voltage. When the CPU "switches off logic", less current is required from the power supply to maintain that voltage. The current demand from the CPU is constantly changing under normal operation, so switching power supplies have feedback mechanisms to adjust the current they produce such that they maintain the correct output voltage. Thus, if the CPU enters a special low power mode, the power supply need not do anything extraordinary. It just does what it always does: maintains the output voltage.
H: Rate of Laptop Battery Charging Assuming I have a working solar panel system, all the things such as inverter, charge controller and battery are in place. The state of battery will obviously change, some times it will fully charged and sometimes it wont be fully charged depending on my usage. Now, If I try to charge my laptop with this solar-panel-battery, Will the charging time of laptop be dependent on charging state of solar-panel-battery, that is will there be a change in the way laptop is being charged if solar-panel-battery is 80% charged or if it is 100% charged? AI: You're not actually charging your laptop battery with the solar system battery. (At least, you shouldn't be.) Your laptop includes charging circuits to make sure your battery gets the voltages and currents to charge it properly. So long as those circuits are fed with voltage and current within their operating range, your laptop shouldn't care what the exact nature of the source is. AC line and switching converter, charged battery, discharged battery, all that's going to matter are voltage and current capacity. Of course, there are a lot of details to "voltage and current capacity" that might bite you, this is a gross oversimplification, your mileage may vary, professional driver on a closed course, American Express cards not accepted.
H: What is the best radio protocol for long range serial communication? I'm working on a project that would require up to near time (<=5mins) of packet base communication over Long Distances of upwards to 80 Gm. Obviously the base station would have to be scaled for this but what would be the best protocol in this use case? UPDATE Thanks to everyone whom commented. We are initial looking to use a point-to-point communications medium over an unlicensed band however do realize the limitations of 2.4-5Ghz bands can cause for long distance communications. Hence why we're reaching out. AI: What is the best radio protocol for ... distance of upwards to 80M km? For that distance, people use ISDCS protocols. The long-haul standards are the internationally-agreed CCSDS “Packet Telemetry” and “Packet Telecommand”, which respectively permit the fully-standardized communication of spacecraft measurement and control information. These protocols have been specifically tailored to provide very high performance over weak, long-delay radio channels. Ref Obviously, to get "near-time (<= 3 mins)" comms - you have to wait for Mars to get a bit closer.
H: What is this inductor looking (RF) component? This PCB antenna circuitry supposedly is able to transmit on both 406MHz and 121.5 MHz. I can clearly see a micro-strip printed antenna. Facts: Dual-band 406MHz, 121.5MHz antenna My Assumptions: 1. 1/4 wave monopole dual-band antenna Questions: 1. What is that inductor looking thing? 2. How can they transmit 121.5 MHz with such a small antenna? 3. What is the point of the zig-zaged strips? Filter? add length? FYI 121.5MHz: Wave length is 8.0988 ft, 1/4 Wave is 2.0247 ft 406MHz: Wave length is 2.4236 ft, 1/4 Wave is 0.6059 ft AI: I guess the inductor looking thing is actually an inductor is answered also by 3 It is (also) an inductor. The inductors probably act as loading coil to adapt the antenna which is to short to be a quarter wavelength for 121.5 MHz. BTW: 121.5 MHz and 406 MHz are reserved for emergency signals. If you play with that you might get some unexpected visitors.
H: Resistor question for current limiter circuit The new Samsung Gear watch won't charge from my 1amp nor 2.1amp USB charger brick ports. I'm assuming this is because its own power charger is rated at 5v .14amp? So the watch dock has some kind of protection circuit. I am VERY rusty on my electronics (been almost 30 years!), and Current was always my weakest area to begin with... I'm planning to build a current limiting circuit: http://www.zen22142.zen.co.uk/Circuits/Power/add-on.html My question is: Based on the formula on the circuit design I=.7/R2, to limit to .14amp I would need an R2 value of 5ohm 1watt. Since I'm having a tough time finding that, I'm assuming that I can use two 10ohm 1watt resisters in parallel? EDIT Not sure why this was tagged as a "duplicate" of a power supply question, when my question was specifically related to parallel resisters. I prefaced my question, (which was good because I learned a few things) but I call out my specific question in bold, and tagged an answer that was specific to that question. AI: [instead of a] 5 ohm [resistor ...] can I use two 10ohm 1watt resisters in parallel? Yes. For resistors in parallel the combined resistance is the inverse of the sum of their inverses. $$R_{tot} = \frac{1}{\frac{1}{R_1} + \frac{1}{R_2}} $$ As others have noted, the answer to your question doesn't actually help with your charging issue.
H: What's the dual of Faraday's law of induction? Faraday's law of induction tells us that if we subject a coil to a changing magnetic field, a voltage will be found across the coil. Duality suggests something similar should exist for capacitors: if they are subjected to a changing electric field, a current will be found. Does this phenomenon exist? What's it called? Is there a simple experimental apparatus one might construct to observe it? AI: The dual of Faraday's Law is Ampere's Law but, while Faraday's Law is fundamental to the physics of an inductor, Ampere's Law is not fundamental to the physics of a capacitor. Now, it is true that, in circuit theory, the capacitor and inductor are duals: $$i_C = C\frac{dv_C}{dt} \leftrightarrow v_L = L \frac{di_L}{dt}$$ However, we have to be more careful outside the context of circuit theory. In physics, the fundamental relationship $$Q = CV$$ clearly requires the existence of electric charge and an electric scalar potential due to a conservative electric field. This equation relates electric charge and electric scalar potential. The closest we can get to a dual of this is $$\Phi = LI $$ which relates magnetic flux and electric current. But magnetic flux is not the dual of electric charge. The missing ingredient here is the hypothetical magnetic charge (magnetic monopole) which is the dual of electric charge.* Were magnetic charge \$Q_m\$ (measured in webers) to exist, it would be a source or sink of a conservative magnetic field (measured in amperes per meter) and there would be an associated scalar magnetic potential (measured in amperes). We could thus relate magnetic charge and magnetic scalar potential with a magnetic "capacitance" measured in henrys. Further, we could relate electric flux to magnetic current (measured in volts) with an electric "inductance" measured in farads. To summarize, while electric flux and magnetic flux are duals, and changing magnetic flux is fundamental to the physics of an inductor, changing electric flux is not fundamental to the physics of a capacitor. Indeed, it is the electric field itself, not the electric flux, that is fundamental. *Assuming magnetic charge exists, Maxwell's equations become $$\nabla \cdot \vec D = \rho_e$$ $$\nabla \cdot \vec B = \rho_m$$ $$\nabla \times \vec E = - (\vec J_m + \frac{\partial \vec B}{\partial t})$$ $$\nabla \times \vec H = \vec J_e + \frac{\partial \vec D}{\partial t}$$
H: Programming ATMega16L over ISP interface Sorry if the question seems silly, but I really need some expert guidance. My question is as follows: What are the necessary pins to program an ATMega16 chip over ISP interface? I've bought a locally made ATMega16L target board. I intend to use a standard USBASP (Fischl design) AVR programmer. Unfortunately, ISP headers on both devices are different. I'm really confused what pins to connect and what not. My AVR programmer has no Vcc output, while the target board ISP header has a pin marked Vcc. Do I need to power my target board with my programmer while writing to the chip, or the DC power of my target board would suffice? My Target board ISP header has following pins: 1. Vcc (+5V) 2. Gnd 3. MOSI 4. RxD 5. MISO 6. TxD 7. SCK 8. No connection 9. SS 10. RST AVR Programmer ISP Header: 1. MOSI 2. N/C 3. RST 4. SCK 5. MISO 6. N/C 7. N/C 8. N/C 9. Gnd 10. Gnd If only MOSI, MISO, RST, SCK and Gnd pins of AVR programmer are used, where do I connect Vcc, TxD, RxD, SS pins of target ISP header. I'm willing to do some cross-over connections between, programmer and target board ISP headers. Please help! AI: For ISP programming you only need MISO, MOSI, SCK, RESET and GND. The Vcc connection is optional, if the programmer can supply Vcc then you can power the board from the programmer. Note that the two Vcc should never be connected if they are both active because you will create a short. When you power the board from the programmer make sure to unplug the mains supply of the board. where do I connect TxD, RxD, SS pins of target ISP header. There is no need for these in ISP mode and normally they are not part of the ISP plug Note that some programmers I'm adding the connection scheme that should be followed for the ISP lines. The pins involved are: MISO : Master In Slave out MOSI : Master Out Slave In SCK: Clock RST: Reset GND: Ground VCC: Power supply (optional, if used the board mains supply should be disconnected. Also make sure that the voltage levels match, 5v or 3.3v) MISO/MOSI lines should not be cross connected. MISO is an input for master and output for slave and MOSI is output for master and input for slave so MISO connects to MISO and MOSI to MOSI.
H: crystal oscillators connected in parallel why there are two crystal oscillators connected in parallel in the circuit above? i am familiar with the configuration of Q2( look at the schematic) but what is the purpose of Q3? do i really need to implement it? if yes, why? the chip is CC430F5133. datasheet AI: If I drew a circuit with two crystals connected in parallel it's because on the Bill of Material I would be choosing either one or the other. The PCB layout would be tracked to take version A or version B but only one would be soldered to the PCB. This gives me the ability to buy version B if version A became unavailable. It's like showing pull-ups and pull-downs on the same IO line - it makes no sense to fit both but, as a design, I may want the option of fitting one or the other.
H: Tool to remove traces on a stripboard? I was wondering what sort of tool works best for removing traces on a stripboard like the following: Datasheet. Product page on Mouser. Image from http://commons.wikimedia.org AI: A knife with a sharp point can cut traces. Exacto knives are commonly used for this. A rotary tool (e.g. Dremel) works well for this too. The advantage of a rotary tool is that it removes material and clearly separates the remaining parts of the cut trace. The disadvantage is that it produces metal shavings, which can land elsewhere and short something. If I want to peel off a portion of a trace, I first cut it on both sides. Then I heat one end with a soldering iron. This causes the adhesive, which bonds the trace to the fiberglass, to soften. Then I can grab the trace with a pair of tweezers and peel it off.
H: Updating Arduino Uno R3 ATMega16u2 firmware Regarding another big problem I have with some of my arduino's boards I start to suspect the ATMega16U2 chip to be corrupted and would like to be sure that he's working fine. So I've download Atmel Flip and I'm able to connect to the ATMega16u2 through serial with the proper driver installed and the 16u2 passed in DFU mode. But now I'm a bit stucked. Indeed on the github repository of the arduino project I can only find the 8u2 code. And I can't find any hex file firmware for the 16u2... As it's the first time I'm doing this, can you help me a bit ? AI: The firmware you are looking for is in the Arduino installation folder For example if installed in the root of C C:\arduino-1.5.5-windows\arduino-1.5.5\hardware\arduino\avr\firmwares\atmegaxxu2` If you prefer an online link it can be found: https://github.com/arduino/Arduino/tree/master/hardware/arduino/firmwares/atmegaxxu2
H: Op-Amp - Sharing Non-Inverting Inputs in a two stage amplifier I've mocked up a simple circuit using a TL064A to reduce the single level of a single ended input audio source. I'm using two stages per channel, and both stages on each channel are sharing a connection to AGND. Is there anything inherently wrong with this? I understand that the Op-Amp will force the inputs to the same voltage, and I'm concerned this may lead to interference. Here's my schematic: AI: The TL064 op amp has a JFET input and the bias current is very low. R44 and R47 serve no purpose. The only reason for these resistors is to reduce errors caused by the input bias currents. However, the small input bias current going through these resistors will produce an offset voltage which is much less than the input offset voltage of the op amps. The resistors might be useful if the op amp had bipolar transistor inputs but this is not the case. The only effect of the resistors will be to add some noise in the circuit. BTW, if the resistors were used to reduce input bias current error, this technique relies on the input bias currents on the - and + inputs to be somewhat matching. This tends to be the case for bipolar input op amps. However, using the same resistor for two op amps means the offset voltage created by one op amp input currents will be an error for the other op amp. This is the main reason to not connect the + inputs from two op amps together to one compensating resistor.
H: What's the difference between SAI and I2S? I'm developing a USB audio device using an STM32F407G-DISC1 evaluation board. For the audio output I was intending to just use the I2S peripheral connected to a DAC. However the only sample code I can find uses an SAI module: What is this SAI module and how is it different from the I2S module on the STM32F407? Also, do I need an MCU with an SAI module for my USB audio output to work correctly or can I make do with I2S? AI: SAI is a Serial Audio Interface module. On the STM32F407, it contains two audio interfaces that can be used to send and/or receive audio. In addition to I2S, it supports other audio interfaces as well, such as AC97. If you don't need these features, and will only use I2S, then just use the I2S peripheral.
H: Solar charging LiPo batteries I would like to build a IoT project which needs need 5V. I have some 6V 1w solar panels which I would like to connect in parallel to charge some LiPo batteries 3.7V https://www.ebay.de/itm/6V-1W-Solar-Panel-Module-DIY-For-Light-Battery-Cell-Phone-Toys-Chargers/352161541865?hash=item51fe76aee9:g:r2AAAOSwk6ZZsrqC I have some TP4056 modules which has a max. input voltage of 5.5V https://www.ebay.de/itm/5pcs-5V-MICRO-USB-1A-Lithium-Battery-Charging-Protection-in-one-Board-Module/351493712096?ssPageName=STRK%3AMEBIDX%3AIT&_trksid=p2057872.m2749.l2649 1: What is the best way to bring the 6V from the solar panels down to 5V. A buck converter or a diode 1N4007? 2: Can I charge 2 or more batteries from one TP4056 module or do I need one for each battery? 3: Can I use different size mAh batteries in the circuit? Thank you in advance AI: The TP4056 has a Vinmax of 8V and can be safely operated, if desired, at 6V input. TP4056 datasheet here PV panel voltage regulation: A reason to limit Vin is that the IC will charge at a decreasing maximum current as Vin increases due to thermal dissipation issues. Charging specifications are given at Vcc = 5V (datasheet page 1) so limiting Vin to 5VDC makes sense. Due to the non-critical voltage requirement, a zener diode of suitable wattage could be used (option A below). If tighter Vin control is wanted, a simple shunt regulator will suffice - eg a TL431 driving a shunt transistor (P Channel MOSFET or PNP BJT) (option B below). Components are sized for regulation at 5V, 2 watt. simulate this circuit – Schematic created using CircuitLab TP4056 modules are relatively low cost (your price is OK but they can be substantially lower than your example if you buy 10 from some sites). It is better to use one module per battery although more than one battery can be connected in parallel with a variable degree of success. If connecting more than one battery, ENSURE that they are balanced first - connect them together via say a 10 Ohm resistor if voltages are about equal and maybe charge them individually first and then parallel them. Paralleling batteries of different mAh capacity is potentially doable but is inadvisable unless there is some good reason to do so. As above, equalise voltages first. There are two main styles of TP4056 modules available - those with a low voltage load cutout (which you have cited) and those without the cutout circuitry. Those with the cutout are much preferred in simple circuits where the user does not manage the load and battery, as they prevent cell overdischarge and battery damage or destruction. Battery protection circuitry: The diagram below shows a TP4056 charger plus a DW01A battery management IC and FS8205A dual MOSFET. The DW01A disables the path to B- when various conditions are not met. The TP4056 already provides charging and overvoltage control, so in normal use the main specification is battery undervoltage protection, preventing a load from discharging the battery below a safe level. On TP4056 modules with Out+ B+ B- and Out- terminals, the two extra ICs are the DW01A and the dual MOSFET. Very useful TP4056 & DW01A related application note here PV PANELS: The PV panels you cited are encapsulated in epoxy resin. This is potentially acceptable for occasional outdoor exposure. If they are to be used outdoors on a semi-permanent basis, you can expect a lifetime of as little as a summer (say 3 months), typically about a year, and in exceptional circumstances, a few years. A far better choice is "PET" encapsulated panels (or, less liable to be found, a fluorocarbon plastic encapsulation). Depending of manufacturing quality, a PET panel may give in excess of 10 years of full time outdoor use. eg PET PV panel 6V 1.5W $US3.06 free shipping - quality unknown but LOOKS reasonable. PET (Polyethylene Terephthalate) is the same plastic used in softdrink bottles. It is laminated to the PV material and PCB backing using EVA laminating plastic (as also used in standard glass-fronted PV panels.) PET chemical bonds resist breakdown by UV light, whereas epoxy resin carbon-carbon bonds are susceptible to UV degradation leading to frosting and crazing of the surface over relatively short time periods. Sunshine hours and related statistics for Esbjerg, Denmark from www.gaisma.com
H: I want to know the name of this switch It's a turn knob switch for setting the timer and push start in a Samsung microwave oven. I also want to desolder this component. How to do that? AI: It is probably a rotary encoder with a switch.
H: Will SN74HC245N transceiver support TTL RX when blocked? I'm actually designing a system with: ~10 "Master" boards that transmit data from slaves boards to a RS485 network 4 "Slave" boards per master one, connected trough a 3 pin jack (5V, GND and half-duplex TTL) Most of the time the slaves are sending data to the master (and so to the RS485 network), but each time a new slave is connected I need to send it its position (on which master board it is connected). So here's the schematic I want to use: simulate this circuit – Schematic created using CircuitLab SN74HC245N functional diagram: (from datasheet) So each time the micro-controller on the master board is detecting a new slave, it toggles the DIR pin and send the position to slaves (the data sent by others slaves will be lost in this time but that's not a problem). My questions are: Will it work? If, while the master is sending position to the slaves and some slaves are sending data at the same time, is there a risk to damage the SN74HC245N? As it's supposed to be a bus transceiver I think it is protected against this but I'm not sure... Thank you, Emerick AI: If you want the "master" to be able to override the "slave", you need to put the resistor in series with the slave's transmit pin: simulate this circuit – Schematic created using CircuitLab But what you're doing on the "B" side of the '245 is completely invalid. You can't just tie four of the pins together like that. For receiving, a 4-input AND gate (unfortunately, CircuitLab doesn't have one) combines the signals, assuming that these are UART signals that are high when idle. For the transmit path, individual resistors are used to limit the current when in receive mode.
H: How to make/duplicate a NEC Infrared Transmission Protocol what i am trying to achieve to be able to duplicate/recreate the infrared signal of my remote control using my arduino. The arduino has a already a library for this, unfortunately it doesn't seem to support the board that i am going to use the arduino mkr1000. The library has a recieve that makes me able to see the data, but the function for transmitting it back is not working. So this makes me resort to creating a function for sending myself. I know that the remote i am using uses and NEC infrared transmission protocol. So i looked at its specs. according to it: a 9ms leading pulse burst (16 times the pulse burst length used for a logical data bit) a 4.5ms space the 8-bit address for the receiving device the 8-bit logical inverse of the address the 8-bit command the 8-bit logical inverse of the command a final 562.5µs pulse burst to signify the end of message transmission. What i dont understand is, what is this address and command. unfortunaly i do not have an oscilloscope inorder to probe my remote to confirm some hypothesis. What i have though is the output of the serial monitor the arduino upon recieving the signal. Encoding : NEC Code : 2FD807F (32 bits) Timing[67]: +9200, -4500 + 600, - 550 + 600, - 550 + 600, - 550 + 600, - 550 + 550, - 600 + 550, - 550 + 600, -1700 + 600, - 550 + 600, -1700 + 550, -1700 + 600, -1700 + 600, -1700 + 550, -1700 + 600, -1700 + 550, - 600 + 550, -1700 + 600, -1700 + 550, - 550 + 600, - 550 + 600, - 550 + 600, - 550 + 600, - 550 + 550, - 600 + 550, - 550 + 600, - 550 + 600, -1700 + 600, -1700 + 550, -1700 + 600, -1700 + 600, -1700 + 550, -1700 + 600, -1700 + 600 unsigned int rawData[67] = {9200,4500, 600,550, 600,550, 600,550, 600,550, 550,600, 550,550, 600,1700, 600,550, 600,1700, 550,1700, 600,1700, 600,1700, 550,1700, 600,1700, 550,600, 550,1700, 600,1700, 550,550, 600,550, 600,550, 600,550, 600,550, 550,600, 550,550, 600,550, 600,1700, 600,1700, 550,1700, 600,1700, 600,1700, 550,1700, 600,1700, 600}; // NEC 2FD807F unsigned int data = 0x2FD807F; From the output can we point out which is the address and which is the command? so that i will be able to create a code for it AI: In the sample capture you have the data right there => 0x02FD807F. The address is 0x02. The logical inverse of the address is the 0xFD. The command is the 0x80. And the logical inverse of the command is the 0x7F value.
H: Correct way to control 12V relay from a Raspberry Pi I am working on a project where I need to control a couple of relays from the GPIO header on a Raspberry Pi. I tried getting a PCB with the layout like the right version in the image below, but I cannot switch the relay by setting the GPIO pin high/low. After some more studying I came up with version 2, which is the left version, using an NPN instead of a PNP transistor - is it correctly understood that it looks more correct than the first version? VCC is 12v and H1PXX is the GPIO pins which are 3.3v. P1/P2 are used to determine what to switch and are not relevant for this Can I somehow make the right version work? I already have the printed circuit boards, so if it is just a matter of soldering on a wire/resistor somewhere I could do that without too much of a problem. The board has a 5V regulator for the Raspberry Pi, so GND on the circuit is shared with the Raspberry Pi AI: The problem with PNP circuit is that the Raspberry Pi works on 3.3V while your Vcc is 12V. So, putting either a low signal (0V) or high signal (3.3V) always will turn on the PNP, because in both cases VBE = VCC - Vbase = about 0.7V. The base current will be either (12V-0.7V-3.3V) / 1kΩ = 8 mA or (12V-0.7V-0V) / 1kΩ= 11.3mA. Since you already have the printed circuitboards you should implement the NPN version. EDIT Regarding the NPN version: as you commented you need a NPN with the correct pinning (i.e. with collector and emitter swapped) like the MMBT9013 (don't know if it still exists). Other solutions i can come up with require rework (don't if the number of PCB's and/or the space on the PCB allows for it) putting a 9.1 zener in series with R10 using the pads of R10 (placing the components diagonal like /\ instead of --) you may need to lower the value of R10 replacing the PNP with a PMOS (e.g. NTR4171P), solder an 1k 0805 resistor on top of the gate and source pin and replace R10 by a tiny 9V zener (no idea what package R10 has, but e.g CDZFH9.1B)
H: creating IQ data for LMS6002D SDR I have an FPGA connected to an LMS6002D SDR from Lime micro. I also have an BladeRF board which I am using to help me verify the functionality. I starting out with trying to create IQ data for BPSK modulation and I am not sure if I am understanding what format the data should be on when I send it to lms6002d. Currently I have tried to encode binary 0 with I=500 and Q=0, while binary 1 as I=-500 and Q=0. So if I wanted to transmitt 0x2, I would send: (-500,0), (500,0)? I have tried to verify with bladeRF (TX -> RX) and set up an IQ file with basically 0x0F0F like this (not sure if bladeRF does any processing of the data before sending): 500,0 500,0 500,0 500,0 -500,0 -500,0 -500,0 -500,0 500,0 ... .. When plotting the magnitude and angle of the received samples I get the following (close to what expected): When trying the same in my FPGA and transmitting the same samples to lms6002d and receive with the bladeRF I get the following: Can anyone tell based on the plot what might be wrong? Am I generating the IQ data wrong? AI: You're getting nothing wrong. This just looks like your receiver isn't perfectly using the same frequency as the transmitter. A frequency offset is just a phase that is a linear function over time – hence the rotation in the constellation diagram. Also, you've got some I and Q offset. This should be rotationally symmetrical to 0+0j.
H: DC Series motor and its starting I studied electromagnetics and with that understanding when I recall the Working of DC Series motor I stumbled upon an inherent negative feedback action in the DC series motor during starting as follows: Considering the DC Series Motor is started with No Load: 1) At the instant of powering up the motor armature current is low (Transient) 2) Implies the current in the field coil is low 3) So the flux due to field coil in the air gap is low 4) The armature starts rotating because of Lorentz force 5) By faraday's law- the Back Emf is low as the air gap flux is low 6) So the armature current increases as per KVL 7) This, in turn, increases the torque on the armature. 8) However simultaneously the current through field coil also increase(since Ia =If ) 9)The FEEDBACK action ----Because of Step 8 the flux increases and thus back EMF induced increases which in turn reduces the armature current. Thus the Torque on armature also reduces and so the speed also inturn reduces!! Isn't this a negative feedback action? Won't this stabilise the DC series motor at some operating speed? Why it is said that motor speed increases drastically and reaches un-stability when started with no load? AI: At startup the speed is low (obviously zero initially) so the back emf term is also small, and the current is largely determined by the motor (plus source) resistance, once it has risen against the inductance of the field, which is typically a lot higher than that of the armature windings. Since both field strength and armature current are high after the starting transient, a large torque is available to accelerate the motor. As the motor speed rises, the back emf approaches the supply voltage, and the current, and field strength fall. This requires the armature to continue to accelerate - though the available torque to do so is falling - to maintain the emf. Eventually the motor can get to an equilibrium where the torque generated is equal to the friction and windage torque, but this is often a dangerously high value. Once it is at that point, determined by bearing and brush drag plus windage, it'll stay there until something fails. On small motors that's often the commutator that bursts. On larger motors, the commutators tend to be better made than the small molded ones, and it's often the endwindings that will 'fling' - expand outwards outwards until they smash against the field assembly. On portable power tools, which use a universal series motor, the cooling fan is often sized such that it determines the no load speed as the load it draws increases with speed per the fan laws.
H: Using GPIO to control multiple leds via transistors I'm trying to control 16 LEDS with the GPIO ports of a Raspberry Pi using transistors. All 16 can potentially be illuminated together. I'm trying to figure out if I can use approach B to save PCB space by merging the resistors, or if I must go with A (or they're both wrong?): Version A:                                                                       Version B: If B is possible, does it affect how I calculate the value for R7 (all LEDs being identical)? Right now I'm using LEDs that peak at 20mA (a bit too bright actually) with 3.3V forward voltage. But I can switch those out for different ratings if necessary. AI: Option B is bad because resistor R7 will limit the total current sinked to ground, and that total current will have to be shared among all the LEDs connected to it. Depending on R7's value and the number of LEDs connected to it, the current through the LEDs may not be enough and they won't "turn on", and brightness will be inconsistent (will depend on the number of LEDs "turned on"). Even worse: if you try to select a low value for R7 to overcome this limitation, the current may be far too high when there are only a few LEDs connected, and you may burn them. Option A is the way to go, as you can limit the LED current individually without any unwanted "interference" from the other ones.
H: Thread-Style Operation on Microprocessor This is a general question about designing firmware for AVR microcontrollers, say, the AtMega16. I have a routine that I am running through several thousand times per second. The routine is entirely interrupt driven outside of the main loop. I can still run code in the main loop, but it takes too long to operate with several thousand interrupts a second. I would like to have a routine that scans for incoming data and modifies a variable that the interrupt-driven routine uses. This routine should be asynchronous to the interrupt-driven loop. The variable(s) will change whenever the second routine is ready. Until then, the interrupt-loop should continue running as it was before. Imagine two processors that share direct CPU access to a common variable. They are both doing different jobs, but one reads the state of the other over the variable. Is there any way of simulating this setup on a single processor? I understand I may have to sacrifice processing power/speed for each routine to make this possible, but my interrupt-driven routine will naturally react to how fast the CPU can run it. AI: What you are describing are two genuine threads. The ISR and the main routine share the same memory space. For your simple application it is not necessary to use an RTOS. To communicate between the two threads you need a global variable, and you need to declare it to be volatile in C so that the compiler doesn't try to optimize accesses to it. You also need to be sure that all accesses to the global variable are atomic, meaning that changes to the variable cannot be interrupted. The simplest way of doing this is to disable all interrupts, modify or read the global variable, then enable the interrupts.
H: How should I interpret numbers 3 and 4 on the footprint schematic? I am creating a foot print for this PoE magjack and was wondering how to correctly interpret the symbols for 3 and 4 on page 5. From the schematic, these pins get wired but I am confused as to why they are not holes. Thanks AI: The schematic for the connector has RJ45 pins (1-8) on the right, and footprint pins (1-2, 5-15) are on the left.
H: Is this fuse time-current curve wrong? I'm looking at the datasheet for the Bel 0ADKC /0ADKP fuses. In it is this: These curves don't seem correct. Notice that the curves for fuses with >= 800mA asymptotically approaches a value that doesn't match their rated current. Is there some assumption I am unaware of? Or is this graph in error? This isn't the case with other curves that I see, but those were fast-acting fuses and these are time-delay fuses. For comparison these are the curves for the fast-acting Bel 0DAC/0ADAP fuses and the curves do approach the rated current. AI: They don't match the blow current. The graphs are the current that the fuses blow at (not the rating with one number). The reason for this being is it takes temperature to blow the fuses and then the fuse material must break down. This process does not happen instantaneously, its a phase change process. So the longer you dwell above the temperature, the more it will break down. If the current is exactly at the point of breakdown, it could take a long time to break down the fuse material down. To really blow a fuse, you must go beyond the blow current, the more you go beyond the blow current, the faster it will blow. It's also why currents close to the blow current should not be approached for long periods of time (like between 700mA and 800mA) as the curve probably also extends to this region but was not tested.
H: Verilog 'if' statement error Why are LEDs on after executing this? LEDs on pattern is 1010: module test(input clk, input reset, output reg[3:0] ledss ); wire[4:0] dataread; assign dataread=4'bzzzz; always @(posedge clk) begin if(dataread) begin ledss<=4'b1010; end end endmodule AI: When you set a signal in Verilog to z, you're allowing some external device to drive it high or low. In the physical implementation, if there isn't any actual device driving the net, then you're allowing random static electricity to drive it to either 0 or 1. You shouldn't expect to see an actual "Z" state in the physical circuit. On top of which, in comments, you said this was implemented on an Altera FPGA. Recent FPGAs (since 1995 or so) generally don't implement actual tri-state logic on internal nets. If you design a multiply connected bus with tristate in your Verilog, the physical implementation will use multiplexers to approximate the effect of the tristate logic. But there will never be an actual moment when the net is un-driven in the actual FPGA. Since you didn't specify whether you wanted a 0 or a 1 driven on those nets when your main driver applied "z", the synthesis tool was free to drive them to either 0 or 1 and had no way of knowing which you wanted.
H: SOIC-8 IC input pins small spacing at high voltage I'm looking at a high common mode voltage difference amp (AD629). The input voltage between the two input pins next to each other will be 150VDC. Normally the pads should be bigger on the PCB than the actual pin size. So between these two pads is at most 0.6mm space. I think this isn't enough. Do I have to make a cutout in the PCB? Why do the manufacturers design something like this? One or two NC-pins between the input pins would be very helpful. Thanks for your help. AI: See this related but not duplicate question here on electronics.stackexchange. The first answer has a chart, that lists 0.6mm as an acceptable distance. Keep in mind that the chart is mostly safety related -- if you're worried about leakage causing accuracy issues, that's a conversation between you and ADI.
H: Op-Amp output voltage exceeds the power rail voltage (in simulation) I'm designing a RIAA pre-amplifier based on the 2 op-amps from an NE5532 package. It seems that something is wrong, because the output of the 2nd stage is giving a 400V output which is way above the power rail voltage. Is it correct? The 1st voltmeter, XM1, is measuring the input voltage; the 2nd voltmeter, XM2, is measuring the output voltage of the 1st stage; and the 3rd voltmeter, XM3, is measuring the output voltage of the second op-amp, across 100k R7. AI: If it is SPICE's AC analysis it's not surprising. In AC analysis, SPICE figures out the small-signal linearized model of the system, then applies the input voltage to that model, assuming it is linear. There is no "resonableness" checking, or any attention paid to nonlinear effects of any sort -- and an op-amp hitting the rails is certainly a nonlinear effect. It is your responsibility, when using AC analysis, to verify that your system behavior is consistent with a linearized model. If it is not, then you need to use transient (i.e., full-blown nonlinear) analysis. Try a transient analysis with the same input -- you should see massive clipping on that second stage output.
H: How to stop current leakage in LED matrix I know that this issue has been discussed in this forum, but I am a beginner in electronics and I was unable to come up with a solution to my problem by reading the related threads. I am doing a 3x5 Led matrix (cathodes are connected row-wise): I used a raspberry Pi B+ with an MCP23017 GPIO expander, 1000 Ohm resistors and 5mm LEDs (20mA, 3.2V). I used 1000 Ohm just because this is what I had. I turn ON one LED at a time (I believe this is called multiplexing). This is my code for displaying the digit 2: import smbus import time bus = smbus.SMBus(1) bus.write_byte_data(0x20, 0x00, 0x00)#setting GPIOs of bank A as outputs bus.write_byte_data(0x20, 0x01, 0x00)#setting GPIOs of bank B to outputs MATRIX = [[1, 1, 1], [0, 0, 1], [1, 1, 1], [1, 0, 0], [1, 1, 1]] for k in range(100): for irow, valr in enumerate(MATRIX): for icol, valc in enumerate(valr): A = [0, 0, 0, 0, 0, 0, 0, 0] #the 8 bits to send to bank A of MCP23017 A[7-icol] = 1 #anode of LED to light up set to HIGH B = [1, 1, 1, 1, 1, 1, 1, 1] #the 8 bits to send to bank B of MCP23017 B[7-irow]=0 #cathode set to LOW bus.write_byte_data(DEVICE, 0x12, append(int(''.join(str(e) for e in A), 2))) #bank A bus.write_byte_data(DEVICE, 0x13, append(int(''.join(str(e) for e in B), 2))) #bankB time.sleep(0.001) Some LEDs lit despite not being 'told so'. From what I read online, this is due to current leakage. For instance, this is a two: Where does the problem stem from ? : - the code? - The way I drive the LEDs (should I add transistors? (and why?), should I change the value of resistors? should I add pull-up/down resistors?) I tried alternating between one LED ON then all LEDs OFF (I set all GPIOs to '0') but that didn't solve the problem. AI: With that expander, it requires 2 I2C bus transactions to change both of the A and B banks. Assuming the I2C is running at 100kHz, each write is going to take at least 26 mS (8 bit address, 8 bits data, 2 ACK bits, start and stop). Add code overhead from running Python, I’m going to guess you’re closer to 50 mS per write. It looks like you have a 1000 mS loop delay so for approximately 1/20 of the loop time, you’ve changed the A bank but not yet changed the B bank. I’m guessing that the LEDs are producing enough light during the 1/20 to be visible. Try adding one more write to the loop: turn all of bank B first, before setting the bits on A and then B. This should turn off the LEDs while the A bank is changing.
H: Pinouts for OKX-T/5-D12N-C not on datasheet T/5-12N-C]1 12v -> 5v DC-DC converter for a project so that I can power a solenoid and a RPi with a single power source. Unfortunately, the datasheet doesn't list a pinout. There are 5 pins, and I can locate pin 1 by the square solder target. There should be Vin (12v), Switch On (12v), Trim, Vout(5v) and Gnd. Is there a convention or standard that everyone should "just know", or is this an example of a part that should never have been made? AI: Look at page 11 of that data sheet. There’s a table showing the pinout. In the same page, the mechanical drawings have the pin numbers listed.
H: 12v Input LM2596 Step Down Module to USB 5.2V is Slow Charging I am trying to use this regulator module (LM2596) to regulate my car's 12V power (constant from fuse port), and use the LM2596 output set to 5.2V to charge my phone (LG G6) but get the slow charging warning (6hs xx mins to full). I presume the output Amperage can meet whats specified ~2-3A, but obviously something is wrong. I gutted a USB extension cable to solder to the output of the regulator. What Am I missing? Is this module capable of doing what I want? AI: For my configuration using this phone, I was able to twist connect the two data wires together, which then my phone then stopped the naggy slow charge message. I am aware that Apple uses a resistor across the data lines for their phones. Link provided in comments was supplementary to my goal. Thanks
H: Should I use a resistor between the gate driver and MOSFET (gate pin)? I'm making a PWM driver for a DC motor. After some questions were answered in this post, I ended up with this schematic: And I have some new questions: Do I need a resistor between the gate and the output of the gate driver (U?)? Do I need a pull-down resistor at the gate of the MOSFET? MC34152 gate driver datasheet AI: Maybe. The MC34152 datasheet pp.8 on shows a series Rg to damp oscillations, and reverse-bias Schottky diodes for catching negative ringing spikes at the driver. Wouldn't hurt to have these in your layout. You could stuff zero-ohm for Rg if you don't need damping, and no-stuff the diodes if you find the ringing isn't too bad. Have one resistor/diode per FET, don't share them. Place them near the gate. No pull-down is needed at the gate drive. But you will want a pull-down on the driver input to make the default state 'off'. Also, while we're discussing the inputs - tie them together and use both of the separate outputs, one for each FET. The way you have it - driving 2 FETS together - kind of defeats the purpose of the buffer. Finally, if your motor is a normal brush type you will want to use a freewheel diode across it to catch the flyback spike when the switches turn off. For BLDC this isn't an issue. Yes, C2 does this too, but the diode is better.
H: Using transistors to switch 12v from a 3.3v signal I'm a pretty accomplished programmer, but working directly with electricity is giving me the fits. I'm trying to replicate a design that switches a 12v/300ma solenoid based on a GPIO signal from a Raspberry Pi. The design suggests a TIP120 "darlington" transistor to accomplish this task, but no way that I hook it up seems to actuate the solenoid. I've actually removed the RPi from the design and am trying to just jump wires to practice. simulate this circuit – Schematic created using CircuitLab I read somewhere about an issue with the TIP120 where there is too much voltage loss resulting in the case where the solenoid doesn't have enough juice to fire. I read that I should try replacing the TIP120 MOSFET NDP6020, so I gave that a shot, but the solenoid is triggering even when there's no source signal! I believe that it's quite possible that I'm an idiot, so I actually set up a dummy circuit using 3.3v LEDs. Using those LEDs, I was able to get the TIP120 to work (kinda - the voltage loss was evident in the brightness of the LED), but not the NDP6020. And yes, I tried with multiple units, in case one was DOA or I accidentally burnt it out. What have I missed? I'm stumped. AI: Did anyone tell you to move the transistor to the low side yet? ;-). And, add a resistor to the base drive - 2k maybe should do it. It doesn’t take much base current to saturate a Darlington like a TIP120, which has a current gain (hfe) of about 1000. When fully on, the transistor will have a small collector-to-emitter voltage, Vce, of about 2V for TIP120. Not enough to make a difference really. You could use an N-FET too (on the low side) but make sure its threshold voltage (Vgs(th)) is low enough that it will be fully on with at 3.3V at the gate. This kind of FET is sometimes called a ‘logic level’ FET. This one would work: https://www.mouser.com/datasheet/2/308/FQP30N06L-1306227.pdf Finally, add a reverse-biased freewheeling diode across the coil to catch the coil’s flyback spike when the switch turns off.
H: RS422 and RS485; full-duplex or half-duplex? I have extensively used RS232 transceivers in many projects and have fairly good understanding of UART communication using RS232 transceivers. MAX232 and MAX3232. Now I have to build my understanding about RS422 and RS485 transceivers. So far I could not build crisp understand of the two as to when is one better than other. One thing that is clear to me is that RS422 use uni-directional transceivers for RX and TX differential lines while RS485 uses tri-state-able bi-directional transceivers. For RS232 I know its always full-duplex but for RS422 and RS485 both of them are at some places explained a full-duplex while at other places as half-duplex buses. What can we say with certainty about it for these busus? AI: The RS422 and RS485 standards only specify the electrical requirements. Both can be full-duplex but isn't a requirement of either specification. They are also similar enough that you can interoperate them in some situations. Now the big difference, which you already noted is that RS485 uses a tri-state system. This means you can have multiple transmitters sharing the single two wire bus, switching individual nodes as needed. In this configuration full-duplex probably isn't necessary or desirable. In comparison RS422 can only have one driver per wire pair, but the specifications allows for 10 receivers. If you're only using them for point-to-point communication, there really isn't much difference.
H: PCB Copper pour without making Schematic I have a problem with ground Copper pour for the PCB. I'm using EasyEDA.com to designing my PCBs. But because i usually make my PCB directly without Drawing its schematic so i can't make the ground Copper pour because there are no GND detected by the system. So i'm wondering if there are way to Copper pour without drawing the schematic? Following image just an example: AI: You can change the NET label, for every pad you want to connect to say.. GND :) Then you can change to pad type if it's a through hole component to attach it to the ground plane.
H: MUX (multiplexer): Do all people follow the convention that the upper value is let through if sel is false? Do all people follow the convention that the upper value is let through if sel is false? (assuming the multiplexor is facing to the right as shown on the image) I am asking this question because it doesn't seem like everyone follows this convention, which I thought was the case. Example (from nand2tetris): The upper value is let through the MUX when load is 1?! AI: A multiplexer is normally drawn with the inputs labeled with the select value(s) that enable them, so there's no confusion at all. Otherwise, there is no "convention". If you find a schematic without such labels, like the one in your video, you have to hope that the functionality is obvious from context. In this case, the select line is labeled "load", so obviously, the upper input must be selected when it is active, because that's how you load a new input into the register.
H: Fastest LCD data throughput 8080 or SPI I recently ordered a 128x128 graphic black/white display with a ST7541 chip-on-glass. It took me 2,5 days debugging and frustration to discover that they didn't wire SPI through the flatcable. A big trap for beginners, when you use the datasheet of the ST7541 chip as a reference while coding. So I rewrote my driver to parallel driving mode and everything is up and running now. This got me thinking what would be the best option performance wise to continue my product development. SPI or 8080 interfacing? I drive the display with an Atmega329 and we have enough pins to do 8080. First I thought 8080 would be the fastest, but I'm not sure if PORTD = displaybyte is a very fast and optimized way of putting so much data through. I guess the SPI architecture and MOSI pin is designed for higher data throughput? Or are they basically behave exact the same way? AI: The raw speed of the physical interface doesn't really matter all that much, because the effective throughput is going to be limited by the BUSY status controlled by the display anyway. It's probably safe to assume that all of the interface options are capable of keeping the display "busy" most of the time. The minimum cycle time of the 8080 interface is given on page 61 of the datasheet: 240 ns @ 3.3V. It's the same for the 6800 interface, too. The 3-/4-wire interface clock period is a minimum of 50 ns (page 65), so in terms of byte transfers, it's going to be roughly 60% as fast as the parallel interface (400 ns per byte). The IIC interface is limited to a clock frequency of 400 kHz (2.5 µs per bit, 22.5 µs per byte), so this is the slowest option of all.
H: Can lower than rated voltage be used on the non-control side of a relay? For example, if I had a normally closed relay with 120 VAC control and is rated for 28VDC on the other side, could I use 3.3VDC on the 28VDC side? AI: The control (coil) of a mechanical relay requires more-or-less the nominal voltage specified and will draw approximately the specified current (varying a bit with temperature and actual voltage etc.). The relay contacts (assuming a mechanical relay) can switch a range of voltages and currents. If the maximum is specified as 28VDC at, say, 10A maximum, you can switch 3.3V at 10A or less (subject to some allowable minimum current and voltage required to wet the contacts, usually < 10mA). Note that switching a typical 3.3V supply to a device with a lot of bypass capacitance and source capacitance can lead to a very high peak current (far beyond the specified maximum), as you're building something with the architecture of a capacitive-discharge welder, with the relay contacts being the bits that potentially get welded together. This manifests as "sticking" of the contacts and they can sometimes be opened by tapping the relay with the coil de-energized, though the contact surfaces will have been damaged. If the relay in question is a solid-state type the range of voltages and currents that can be switched depends on the design of the relay and the output device used.
H: Microcontroller with different sensors I am currently working on a project which requires different sensors and modules (Gyro, load cell, lcd, wifi and ultrasonic) with MCU. But I'm not sure if I have the right connections for WI-FI module. Can you please check the connection of wifi modules? Should RX and TX be connected reversely as I connected in the figure ? Thank you so much. AI: SPI needs a chip select signal, SPI_CS (probably) on ESP-WIFI connected to SPI1_NSS on the MCU (PA15). BOOT0 on the MCU should be pulled down. If you intend to use the built-in bootloader for field updates, you'd need a way to momentarily pull it up. Decoupling capacitors are missing. USART1_TX and USART1_RX should be exchanged. Now TX is connected to TX and RX to RX, which might even damage the ICs if you'd try to use them this way.
H: Strategies for troubleshooting buck converter I'm trying to troubleshoot a tps65261rhbr triple synchronous buck converter from 12V producing 1.8V, 3.3V and 5V. The 3.3V and 1.8V are stable and well-functioning but the 5V is not. An oscilloscope here shows the 5V (blue) next to the 1.8V (red) for reference: The 5V hovers around 620mV with occasional spikes to 2.9V, but the calculations from the datasheet to select component values, and the simulation I've run from PSpice suggest that these components should work correctly. The voltage divider uses the exact resistance values specified in the datasheet for 5V. Does anybody know what might cause this behavior in a SMPS? My current best guess is that I'm tripping the over-current protection circuitry as the 5V comes online, causes a delay for several switching cycles, then tries again. I think the oscilloscope behavior seems to match this description from the datasheet: The TPS65261, TPS65261-1 is protected from overload and over temperature fault conditions. The converter minimizes excessive output overvoltage transients by taking advantage of the power good comparator. When the output is overvoltage, the high-side MOSFET is turned off until the internal feedback voltage is lower than 105% of the 0.6V reference voltage. The TPS65261, TPS65261-1 implements both high-side MOSFET overload protection and bidirectional low-side MOSFET overload protection to avoid inductor current runaway. If the over current condition has lasted for more than the OC wait time (256 clock cycles), the converter will shut down and re-start after the hiccup time (8192 clock cycles) However, I don't think the loads I have on the 5V should exceed the 2A that the SMPS supports on this power line. Currently the 5V has several loads: a raspberry pi CM3 VBat (700mA), a LDO driving a 4G cellular radio (maximum 500mA during transmission), a ZED-F9P GNSS circuit (130 mA), 4 relays, and some other assorted circuitry that should consume negligible current (e.g. USB switch). In total if everything was consuming the maximum current I believe it should be around 1.7A. So unless I've miscalculated somewhere, the only reason I could see enough current draw to trip the overcurrent would be a short circuit. What I'm really looking for are suggestions for finding and proving root cause. I'm currently trying to rule out a short circuit, after that my next idea is to cut the 5v power trace and measure current over the gap and see if if I can power it with a bench power supply. AI: What’s the FB pin doing? Anyway, looks like it’s current limiting. Try disconnecting it from the load. Another option is to use a bench supply to add current to the 5V (use current-limit mode). This would be supplementing the DC-DC output, so you could see what the load looks like.
H: What is meant by the term "baseline noise" in this context? I came across this article about oscilloscopes. Under the figures and scope screenshots there is a term called "baseline noise". I googled but it turned out this baseline noise is used at different disciplines for different things. Does "baseline noise" regarding a scope mean that the noise floor measured when the probe inputs are shorted? Or? (English is not my mother tongue) AI: I would interpret baseline noise to be the RMS noise around the baseline, under what conditions we do not know. Baseline usually implies that the signal is around a 'relative' average value. Because the RMS measurement does not care about mean values, and only the noise is being measured, it doesn't matter what the offset in the system being measured. I assume that the inputs would be shorted, because that would give the best results for a noise floor measurment.
H: How to generate triangle shape? I tried to follow docs, and here is my implementation for triangle pulse: V1 0 1 PULSE(-0.75 0.75 0m 8.335m 8.335m 0 16.67m 0) but the result is: although the Rise time is 8.335m at appears as 0, can someone explain what’s the issue? AI: Don't ask why, but probably it NGspice fails simulating with a pulse width of 0. The following will work: V1 0 1 PULSE(-1V 1V 0 {8.335m-0.5n} {8.335m-0.5n} 1n {16.67m+1n} 0) EDIT It seems a known issue: https://sourceforge.net/p/ngspice/bugs/355/ Are you aware of the fact that setting a (pulse) parameter to 0 does not mean that it becomes 0.000000... but that SPICE sees this as a don't care and substitutes it with something (what it thinks is) reasonable? I would expect your actual pulse-width becomes 5 or 10% of the period (I didn't consult the source code for the exact number).
H: Generic 3 phase relay switch I have a water fill level sensor which is capable to power a 3A single phase 230V motor. However, I have a three phase water pump. Is there a generic "switch" / relay which "operates" on single phase but is capable to switch three phases? AI: Yes. You are looking for a 3-phase contactor with a 230 V AC coil. Figure 1. A three-phase contactor in a water pump application. Source: Wikipedia's Contactor.
H: How to measure VSWR of a single connector? With a 2-port VNA, I would like to characterize the performance of a single coax connector, specifically to obtain VSWR. The specific situation is an SMA connector at the end of a short section of semi-rigid 50 ohm coax that has no connector on the other end. The two techniques I can think of are: Add the same connector to the coax, creating a short double ended cable, and using the known electrical length, obtain the S parameters for one connector. I do not know the exact formula. Try to terminate the coax with a 50 ohm load. I think that soldering a resistor would not work properly at these frequencies (>9 GHz). Are there techniques I am missing? AI: Put the connector on a long piece of coax instead of a short one. I'd use 1 m or more, given your 9 GHz bandwidth. Then use time domain gating (a feature available on many VNAs) to measure only the reflections coming from the connector and not the reflections from the open far end of the coax. Time domain gating means the VNA will transform the response to time domain, apply a window around a part of the time-domain response you specify, then transform the result back to frequency domain before displaying the results. This would be a one-port measurement. The second port of the VNA would not be used.
H: Analog input like in a PLC: Thermistor or 0-10V Depending on the configuration, PLCs can often measure 0-10V, resistance or 0-20mA on the same set of screws. How to use the same screw terminal to measure resistance of an NTC element, voltages in the range of 0 to 10V or current in the mA range? Any suggestions how I would go about this? I know how to measure resistance, I know how to measure voltage, but I'm not quite sure how to combine these. Also it'd be nice to make something that won't break if you try to measure resistance on a 10V signal or the other way.. AI: simulate this circuit – Schematic created using CircuitLab Figure 1. A very basic setup. Leave the switches open for 0 - 10 V. Close the lower switch to convert 20 mA to 10 V. (Check the power dissipated in the resistor.) Open the bottom switch and close the top switch to provide a current to the temperature sensor which should be connected between IN and GND. Using PCB headers / jumpers is a standard way of providing this functionality.
H: What is the meaning of "do not populate test points" in a board schematic I was finding test points in a schematic of an Analog Devices Evaluation board. In one of the schematic pages, there is a clause mentioned "do not populate test points". Does anyone knows what it means ? AI: Yes, it means they are points provided for testing purposes so do not connect components etc to those points.
H: Understanding current sourcing and sinking in TL2426 rail splitter I have a 40dB active bandpass filter being powered off a single rail power supply with the TL2426 providing a virtual ground so I can get a dual power supply configuration. Currently, I'm having issues understanding the concept of current sink and current source in this configuration. When connected to a dual rail power supply, the active bandpass filter draws 60mA. Now according to the datasheet, the TL2426 can source 20mA. Does this mean this is the maximum output current that the TL2426 can provide to the circuit In the configuration shown above, the whole circuit draws ~71mA and the amplifying circuit still works as expected which I found suprsing, I've not probed the rails to check how balanced they are but unless I've misunderstood the concept of sourcing and sinking, if the circuit requests 60mA and the TL2426 can only give 20mA, shouldn't the circuit not just work? EDIT: Added Image of the circuit AI: The total current flows from the power supply positive rail. Some current flows though circuits you have connected to it and into the negative rail. This part of the total current does not involve the rail splitter. Some of the total current also may flow through other parts of your circuits into the "ground" pin of the rail splitter. Any current flowing in here will return to the negative rail through the ground splitter's transistors. The most current that the splitter can sink into this pin and still work OK is 20ma. Also, some current may flow into the power splitter's positive power terminal, and out through its "ground" pin. Then this current flows through some parts of your circuits into the negative rail. The most current that the spitter can souce out of this pin and still work ok is 20ma. Apparently in your case your circuits are not driving loads that are connected to the ground pin with more than + or - 20 ma., so the spitter is happy and working ok. Any current flowing your circuits from the +rail to the -rail does not involve the spitter...so that can certainly be 70ma or 100's of ma, only limited by your power supply's current rating. When determining if the splitter will still work in your particular application, you have to pay attention to the currents that are flowing in/out of the splitter's "ground" pin, and make sure that this these will not exceed the 20ma specification of the splitter.
H: Stacking M.O.T. to create an E-E core I just came across this site looking for answers on some questions I have concerning microwave oven transformers (M.O.T.). I am currently going into my third year as an E.E. student and I am trying to design a DC stick welder using M.O.T. I have been researching this topic for a week or so, but haven't found all of the answers that I need. The question I currently have is, if I separated two M.O.T. cores, removed both of the I portions of the E.I. cores, and stacked the two E parts to make an E.E. core, would I need to rewind the primary coil or will it still be usable? Because welding machines need low voltage-high current, the secondary is going to be rewound with a 4 AWG wire that has a current rating of 95A. Due to the thickness of the wire, it is impossible to get 20 turns in the M.O.T. core as it currently is. The diameter of the wire is 5/16" and will wrap side-by-side in the core twice. As the transformers currently sit it is possible to approximately get 4 layers of wraps for 8-9 total turns on a single E.I. M.O.T. core. To get an amperage low enough for the cable rating, I think I need approximately 20 turns. (At school I rarely go over 95 A using 1/8" rod and probably won't be using more than a 3/32" on my DIY welder. (welding sounded like a cool thing to do with my summer break)). However, if I combine two practically identical E cores from the M.O.T., I calculated that I can fit 22 turns around their cores with them put together. From what I have put together, this sounds to me like a good idea to reduce saturation (still trying to figure out the physics behind this because our semester was shortened), copper loss, and to allow for the thicker gauge wire to fit in. I thought about using magnet wire, but to get to a 4 gauge there it appears that I would have to use a Litz wire. This would be my first time using magnet wire, but I did try to salvage some from a core that I cut open and twisted 8 16 gauge wires together to get an overall 7 gauge (it was too stiff to use in one core.) A side note on that, molten NaOH (sodium hydroxide) will do work on the enamel that coats the copper wire. I have enough M.O.T.'s that I can stack two cores and have two transformers to run in parallel on the mains (120v), and series on the secondaries (unless someone wants to talk me into running the mains in series and plugging them up to a 240v outlet). I intend on using a 300A 1600V bridge rectifier to convert to DC then a choke/inductor and maybe 3 6000uF 50V Electrolytic Capacitors that are available to smooth out the ripple. Once I make it to this point I would like to install a power control circuit to control the power input to the primary coil variably limiting the output on the secondaries. Then I feel like a 555 timer would make a nice duty cycle but I've only watched two videos on that and still don't have anything to use it for yet. Thanks in advance. AI: Stacking the two Es together to make an EE core will work, geometrically, but there are some practical gotchas to be aware of. MOTs are built cheap to run hot, they are designed to operate well into saturation, drawing a huge magnetising current, to save on materials at the cost of power consumption. Consider the cooling fan to be part of the transformer system. While the original primary winding will work 'as well as it did', it didn't work very well originally. Consider using some of the extra winding space you've created to put on a few extra primary turns, to ease the maximum field down a bit and reduce your core heating. You're nearly doubling the flux path length, which other things being equal will reduce the primary inductance and so increase the (already high) magnetising current. However the amount the core is saturated will have a bigger effect on primary inductance, so put those extra primary turns on to reduce the saturation. Any air gap between the assembled Es will dramatically (air length has 1000x times the effect of iron length) reduce the primary inductance and so increase the (already high) magnetising current. Take a lot of care to not distort the Es as you separate them from the Is, sacrifice the Is to avoid damaging the welds that hold the Es together. Spend a lot of time grinding/linishing the mating faces flat (against abrasive paper backed with a sheet of glass) so they fit together well. Note that if they fit well over only (say) 70% of their surface, then unless you're running at only 70% of the saturation field those mating parts are going to saturate. If you're going to run near saturation, you need 100% of the mating surfaces flat. Don't stop linishing until they're flat.
H: Freewheeling diode position I have a pneumatic solenoid valve switching from IRF830 MOSFET. Solenoid valve connected to MOSFET by 2-3 feet long wire. It's necessary to use a freewheeling diode for this? What is the most suitable place to mount the diode ? Either near the solenoid valve or near MOSFET? P.S. This question about most suitable place for diode. Not about diode is need or not. AI: Yes, you need the diode. It should be mounted reverse-bias directly across the solenoid coil if possible. This minimizes the current loop of the coil discharge path. Otherwise, in a position that places it closest to the coil. Why is it helpful to minimize the current loop for the flyback diode? The spike that a large solenoid can generate is considerable. Even if it is suppressed on the origin controller, the field wiring loop is still carrying that high-energy current from the coil to the diode and back. This high-current transient can couple onto adjacent circuits, such as sensors and comms from other systems. Mounting the diode on the coil does introduce a couple requirements: the coil lead needs to be polarized, and if there is field wiring involved, it needs to be checked with a voltmeter prior to powering up the controller. (One of my first jobs was with Honeywell, and I did exactly this for solenoid hookups as part of system bring-up. I fixed lots of electrician goofs.) If ensuring wiring polarity is a problem, there is another solution: mount an R-C snubber across the coil like would be used for an AC supply. It’s not quite as effective as the diode, but it can work. (Maybe do that as well as the PCB-mounted diode.)
H: Don't individual signal sources affect each other when using a summing amplifier? I am studying the book Electric Circuits by Nilsson & Riedel. There I learned about "summing amplifiers" and how to derive equations by applying KCL at inverting input of the op amp. I see that solving equations result in this "voltage adding" behavior but I couldn't stop myself asking "Doesn't any current flow between those signals (voltage sources whose voltage values to be added) and doesn't that change how the whole circuit operates?" I cannot intuitively see why this circuit works. Until today, I always thought that it is not wise to connect batteries with different voltage values in parallel (even with some resistor in between) because then the one with the higher voltage will try to charge the other battery(ies). Further, I remember watching the battery management system video of GreatScott! and that also gives me a feeling that no voltage source should be connected to each other in such "simple" manner. If you could explain (preferably, like I am five) to me this summing op amp, I want to make a crude analog summing calculator. Thank you for any help. AI: I cannot intuitively see why this circuit works. Consider a somewhat ideal op-amp with an open loop gain of (say) 100,000. Consider next that the output voltage at any point in time is not saturated against the power rails i.e. the circuit is behaving like a linear amplifier. Then, imagine the output voltage, at any particular point in time was (say) 10 volts. This MUST mean that the voltage difference between inverting and non-inverting inputs is 10/100,000 = 0.1 mV. And, if the non-inverting input is tied to 0 volts, then the inverting input is at about 0.1 mV. If the output signal was a peak-to-peak signal between -10 volts and +10 volts then the non-inverting input will change +/-0.1 mV accordingly. This is why we call it a virtual earth; summing amplifiers make use of this to add the currents from each input source because adding voltages directly is problematic. If you factored in the +/- 0.1 mV change theoretically there is a slight influence from one input voltage of the mixer on another input but, it is negligible. Smallprint: It's only negligible if the real op-amp used has decent open-loop gain throughout the bandwidth of the signal. So, for instance, if the op-amp chosen has an open-loop DC gain of 1,000,000 it might only have an open-loop gain of 100,000 at 10 Hz. Taking this further, the open-loop gain might be only 100 at 10 kHz. So, to produce a +/- 10 volt sinewave at 10 kHz, the difference signal on the inverting input is +/-0.1 volts and not the piddling amount at DC. This is why real, quality, op-amp mixers use op-amps that are far superior to what might be initially felt to be needed.
H: How to connect a W25Q64 3.3 SPI Flash to a 5V Arduino Mega? I need memory to read from, for my project. I first intended to use an SD card, but I now found out a W25Q64/128 SPI Flash is more practical, since I don't need to write data. However, this W25QXX Flash works with 3.3V SPI and the Arduino Mega has a 5V SPI. By searching around, I find many solutions, but two that work which are quite different: Using a voltage divider, which has the advantage of a simple circuit, but has problems that too less current is passed. However according to this link, in the end, someone fixed it easily by using much smaller resistor values. Using a buffer circuit, which has the advantage of probably being more secure, but means some quite big ICs to be added. A circuit is mentioned in this link; credits to Steve Marple. Question: Why should I (or shouldn't I) use this SPI Flash with a 5V using small resistor divider voltages? (It seems that if I only want to add only this single 3.3V SPI Flash on the SPI bus, I can use the voltage divider using small resistors). UPDATE After Marcus Müller's answer, I found the following page that gives a lot of backgrounds (his solution is indeed the one with the most advantages): how-to-interface-a-5v-output-to-a-3-3v-input AI: Assuming you don't plan to use the chip in anything but standard SPI (not Dual- or QSPI), then all the signal pins are unidirectional! That means that in the Arduino->Flash direction, a voltage divider that divides 5V down to 3.3V is sufficient (place it close to the receiving end, usually). This applies to the clock and the master-out, slave in (MOSI) data pin (called "Data Input" in the flash datasheet). In the opposite direction (MISO / Data Output), there's little you can do to ensure reliable transmission but buffer. A buffer doesn't have to be large – in fact, a dual-NPN package would totally do with two resistors, and that would take single-digit square millimeters in SMD. You might simply want to invest 33ct into something like a 74LVC1T45. That thing is maybe 1.7×1mm² in size even in its largest variant; I doubt that will be a limiting factor for your circuitry.
H: Number guessing game:Compare numbers and position in Verilog I'm designing the number guessing game,aka mastermind,1A2B,And I'm stuck. I'm having problem with how to compare the 2 set of 4-digit numbers and output ? A ? B. ? A : when the number's position and value is correct,increase A's value,like, 1234=1234 => 4A0B,1234=1235 => 3A0B ...etc. ? B : when the numbers value is correct but position is not correct,increase B's value,like 1234=4321 =>0A4B,1234=7843 => 0A2B, 1234=5321 =>0A3B...etc. Initially I'm thinking to compare both of them by each digit,but then when I use if-else if-else statement to describe it,no matter how I code it,it'll only compare 1 digit,even though I wrote it to compare 2-digit at once... My biggest question is,how to compare these 2 set of 4-digit numbers and judge its position and value,then output how many A's how many B's. Codes based on my thoughts and only able to compare 1-digit at a time,even though,I tried code it to compare 2-digit at a time...ultimate goal is to compare 2-set of 4-digit. Disp_Save is register for saved answer ; Segs_R is register for input display 7seg on the right-hand side. Segs_L is register for compared result displaying 7seg on the left-hand side,default displaying 0A0b. Css is Choosing States,in this case,Css<=0; is return to Keypad detecting state. if(Disp_Save[3:0]==Segs_R[3:0]) begin Segs_L<=16'h1A0b; Segs_R<=16'h0; Css<=0; end else if(Disp_Save[3:0]==Segs_R[7:4]) begin Segs_L<=16'h0A1b; Segs_R<=16'h0; Css<=0; end else if(Disp_Save[3:0]==Segs_R[11:8]) begin Segs_L<=16'h0A1b; Segs_R<=16'h0; Css<=0; end else if(Disp_Save[3:0]==Segs_R[15:12]) begin Segs_L<=16'h0A1b; Segs_R<=16'h0; Css<=0; end else if(Disp_Save[7:4]==Segs_R[7:4]) begin Segs_L<=16'h1A0b; Segs_R<=16'h0; Css<=0; end else if(Disp_Save[7:4]==Segs_R[3:0]) begin Segs_L<=16'h0A1b; Segs_R<=16'h0; Css<=0; end else if(Disp_Save[7:4]==Segs_R[11:8]) begin Segs_L<=16'h0A1b; Segs_R<=16'h0; Css<=0; end else if(Disp_Save[7:4]==Segs_R[15:12]) begin Segs_L<=16'h0A1b; Segs_R<=16'h0; Css<=0; end else if(Disp_Save[11:8]==Segs_R[11:8]) begin Segs_L<=16'h1A0b; Segs_R<=16'h0; Css<=0; end else if(Disp_Save[11:8]==Segs_R[3:0]) begin Segs_L<=16'h0A1b; Segs_R<=16'h0; Css<=0; end else if(Disp_Save[11:8]==Segs_R[7:4]) begin Segs_L<=16'h0A1b; Segs_R<=16'h0; Css<=0; end else if(Disp_Save[11:8]==Segs_R[15:12]) begin Segs_L<=16'h0A1b; Segs_R<=16'h0; Css<=0; end else if(Disp_Save[15:12]==Segs_R[15:12]) begin Segs_L<=16'h1A0b; Segs_R<=16'h0; Css<=0; end else if(Disp_Save[15:12]==Segs_R[3:0]) begin Segs_L<=16'h0A1b; Segs_R<=16'h0; Css<=0; end else if(Disp_Save[15:12]==Segs_R[7:4]) begin Segs_L<=16'h0A1b; Segs_R<=16'h0; Css<=0; end else if(Disp_Save[15:12]==Segs_R[11:8]) begin Segs_L<=16'h0A1b; Segs_R<=16'h0; Css<=0; end else if(Disp_Save[3:0]==Segs_R[3:0] && Disp_Save[7:4]==Segs_R[7:4]) begin Segs_L<=16'h2A0b; Segs_R<=16'h0; Css<=0; end else if(Disp_Save[7:4]==Segs_R[3:0] && Disp_Save[3:0]==Segs_R[7:4]) begin Segs_L<=16'h0A2b; Segs_R<=16'h0; Css<=0; end else if(Disp_Save[3:0]==Segs_R[11:8] && Disp_Save[7:4]==Segs_R[15:12]) begin Segs_L<=16'h0A2b; Segs_R<=16'h0; Css<=0; end else begin Segs_L<=16'h0A0b; Segs_R<=16'h0; Css<=0; end AI: This isn't a full answer since it is homework. Basically, for each of the four input pairs, you will need an A output and a B output. They need to be four separate bits each. Then for the final output you need to add up the number of A's and the number of B's. I don't see any addition in your code yet, and it looks like all of the comparisons are changing a single result instead of four separate results. A bit more detail trying to clear up some confusion. Here is some pseudo-code showing the basic structure: // digit 0 if (input_0 == goal_0) A0 = 1 B0 = 0 else A0 = 0 if (input_0 == goal_1 or input_0 == goal_2 or input_0 == goal_3) B0 = 1 else B0 = 0 // digit 1 if (input_1 == goal_1) A1 = 1 B1 = 0 else A1 = 0 if (input_1 == goal_0 or input_1 == goal_2 or input_1 == goal_3) B1 = 1 else B1 = 0 // ... // similarly for digits 2 and 3 // add up results total_A = A0 + A1 + A2 + A3 total_B = B0 + B1 + B2 + B3
H: How to configure PWM on STM32F429I-Discovery Board Currently I have some difficulties on the Discovery Board STM32F429I to control the on-board LEDs via PWM. According to the data sheet of the Discovery Board the LEDs are located on pin 13 and pin 14 (PG13 & PG14). According to my research, it is possible to solve the PWM control with the on-board Timer to dim the LEDs. In the data sheet of the MCU, I don't see any timer assignments as an alternative function to generate the PWM signal at the LED. Enclosed is the mapping table from the data sheet of the MCU: Is there no "elegant" possibility to control the on-board LED via PWM? Which alternative ways exist to control the brightness via PWM of the on-board LED? Thank you very much. Link to the STM32F429I-Discovery Board user manual: Link to STM32F429 MCU data sheet: AI: The hardware solution Find two suitable timer output pins (check the STM32 pin description versus board functions table in the user manual of the board), and connect them with jumper wires to PG13 and PG14 on the board headers. Then proceed to configuring the PWM outputs on the selected pins. Always set PG13 and PG14 as inputs, otherwise the MCU might be damaged. The software solution If your program has a functioning SysTick interrupt handler, you can toggle the pins in the handler function. If you don't want the LEDs to visibly flicker, you'd need at least 20 Hz frequency. With a SysTick frequency of 1 kHz, 51 distinct output levels are possible, 0% to 100% in 2% steps. volatile int led1_level; // set this variable to control the duty cycle in 2% steps void dim_leds() { // call this function from SysTick_Handler() static int cnt; cnt = (cnt + 1) % 50; if(cnt < led1_level) GPIOG->BSRR = 1 << 13; else GPIOG->BSRR = 1 << (13 + 16); } Controlling PG14 is left as an exercise to the reader.
H: Sinusoidal wave output from a GPIO I think the question is not particularly MCU/board specified but I will be trying it on STM32F4-DISC board. I was thinking of how to output a nice sinewave from a normal GPIO output pin, but I was not able to find a proper methodology. I am asking for a method of thinking, a guide rather than the complete solution. Just give me an overview of the process. If possible of course. Thanks in advance. AI: Only dedicated DAC outputs could do this directly but for many purposes you could use a timer output pin in compare mode to generate pulse width modulation (PWM) and vary that in a sinusoidal fashion. If the you then filter it (sometimes with nothing more than some series resistance and capacitance to ground) you can end up with a reasonable approximation to a sine wave for many purposes. The greater the difference in frequency between the PWM repetition rate, and the desired sine wave frequency, the better the result you can achieve. With either a DAC or PWM, you probably want to implement a Direct Digital Synthesizer to produce the amplitude values, at least if you need to vary the frequency or it is not a nice fraction of an available clock. The DDS algorithm is described in this existing EESE answer (describing an audio application, but the technique is general) Most practical table based synthesizers use a fixed playback sample rate, and a fractional phase increment and accumulator register. Essentially, calculate the phase increment per sample period for your desired output frequency, and pre-multiply by a large power of two, say 1024 or even higher - with an ARM MCU you might as well just multiply it by 2^16. Each cycle add this phase increment to an accumulator register. The accumulator will be wider (have more precision) than the address input into your wave lookup table, so simply ignore the lower bits and use only as many upper bits as your lookup table has address bits. So you might be calculating time with 32-bit accuracy, but only using the upper 16 bits to look up samples in a 65536 element table. The result is that while the index time of a given sample is approximate, the cumulative time has many bits of accuracy. This easily gets you sub-Hz resolution, without the need to alter a timer or DAC clock at all. And that's important, because typically the cleanup circuitry in a DAC and following its output is designed for only a small number of sample rate(s). Note that if your lookup table contains a sine or other waveform with symmetry, you can probably shrink its size - for a sine you really only need to store a quarter of a wave, as you can get the other three quadrants by inverting phase or amplitude.
H: BJT output characteristics in negative Vce region? How do the BJT output characteristics in negative Vce region look like? Is it zero current or a reflection of the usual characteriscs in positive Vce region about origin? AI: Is it zero current or a reflection It is not zero and also not a reflection. You can simulate this for specific models like this: Which leads to these curves: Zooming in the reverse region, for a wider range of base currents (logarithmically from 1uA to 1 mA):
H: Grounding an audio signal I'm building a simple audio mixer. It's going to be running from a USB power supply, so I'm using a TLE-2426 to derive a 2.5V reference voltage for the summing op-amp. My question is, what do I connect to the sleeve pin of the TRS input jack? My first thought is to use the 2.5V reference as the ground, but then I thought that if the other component connects the cable's sleeve to its chassis ground, then suddenly there's a lot of current flowing through the cable. So, should I actually use the 2.5V reference as ground, or the actual 0V rail as ground? Should I include a decoupling capacitor, and if so, what size? simulate this circuit – Schematic created using CircuitLab Thanks to Transistor for pointing out the circuit schematic editor I completely missed, so I can illustrate what I'm trying to do. My original question was whether to connect Point #1 to Point A or Point B, but as I created the schematic, I realized that I don't know about Points #2 and #3, either. I think, based on Transistor's answer, that #2 should go to B and #3 should go to A, am I right? AI: What do I connect to the sleeve pin of the TRS input jack? Always connect to chassis ground. Your thought process is correct. Any other connection between the two system grounds would short-circuit your 2.5 V reference to ground. The current would be limited but your system would cease to operate. Should I include a decoupling capacitor, and if so, what size? No decoupling capacitor is required on the ground lines. If you are asking about a decoupling capacitor on the signal (to block any DC voltage superimposed on the audio) then please edit your question and maybe add in your schematic as it stands. There is a CircuitLab button on the editor toolbar. Double-click a component to edit its properties. 'R' = rotate, 'H' = horizontal flip. 'V' = vertical flip. Note that when you use the CircuitLab button on the editor toolbar an editable schematic is saved in your post. That makes it easy for us to copy and edit in our answers. You don't need a CircuitLab account, no screengrabs, no image uploads, no background grid. simulate this circuit – Schematic created using CircuitLab Figure 1. Original and modified circuit. The modified circuit should make everything clear. The main thing we've done is to ground the potentiometer bottom tag. It is generally safe to assume that there is no DC component from the source. We then move the DC blocking capacitor between the wiper and the op-amp input. This prevents upsetting of the DC setup for the circuit. A couple of notes at this point: Generally you want the load on the wiper of a pot to be at least ten times the value of the pot. With the components in Figure 1b there is a 10 kΩ load (R5) on a 10 kΩ pot. This will adversely affect the perceived linearity of the pot. To fix you can scale R5 and R6 up by a factor of 10. This will help us in your next question. Should I include a decoupling capacitor, and if so, what size? Because the inverting input is a "virtual ground" C4 and R5 act as a high-pass filter. You need to set the corner of the cut-off about 0.1 times the lowest frequency you want to hear. The cut-off frequency is given by \$ f_c = \frac {1}{2 \pi RC} \$ so increasing the value of R5 by a factor of ten means we can reduce the value of C4 by the same factor for a give frequency. Further reading: High-pass filter on Electronics Tutorials.
H: What is actually sent/loaded to a microcontroller / STM32? I see in all tutorials or sources, everybody creates a project in some IDEs and then loads code to the MCU again via those IDEs. What is sent to the MCU? Is it a sequence of binary numbers or some different file? Is there one file that I can just send it to the MCU without using any third-party application (IDEs)? For example, I am using STMicroelectronics's STM32CubeIDE, and as I understood, it generates a .elf file. What is the role of this .elf file? In which step does it stand during loading code to MCU? I think I found a better way to express myself. I am essentially looking for something identical to a .exe file. Through the development of a .exe file, there are lots of parts .c , .h , .cpp for example. But an end user only needs an .exe file to run the code. Then I wonder if there is an equivalent of this .exe file (or any executable file format from other operating systems) in embedded platforms. The comments below the approved answer may be helpful to understand in detail. AI: As Eugene has already mentioned, getting the data off your computer and onto the microcontroller requires some form of proprietary USB to JTAG or Serial converter, and software to communicate with that converter. That said, you don't always have to know all the code (C files and such) to program a microcontroller. For instance, you can use a .hex file, which is just a formatted series of bytes and offsets loaded straight into the memory (flash, EEPROM,etc), to run from on an STM32 using the ST-Link Utility. Hex files are simply pre-compiled versions of the C files. To address your comment about what "file" is sent to the microcontroller, there isn't one. The programmer simply wipes the MCU's memory, and then replaces that memory with different bytes. These bytes are determined by what's in the .hex/.bin file.
H: X86_64 Architecture, how does it handle instructions larger than 64 bits? I have been looking more into how CPU's work, and have a question. If I have a instruction that e.g. takes a 64bit address and a register, and copies the value from that address into the register. And that instruction has a 2 byte opcode. Then let's say the entire instruction is 80 bits in size.(8 bytes) Then how would it execute that instruction? Since I presume it doesn't fit in the instruction register(because the register is 64 bits). Does it just take the opcode and fetch the address(and later it's value) and register later? Or does it have multiple registers? Or does it have one mega big instruction register to fit it all? Thanks! AI: Being a 64-bit architecture does not mean there is a single 64-bit instruction register where everything must fit. X86_64 instructions can be up to 15 bytes in length. Each opcode is decoded for execution. In your example, there would be an opcode for moving data that needs another opcode byte to know what to do, and then it knows that 64-bit immediate address follows that must be read and which register will be the target.
H: Transistor power dissipation rating I'm trying to build the following circuit Except mine is a 24V ~20A (500W) motor, so I need to swap the components. I'm currently looking into transistors and I've stopped on the 2N6284 (NPN) transistor, which is rated at 100V 20A. This basically means it's good to up to 2000W (right?), but it says the maximum power dissipation is 160W. Now this makes no sense so I'm guessing it's how much of the 2000W going through it will be lost as heat? I've looked all over the data sheet and there are a lot of things I don't understand on top of which is this diagram that suggests that temperature increases as power dissipation decreases? Isn't the relationship supposed to go the other way around, the more power lost as heat the higher the temperature? If any of my assumptions is correct then how can I calculate how much power will be lost running my 500W motor at 24 volts? AI: First, the power burnt up in a component is equal to the voltage drop of that component times the current going through it. The transistor has a \$V_{CE}\$ of 3V when the collector current is 20A, so that works out to 60W. Second, the power derating curve works by telling you the dissipation you can allow for a given case temperature. You read across until you find your design case temperature, then up to find the allowable dissipation (or, usually, the other way -- in your case you'd start at 60W, then read across to find that you should design for a case temperature of around 135 degrees C). Third, you'll need heat sinking to keep the case temperature down -- that thing won't dissipate 60W by itself. Fourth (and beyond what you were asking), you need a base current of 200mA to maintain that 3V \$V_{CE}\$, and that's pushing into a base at a voltage of 4V. You are not going to do that with a microprocessor GPIO pin.
H: Practical examples to determinism and periodicity of analog signals? What I understand from deterministic signal is that we can define it as a function. Same thing is valid for a periodic signal. But periodicity and determinism are are treated as independent categories in analog or digital signal processing if I'm not completely wrong. I saw many definitions purely abstract or mathematical. Instead of going into abstraction too much is it possible to give a real life example to these signals? For instance, if I set the function generator to output a sine wave I would call this signal as "deterministic and periodic". But besides this I cannot imagine others as practical examples. So to me the easiest one was "deterministic periodic signal" which is the ideal function generator output. Can we give a similar examples to a "deterministic aperiodic", "non-deterministic periodic" and "non-deterministic aperiodic" signal? Some of these might not exist but I'm trying to relate these to real and prectical examples. AI: Well we're working in a gray area here, since notions such as "deterministic" and "periodic" are already theoretical constructs. For example by their definition they typically presume that the value of the signal can be specified from \$- \infty < t < \infty\$, and that can never be true for any "practical" signal. So here we are going to make some approximations. Deterministic and periodic: like you said this is pretty easy. A sine wave, for example. (As the above, it is only "deterministic and periodic" while the function generator is on and we ignore the noise, but that's kinda what we mean by "practical" here.) Deterministic and aperiodic: well a DC voltage would probably qualify, but that's academic and debatable. Probably a useful real-world example would be a decaying voltage in an RC circuit \$v(t) = v_0e^{-t \over RC}\$ for \$t \geq 0\$. The value is always changing but never repeats. Non-deterministic, but periodic: pretty sure this is impossible, in any practical sense. If we cannot predict the future value of the signal, then how can we say that it repeats? You could meet this definition with a looser definition of "periodic", for example an FM signal where the specific frequency randomly varies over time. Non-deterministic and aperiodic: any noise signal meets this definition. Even some function generators will have a noise generator output. Or you can build a simple avalanche diode noise generator and create your own non-deterministic aperiodic signal.
H: Programming STM32 Black Pill with ST-LINK/V2 dongle So I recently bought the STM32F103C8T6 "black pill" dev board along with the ST-LINK/V2 dongle (more probably a Chinese clone). After much struggling I figured out that I need to hold down the dev board's reset button for the dongle to detect the MCU but then when I connected the dongle to my STM32F429 Discovery board, it detected the F429 without having to hold down reset. I know the connection process has a "Connect with reset" option where you connect a reset pin to the board and the dongle does the hard reset for you, but I monitored the pin and it doesn't do the reset (probably a Chinese flaw?). It's not the end of the world, it's just weird that the 103 needs to be in reset to connect, but the 429 doesn't. The 103's SWD pins aren't assigned other functions so that's not the issue. Any insight would be greatly appreciated. Why do I need to have the 103 in reset and not the 429? AI: A key driver of your problem is likely that the overwhelming majority of the compact little unofficial "ST-LINK" dongles do not actually drive their labeled reset pin, as the pin is connected to a different GPIO than wherever whatever firmware they are runnings thinks it is. You can verify this while watching the pin with a storage scope triggered on it. As they say, "you get what you pay for" As a result, they won't work in a situation where you need to actually assert the target's actual reset line automatically. Substitute an actual ST-LINK or use a Discovery or Nucleo board recent enough to be able to drive the reset (the early ones could not do that either)
H: Intuitively, why does voltage drop across a series circuit? I'm having a really rough time intuitively grasping the basics of electricity. Taking into account that current is constant across a series circuit Using water flow analogy, suppose we have a piston that’s pushing water molecules through a constricted pipe at a rate of 3 molecules passing through the pipe per second with a constant voltage or “pressure” of 5V. (values are for illustration purposes only) We notice before, during, and after the constriction, the current is the same. So if the current coming out of the first constriction into the second constriction is the same as the current going into the first and the resistance is the same across both constrictions, why would the pressure be divided among the resistors equally rather than the two resistors having the same pressure, how does this make any sense? I understand Ohms Law and how the math works out but I’m asking intuitively why would voltage divide in this case rather than be equal across the “constrictions.” AI: There are a couple of ideas you are probably missing. One of them isn't often taught directly in an electronics textbook (but would be found in a physics textbook.) The other idea is simple enough and is where I'll start. Suppose you have the following schematic: simulate this circuit – Schematic created using CircuitLab With reference to the ground symbol (we can place that anywhere, but I've chosen the conventional location here), the following graph may help: The \$y\$-axis is volts and the \$x\$-axis is just the labeled positions around the loop. You can see that a wire doesn't have any (much) voltage difference, one end to the other of the wire. But the resistors are where the voltage varies. The resistors are where there is a significant voltage gradient. In between the resistors, there's no appreciable voltage gradient as the above chart suggests. Note that the gradient is "steeper" for \$R_2\$ than for \$R_1\$ in the above graph. This is partly an artifact due to my use of uniform spacing on the \$x\$-axis for each point on the schematic. But the artifact isn't a harmful one. If the resistors are of the same length, then the above chart doesn't do any injustice to the gradient's slope. There is a reason why this takes place in a circuit. The above is just a statement or claim about it. But it doesn't explain why. For the why, you need to go into physics-mode. When the circuit is connected up, almost instantly very small numbers of electron charges set themselves up on the surface of the wires in order to create those gradients I mentioned above. If you need more details about that process, you can visit here or here for some varying perspectives on that aspect. Or just ask me to refine the question a bit. Follow-up Question On your graph, voltage is dropping throughout as you said/shown. Since resistance is fixed, if voltage is changing, wouldn't current have to change as well given by Ohms law? and if so, then wouldn't this mean current is not constant across a series circuit? The voltage shown on the chart is just a number representing a field value at some point in 1D space. (Reality is closer to a 3D space, though this brings in Minkowski space-time. A complexity which is better avoided for now.) The field number is assigned by humans and is, of course, entirely arbitrary. We choose a reference point. Nature does NOT choose it. Just as relativity theory tells you that "everything is relative" and that there is no such thing as a "privileged frame of reference" in nature, so also is it true that for the purposes of a voltage value there is no such thing as a privileged voltage (such as zero.) All voltage numbers are equally privileged and everything is relative. This is the first thing you need to hammer into your head. Voltage numbers are arbitrary. However, and this is very very important, the voltage difference between two points is not arbitrary. That is something that nature does care about and will enforce. So while you can choose to make "ground" have the value of one million, for example, and all of the other points will have values relative to that assignment choice you made, the differences between these points will be the same regardless of your starting-point choice. Okay. With that out of the way, here's the answer to your question. Current is not driven by some arbitrary voltage number assigned at some point in space by you! You don't matter to the universe/nature. It doesn't care what number you've assigned. That's your problem, so far as the universe is concerned. What the universe does care about, though, are the differences between that point and nearby points. So if the field value is \$7\:\text{V}\$ at point A and is \$8\:\text{V}\$ at point B, then there is a field gradient between these points of \$1\:\text{V}\$ divided by the distance between them (easier to compute if you use a straight line between the two points.) If the distance between is \$1\:\text{cm}\$ then the gradient is \$100 \frac{\text{V}}{\text{m}}\$, assuming a simple linear relationship along the way. It is the gradient, not the values you've assigned, that drive currents. If point C is at \$250\:\text{V}\$ and all the nearby surrounding values are also all exactly the same, and at \$250\:\text{V}\$, then there is no gradient and therefore no current. Looking back at the resistors and the chart, you can see the gradient. (As I pointed out earlier, the slope of the line shown is an artifact of how I drew the chart.) It's that gradient that drives current through the resistors. Now, before you ask me about the wires, let me jump in. I used "ideal" wires. Real wires aren't ideal. They also have resistance. But just a lot less. So it takes only a very tiny gradient from one end of a wire to another to cause a substantial current in the wire. The magic that takes place when you apply a voltage source to a circuit loop is this: the moment you apply the voltage, electrons set themselves up along the surfaces of everything in the circuit loop, almost instantly, in just such a way that the voltage gradients between physical points in the loop are exactly what's needed to cause the single value of current to flow that will be equal throughout the circuit loop. The electrons self-organize, perfectly. See this as, perhaps, like taking a moment (femtosecond?) to re-align themselves in various corners, nooks and crannies in just such a way that all of the voltage gradients between any two points are exactly what's needed to sustain that current. How do they do this? It's all just about some local jostling around. The applied voltage immediately causes electrons to shift around and move slightly. As they do, they affect other nearby electrons. And this affects still more. All of this happens so fast, it can only be observed in a laboratory. For us mortals not living or working in physics labs, we can ignore the momentary event and just assume it happens "like magic." Once the electrons have been self-positioned just right, though, the rest just happens. Keep also in mind that it takes only a very, very, very small number of electrons all along the way throughout the loop to impel very large currents. (This is a reflection of the incredible magnitude of the electric force, which we don't normally experience at our human scale of things because the world around us is "mostly neutrally charged" due to the power of those same forces.) So the number of electrons involved is so small, and their very tiny motions required to get into position so little, that it isn't observable as a current by itself. It's just really quick. And once that's done, the circuit just works right and according to Ohm's law. I'm sorry about writing so much more here. But you are trying to get an intuitive understanding. If you want to more fully understand this, please get and read a book I often recommend: "Matter & Interactions," by Chabay and Sherwood.
H: Can I use a 3 pin kettle power lead instead of a 2 pin kettle power lead I have a computer appliance that only accepts a 2-pin kettle power cord (UK plug type). I don't have a 2-pin available at the moment; only a 3-pin. The third pin that is missing is the ground connection. Would it be ok for me to use the 3-pin kettle? Both are 10 Amp, 240 V cables. AI: These are IEC 60320 standard appliance cables. This standard includes many different shapes for the connecting plugs and sockets, and they have been carefully designed so that unsafe combinations are physically impossible. It is safe to use this "C13" cable (10 amps, grounded, three wires) to power a device with a "C18" socket (10 amps, ungrounded, two pins), and therefore the connector shapes allow you to do so. (Ironically, one of those impossible combinations is using a C13 cable to power an actual electric kettle; that's considered a high-temperature application and it requires a C15 cable. But you can use a C15 cable on a device designed for C13.)
H: What is the difference between Periodic and Non-Periodic Tx/Rx FIFO in USB? I am trying to understand how the USB module works in the very low level on STM32F4 MCUs (ARM Cortex-M4 core). In the reference manual I read often the terms Periodic and Non-Periodic Rx/Tx FIFO (I am not sure if there is periodic and non-periodic RxFIFO), for example: Periodic TxFIFO empty interrupt mask Nonperiodic TxFIFO empty interrupt mask Receive FIFO nonempty interrupt mask I do not understand what does periodic and non-periodic Tx/Rx FIFO mean (I do know what a FIFO is), I found no really helpful online resources about this. Could someone explain these terms to me please? and are these terms only specific to Tx but not Rx FIFOs? AI: The reference manual where you found these terms mentioned itself explains that the two types of FIFOs are used for different types of USB transfers, for example in section 34.12.2 The host uses one transmit FIFO for all non-periodic (control and bulk) OUT transactions and one transmit FIFO for all periodic (isochronous and interrupt) OUT transactions. Realistically you probably should not be looking at the hardware engine in this level of detail unless you have substantial USB expertise; for any normal use you would let an existing USB stack (from ST or someone else) handle it, and only worry about following the requirements/examples for integration and providing or claiming data with the appropriate APIs. Getting this level of detail would tend to occur only if trying to write your own USB stack or if trying to de behind-the-scenes debugging of an unexpected incompatibility.
H: How to easily power multiple components with differing requirements? I'm a long-term software developer who hasn't touched a soldering iron since Uni. I've been mulling an idea for a hardware project for some time, and have cajoled a raspberry pi into managing the following devices: Touch screen e-Ink Display 2 x Stepper Motors [Very infrequent use - <5 mins/day] Thermal receipt printer [20cm print ~hourly] GPS/LTE module [On for extended periods (hours)] Arduino Zero [Not actually connected yet, but will be "always on"] I have a bare-bones implementation running, and -now I know it's possible- I'm turning my attention to packaging it all up. At present, I've got half a dozen DC power supplies connected to the various components. I've started to put together a rough layout (for scale, the box is 28x18x13cm internally) Some of the devices offer power saving modes which I intend to use when possible, but it'd be nice to be able to use it all simultaneously if required. The pi 3 B+ itself requires 5V and up to ~2.5A. That's powering the touch screen, e-ink display and stepper motor driver board. The motors themselves require a 12V supply (350mA/ea) The thermal receipt printer requires 5-9V at 1.5A. The GPS/4G module requires 3.3V/1A. So that's.... 12v/700mA [Motors] 5V/2.5A [Pi/Screens/Motor Driver/a few sensors] 5V/1.5A [Printer] 3.3V/1A [Comms] 3.3V/1A [Arduino] I know some of those are max draw (eg the Pi) but I'm actually quite close in that case (largely thanks to the touch screen). Eg if try to run the comms board from the Pi's 3.3v rail, it's enough to trip the pi's power. So, my primary question is... How can I (cleanly) run all of this from a single wall socket? Due to my lack of experience, I've got a preference for keeping everything in the case low voltage (or at least keeping mains voltage fully enclosed/isolated). Ease of integration is a consideration considering my soldering "skills" and scarcity of equipment. I'm hoping that the subsequent step will be to use a large power pack, and have found this https://www.amazon.com/NOVOO-22500mAh-Universal-Compatible-Smartphones/dp/B07JKP3PWY but haven't really had time to look into it yet (presumably converting up to 240v and back is wasteful). I mention it in case the idea of a power pack changes the answer significantly. AI: Well the cleanest option is to have it use a single 12VDC coming in from a wall AC/DC converter. Then you would have voltage regulators to get the specific voltages you need within the unit. Easiest way to do that is to have a custom PCB made, enabling the regulators to be done on board. If that isn't an option, you should be able to get pre made voltage regulator modules from amazon/adafruit/sparkfun. I agree with @ChrisStratton that for battery usage, a PI isn't really usable.
H: Battery configuration for inverter? I have a PC with a 280 W PSU. I am thinking about buying an inverter but I am confused. I have an inverter which requires 36 VDC. Will it work if I add 3 12 V, 50 Ah batteries in series? Or shall I buy a new 12 V unit, with a 12 V, 100 Ah battery? Also if I use 3 car batteries instead, will it make any difference? AI: Three car batteries (or other 12v 50Ah batteries) in series would make an ideal battery to supply a 36v input inverter. Three 12v batteries of 50Ah store 50% more energy (run time into the same end load) than a single 12v battery of 100Ah. An inverter you have will cost you rather less than one you have to buy. A 12v input inverter will not be more efficient than a 36v input inverter, and will need thicker wires to supply it.
H: Is it possible to charge Li-Ion Cells in series without a Balance Charger, by using slightly lower 4.1 V per cell charging rate I have read that it is strictly not recommended to charge Li-ion cell packs in series without using a balance charger. My question is, can a balance charger be avoided by keeping the total charging voltage slightly lower than the actual full charge level? For example, if for a 12.6 v Li-Ion Battery pack if we use a supply level of 12.5 V, can we hope nothing untoward may happen? AI: Balancing can be avoided if you can meet certain conditions:- the cells must be well matched for capacity and internal resistance, so that their voltages track as the battery is charged and discharged. On the the first charge you must monitor the cell voltages, and balance the battery if they are not all equal (within 0.01V) when fully charged. The battery must be properly cared for so that no cell becomes damaged by over-discharge, over-current, high operating temperature etc. If the cells are well balanced and have equal capacity then they should stay that way for a long time. However they may age at slightly different rates, or a cell might go leaky and lose charge. Therefore you should regularly measure the cell voltages to check the balance, preferably on every charge. Using a battery protection circuit module (PCM) is recommended. This monitors cell voltages and disconnects the charger if any cell goes above (typically) 4.28V, and also protects the battery against over-current and over-discharge (though they usually allow the voltage to go lower than is good for cycle life, so this feature should not be used as an end of discharge cutoff). Charging to a slightly lower voltage will allow more voltage variation between cells without risking any cell going above 4.23V. It also improves shelf life if the battery is left fully charged for long periods, especially at high temperature. The down side is reduced capacity. If a PCM is used it will allow the battery to go more out of balance than when charged to a higher voltage. Therefore you should still measure cell voltages regularly to check battery health. Without balancing you are relying on the cells continuing to stay matched. Good cells will do this for many years if treated well. In my experience a battery that needs regular balancing usually has a faulty cell, and will get worse. Once a battery gets to this condition it is best to discard it, even if using a balance charger.
H: What is the simplest instruction set that has a C++/C compiler to write an emulator for? I'm looking into writing a little software emulator that emulates/runs instructions. The easiest would be to invent my own instruction set, but I thought it would be more fun if I write an emulator for an instruction set that already has a C++/C compiler. What is the easiest instruction set/architecture that has a (hopefully stable) C++ and/or C compiler? By easiest, I mean the least number of instructions. AI: Easiest would be to invent my own instruction set uh, ok, we might come from very different experiences here… With easiest I mean the least amount of instructions. That's not necessarily the easiest to implement. Often, having more instructions is a good complexity tradeoff compared to having more complex instructions. So my question is, what is the easiest instruction set/architecture that has a (hopefully stable) C++ and/or C compiler? This sounds like no job for C++, so let's concentrate on C. (If you don't understand the difference having C++ RAII paradigm makes, you might not be in the optimum position to design your own ISA.) Puh, some microcontroller instruction set that is early, but not too early (because too early would imply "designed around the limitations of digital logic of that time, like e.g. 8051). AVR might be a good choice, though I personally don't like that too much. I hear Zilog Z80 is easy to implement (there's really several Z80 implementations out there), but it's pretty ancient, and not very comfortable (being from the mid-70s). If you really just want a small core to control what your system is doing, why not pick one of the many processor core designs that are out there? For example, RISC-V is a (fairly complex) instruction set architecture, with mature compilers, and many open source implementations. For a minimal FPGA core, picoRV32 would probably the core of choice. And on a computer, you'd just run QEMU.
H: Why is LTSpice Bode plot disagreeing with a linear plot? Here is a picture of an amplifier that I'm simulating using LTSpice. When I insert a sine wave of 0.01 volts and 314Hz as an input, I get this: The output is taken from the collector and is oscillating between about 2.65 and 2.35 volts. This would mean that the amplitude of the output is about 150mV. This divided by the input amplitude of 10mV gives a gain of 15. When I do a Bode plot of its frequency response, using 0.01V again as input, I get this: Past 100Hz, I get a gain of about -16.4 decibels! This is nothing like the gain of 15 that is claimed by the linear graph. When I convert -16.4 decibels to a gain ratio, I get something like 0.15. So what am I doing wrong? AI: LTspice always uses db(1V) for the y-axis of the ac simulation results. So, since you actually used 0.01V as the input signal amplitude the actual gain of the circuit is 100 times greater than the output dB value. If you converted -16.4dB to a gain of 0.15 and you expected a gain of 15 then your simulation is actually spot on.
H: Can I run a DDR4 module at 50 MHz? I haven't seen any restrictions about minimum clock, but I may have overlooked them. EDIT: The module is a Crucial CT4G4SFS824A, based (this is an informed guess) on 4Gb Micron 512 Meg x 8 AI: Yes, but adjust the refresh rate accordingly to make sure you hit all the rows in the time specified in the datasheet. I’ve done this for FPGA ASIC prototyping and it works fine.
H: Circuit Definition This is a circuit that I've found in my old amplifier board. Experts please help me identify this circuit and please describe how it works. I am sorry for my crude drawing, but this is what I found when drawing it from the circuit board. It was built using smd components so it was a bit difficult for me to find the exact match of the transistors. There might be some mistake in the circuit and it will be helpful if any of you take your time to rectify it for me. The output node was connected to the non-inverting input of the power amplifier along with the pre-amplifier output. My question is: what good does it bring to the power amp input? And how? original image AI: My guess would be that it's supposed to be a power-on mute circuit — i.e., it keeps the preamp output grounded via TR2 for some time after power-on, in order to keep transients from passing through to the power amplifier. However, the circuitry around TR1 doesn't look right at all. Try tracing it out again. Provide photographs (both sides of the PCB) if possible. It's possible that the transistors are MOSFETs. Also, here are some tips about drawing schematics that make them easier for others to understand.
H: Safe to turn variable speed AC motor on/off via wall switched outlet I have a (high velocity air) dual AC brush motor pet hair dryer (details). (There is no heating element.) It's rated at 120 Volts 18.5 Amps. It has a rotary knob (listed on the parts page as a "Variable Speed Switch and Circuit Board") that clicks on & off and then rotates to set the motors' speed. It's a bit of a pain to click it on and then find the desired speed setting each time. Plus it's wall mounted and a bit hard to reach. I'd like to plug it into a switched wall outlet and use that to turn it on and off, and leave the speed setting at the typical use level (about 90%). It that safe to do? Or can doing that cause damage to the motors or electronics? [edit/update] It's currently on a 20 amp circuit and I would have an electrician install a properly rated wall switch for this. AI: Universal motors are often started and stopped with a switch and not speed controlled at all. It seems unlikely that the speed controller or motor would be damaged by switching it on and off. However the linked web page contains the statement "If you need knowledgeable advice about your product we urge you to call." Starting is stressful for any motor and starting many times every day may shorten the life of the product. There is no way to tell by looking at the sales information is the speed control does anything to reduce starting stress. My guess would be that is doesn't.
H: Reverse polarity protection for battery powered application Im designing battery powered application and need reverse polarity protection. My system specs: 4.5v(3x AA batteries) in and system running on 3.3v. Im using MCP1711T-33I/OT LDO to convert 4.5v to 3.3v. My system will take about 50 milliamps maximum. Therefore i can't obviously use any diodes since voltage drop and power waste will be too big. I read some threads and people tend to suggest P-channel MOSFET. I was looking for low rds(on) MOSFETS and all their packages seem so huge. Like this one: http://www.farnell.com/datasheets/2049687.pdf Size isn't too big problem though(sot23 package would be perfect though). Can you suggest me anything else than P-channel MOSFET? If not, can you suggest me some decent P-channel MOSFET for my needs? Thanks in advance. AI: Im using MCP1711T-33I/OT LDO to convert 4.5v to 3.3v. ... Therefore i can't obviously use any diodes since voltage drop and power waste will be too big. If you are really concerned about voltage drop and power waste, I think you'd better focus on the MCP1711. It is dissipating the difference between input voltage and output voltage so, 1.2 V * 50 mA = 60 mW at most. Any RDS(ON) up to 1 Ω waists at most (50 mA)2 * 1 Ω = 2.5 mW. I'd suggest to replace the MCP1711 by a high efficient step-down converter (next to using the P-mosfets suggested by others for polarity protection).
H: Heatsink on underside of PCB I have prototyped some DC-DC converter modules, and they work well. However due to size, I don't have a huge amount of copper pour for them to dissipate their heat. I have used 2oz copper but the bottom layer copper pours get really hot at higher current. Even through the solder mask! I experimented with adding a heatsink to this bottom side of the PCB with some thermal grease and the results were surprisingly good. The heatsinks get hot under heavy load. The buck-boost-inverter went from maxing out at about 1.5A to being stable at 2.5A! This is my current setup: However I can't help but think that I can improve this. I am thinking of removing the bottom solder mask around the heatsink area for better heat transfer. Also I want to use a Sil-pad instead of thermal grease for easier assembly, and because I don't want to risk shorting different copper pours when the solder mask is gone. Like this: So my questions are: Is this a good way to do this? (given my limitations) is there anything that could affect the long term life of my PCBs with this setup? Are there any other suggestions people have? Thanks! AI: This link contains useful information, also this video. Typical solder mask has 20-25µm thickness and 0.2 W/m.K thermal conductivity. This means a 1cm2 area of solder mask will have a thermal resistance of 1°C/W. This can be a problem... or not, that depends on your application and how much power is dissipated. For a few watts, an extra 1°C/W doesn't matter, just do the calculation. For a larger contact area, thermal resistance drops accordingly. However, soldermask has another very important role. If you use immersion gold, large copper areas without soldermask may result in a thick gold layer, and your PCB fab will be asking who's gonna pay for the extra gold. If you use HASL, solder thickness may not be even, which will require a thicker interface material to even out the bumps, and increase thermal resistance too. There could even be a little drop of solder left over on the edge of a via, and then your heat sink won't be flush, and if you try to remove the bump by hand, it'll make a mess. And of course, wave soldering would result in a mess too. So... soldermask is nice to have. Anodized aluminium is insulated by the oxide layer, but it can get scratched off. So, a bare heat sink on top of vias with just conductive grease between them would work... in theory... still a bad idea. It's better to tent the vias and protect them with soldermask. Thermal grease is better than silpads because it is thinner. However, silpads are insulating and thermal grease is not. Why not simply check the datasheet of your silpad and calculate the thermal resistance versus contact area, and check if it works? Another option is a SMD heat sink. Pros: thermal conduction path is 100% metal. Cons: thermal path has to go horizontally through the copper layer, which isn't that efficient. Anyway. If your IC only dissipates a few watts, keep the silkscreen or use a SMD heat sink.
H: Why does the common collector specifically have a high input impedance? When looking at a chart comparing different BJT amplifiers, the common collector/emitter/base, it is usually said that the common collector has a high input impedance, therefore it is suitable for use as a buffering circuit. The Wikipedia page on common collector lists the input impedance of the circuit as $$r_{\pi }+(\beta _{0}+1)R_{\mathrm {E} }\ $$ But according to the page on common emitter, the input impedance of that circuit is also calculated using the same expression (assuming an emitter resistor is in place). If the input impedance of both amplifiers are calculated using the same formula, why is it said the common collector configuration has an especially high input impedance? AI: Quite right, but consider how transistors must be biased... Consider comparing a common-emitter stage with a common-collector stage. Both have the same magnitude of gain (common-emitter has a gain of -1, while common-collector has a gain of +1). simulate this circuit – Schematic created using CircuitLab It is possible to use a large \$R_E\$ in the CC stage...considerably larger than the \$R_E\$ of the CE stage. You must leave lots of biasing headroom in the CE stage for the collector to swing. If the CE gain is large, the collector-swing headroom consumes almost all the DC supply voltage.... that makes RE1 much smaller than Rc.
H: LEDs flicker when I move my circuit I'm building an LED driver circuit, CD4504B and TLC5916 controlled by a Raspberry Pi: simulate this circuit – Schematic created using CircuitLab I'm finding that sometimes when I move the circuit around, the LEDs flicker. It only happens when I'm not driving the GPIOs. I've already inspected the circuit for shorts and didn't find anything. Did I miss anything in my design? Do I need pull-downs for the level shifter inputs for when the GPIOs aren't being driven? AI: Do I need pull-downs for the level shifter inputs for when the GPIOs aren't being driven? Yes, I can almost guarantee this is the root cause for your problem. When you're not driving the GPIOs the inputs to the CD4504B are left floating, and it's always trouble to leave digital inputs floating. (By the way, why would you ever not drive the GPIOs here...?) An easy way to verify this is truly the root cause: since you're on a perfboard and your voltages are nice and low, you can simply touch your fingers to the Ain/Bin/Cin/Din wires of the CD4054B. (Make sure you are following good ESD practices before you do this of course!) If your fingers have a significant influence -- if your fingers cause problems when the LEDs are otherwise quiet, or your fingers quiet the LEDs when there is otherwise a problem -- then it's these four wires that are the problem. Add some decently high (10k or even 100k) resistors to these lines. Pull-down or pull-up is fine -- favor whatever is the "idle" state for those lines. The important thing is that the inputs are not allowed to float to some invalid state or, worse yet, oscillate.
H: Corroded PCB from Rechargeable NiMH battery This NiMH battery began to leak battery acid onto the circuit board / PCB below it. Some of that acid ran down one of the wires connected to the battery and pooled up at the foot of the plug where it connects to the PCB. Here's a closeup image of the black wire with battery acid gunk running down it onto the PCB below. Here's what the PCB looked like after I sprayed some WD-40® Specialist® Electrical Contact Cleaner Spray and wiped with a Q-tip. Is this exposed copper something I should worry about? Is there some means I can use to protect the copper? For instance is it safe to dab some 100% silicone caulking on it or anything like that? AI: Is this exposed copper something I should worry about? Maybe, in the presence of humidity the residual salts/acids that are on the copper and solder junctions could further corrode. The best way to corrode metal is with salts and water. Is there some means I can use to protect the copper? Yeah, go over everything with a soldering iron and protect all that copper with a layer of solder. Thats how regular PCB's are protected in the factory if you get a HASL surface finish (63% Tin 37% Lead) which is close to most solder compositions. As an added benefit, if flux is used in the soldering operation, it will probably help clean some of the bad residues out of the corroded traces. Flux will also prevent solder bridges while soldering. Don't burn the connector while soldering, either carefully unsolder, or in some cases the shroud can be 'slid' off while soldering and the installed after (be careful with that operation also if that's the route you go)
H: How do we determine the roots from a Routh-Hurwitz array? I know that we can determine the roots on the right-half plane by counting the sign changes in the first column. However, I'm unsure how to find the roots on the left-half plane. Is it the same as the right-half plane due to symmetry or am I missing something here? AI: I think I figured it out. Total number of poles = order of characteristic equation so we can do: Total number of poles - roots on the right-half plane (# of sign changes in first column) - roots on jw-axis = roots on the left-half plane
H: Constant power load SPICE model I would like to create a SPICE model for a constant power load. I'm guessing that would involve using an equation to dynamically adjust the model's resistance based on the applied voltage. How do you do this in SPICE? (I'm currently using Eagle but any SPICE2 or SPICE3 answer will work) AI: You could use a resistor and define the resistance as a function of the voltage across it. R=V_R^2/power V_R is the voltage across the resistor (power supply) and for "power" you can use a value for the desired constant power. I found a link to an example. edit: Here is the netlist: R1 V_R 0 R=limit(0.0001,V(V_R)**2/100,10000) V1 V_R 0 SINE(11 10 1k) .tran 0 10ms 0s 100ns .backanno .end for this simulation: The limits are the min and max value of the resistor and can be changed to any number. But without the limit, the current will rise to very extreme values at nearly or exact 0V across the resistor (R=0). With V_R >> 0V you don't need the limits. In this case the load is 100W. You have to change the number "100" in the formula for R1.
H: Differential pairs or single ended signals for 1m cable I have one control board and 3 additional boards for the power electronics, that send and receive data from the control board over a distance of ~1m (3ft). All signals are single ended. I have to design the boards, but I'm not sure about the best connection method. I could use D-Sub cables, ribbon cable and so on. That's not the problem. Each of the 3 additional boards receive following signals from the control board: 10x PWM @12kHz CLK @16Mhz 4x digital signal lines @low frequency (turn on the boards etc.) +15VDC @50mA -15VDC @50mA +5VDC @200mA Ground Analog Ground And in the other direction, every power electronics board send following signals to the control board: 10x 1bit stream @16MHz 5x analog signals -10V to 10V @2mA Now I'm unsure if I send them as single ended or use differential line drivers and receivers. What would you do? That would be at least 34 lines as single ended with one ground and one analog ground connection. Where would you put the ground lines, between each signal? Then we're talking about ~70 lines per board. And could I use a differential pair cable or should it be straight ribbon cable? Or do know a better solution? 2 cables per board would be also okay, but not ideal. If I use differential drivers and receivers for the PWM, CLK, analog and 1 bit stream signals, we're talking about 52 signal lines (26*2) + 4 slow digital lines + power and ground per board. 3 68 pin D-Sub cables with twisted pairs should work in this scenario or not? In my opinion this is the best alternative. But also the most expensive one, because I need 15 differential line drivers and 15 differential line receivers. 3 drivers and 12 receivers (each 4 channel) on the control board and on every power electronics board 3 receivers and 4 drivers, if I make every signal as differential pair. So is it necessary to use differential pairs? Maybe just for particular signals to reduce the number of ICs? Thanks for every advice and your help :) AI: At 16 MHZ ordinary ribbon cable should be fine, I'd look at using PATA (hard drive) cables, because they are available off the shelf cheaply. I'd interleave the 16Mbaud data, with power and ground wires G d P d G d P d G To reduce cross-talk and also separate the clock from that by a little bit all the other signals as slow enough that they should not need any special treatment other than possibly low-pass filtering.
H: What are important uses of the "Net Tie" concept? My understanding is that the "Net Tie" is a concept introduced by Altium and useful for Kelvin connections of a sense resistor and can not be applied in any other case. Although it seems to be a useful feature at the first sight, it can't declare the exact connection point to the footprint, so it's not an exhaustive concept on its own, it still requires developer attention. Example: Given the following schematic: We can either connect actual sense nets as follows (which is correct): or as follows: (which is also correct): or as follows (which is not correct): by considering the same schematic using "Net Tie" concept. However, if we would always handle a sense resistor a 4 pad component which has "Pin.1, Pin.2, Pin.sense1, Pin.sense2" independent of real pad count and placement; we can exactly declare "how" a Kelvin connection must be made. As an example, we can define a 1206 resistor package footprint by adding SenseX pads as follows: Question Is there any use case for which "Net Tie" is a complete solution? AI: Net ties are an extremely useful concept, if used wisely. If you are part of a team where there is dedicated PCB layout resource (or you have outsourced), the use of net-ties offer additional clarity with regards to the circuit designers' intent. They are useful for kelvin connections as you have shown (be it sense resistors or 2-wire RTD converting into a 4-wire). They are useful if you want to constrain the layout with regards to where a node might be physically taken (ie. distance constraint). Likewise their use when netnames may be merged is valuable. AGND tied to DGND at a starpoint for instance. if there is a branch in a digital clock signal where the resultant lengths are different (requiring separate signal integrity considerations) It offers the layout and schematic engineer additional flexibility in defining what their physical intent is. It doesn't result in only one solution, it is one tool presented by the eCAD software (constraints being another). Your example of the sense taps is a classic example and I personally would have created a separate footprint for that part to ensure the 4-wire variant had the taps exactly where I would want them - between the pads
H: Zener diode (Power rating exceeded) The following is an exam question I encountered. In the above circuit the current across E is 180 mA. Since the current across 300 Ohm resistor is 13.33 mA, there will approximately be a current of 166 mA through the zener diode Z1. Then the resulting power dissipated would exceed the power rating of the diode Z1. My question is; what exactly happens in a situation like this? How will a circuit behave when the power rating of a diode is exceeded (both theoretically and practically) Thank You AI: Assuming that enough current flows through both diodes so they regulate, and assuming they're perfect, then the voltage across them is their Vz. Thus current in the 500R resistor is (100-10)/500 = 180mA Current in the 300R resistor is (10-6)/300 = 13.3mA Current in Z1 is (180-13.3) = 166.6mA and power is 1.66W So, your calculation is correct. Z1 dissipates more than what it is rated for. Note that as analogsystemsrf says, this does not necessarily mean it will blow. This depends how the power rating is calculated. What determines lifetime is maximum chip temperature and thermal cycling / dilatation of materials... and that depends on how the heat is removed from your part. So the same part (for example a TO220 package) can have wildly different power ratings depending how it is mounted (free air, board, heat sink...) or if a fan blows on it or not. If we assume the power rating is correct, then the diode will overheat. It can melt its solder joints and fall off the board, or simply blow. Leaded zeners mainly fail shorted, at least the modern 'nailhead' types that don't have wire bonds. A SOT-23 type zener does have bondwires, so can blow open after it shorts if enough current is available. Now, to answer the second question, even with RL=0 ohms, we have 33mA through the 300R resistor, 147mA through Z2, and it still dissipates too much. There's probably a typo in the value of the 500R resistor.... the resistor dissipates 16W which is no good. It should be 5000 ohms.
H: Charging a capacitor in Eagle SPICE I'm trying to learn the basics of Eagle SPICE simulation with a simple capacitor charging circuit. My netlist is as follows: * SpiceNetList * * Exported from untitled.sch at 21/07/2019 1:17 PM * * EAGLE Version 9.4.0 Copyright (c) 1988-2019 Autodesk, Inc. * .TEMP=25.0 * --------- .OPTIONS --------- .OPTIONS ABSTOL=1e-12 GMIN=1e-12 PIVREL=1e-3 ITL1=100 ITL2=50 PIVTOL=1e-13 RELTOL=1e-3 VNTOL=1e-6 CHGTOL=1e-15 ITL4=10 METHOD=TRAP SRCSTEPS=0 TRTOL=7 NODE * --------- .PARAMS --------- * --------- devices --------- C_C1 N_3 0 1000uF R_R1 N_2 N_1 10M V_VCUR_1 N_2 N_3 V_V1 N_1 0 DC 10 AC 0 * --------- simulation --------- .control set filetype=ascii TRAN 2e-7 0.0001 0 1e-5 write untitled.sch.sim V(N_1) V(N_2) I(V_VCUR_1) I(V_V1) .endc .END I want to run a transient analysis that shows the current through the capacitor decreasing as the voltage increases. Instead I get this: What am I doing wrong? AI: Your basic problem is that SPICE assumes that your circuit has existed forever, so any transient effects have disappeared long ago. As far as the simulation is concerned, C1 is already charged to 10V at \$t=0\$. If you want to see the transient charging of the capacitor you have a couple choices: Change V1 from a dc source to a pulse or PWL source, so that its value is 0V at \$t=0\$ and rises to 10V as quickly as the simulator will allow. You will probably need to specify the timestep for the transient simulaton to be as small or smaller than the risetime of the supply voltage. Specify an initial condition for the voltage on the capacitor. I don't know if there is a GUI method for this in Eagle SPICE, but in plain vanilla SPICE you would say something like .ic V(C1)=0. You must also modify the .tran simulation command to add the UIC (use initial conditions) option
H: why neutral does not shock. how can a neutral be neutral in ac current? When I probe my city mains with one probe in the live and one in earth (which should be 0 volt) it shows a voltage of around 250v. But when I probe the neutral and the earth it shows no voltage. I know that current runs in one direction for 50 times in a second. So the neutral should act like live for 50 times in a second. Then neutral should show some voltage with the earth, which it doesn't. If you touch the neutral wire you won't get shocked but if you touch the live the wire you get shocked why and how? AI: We force it to be that way Mains power is wired as an isolated system, with an asterisk. The asterisk came about for some very good reasons. The "safeness" of neutral is a side-effect, and an optional one. If mains power were an isolated system (And I've run it that way, and it works), and you are grounded presumably... then it wouldn't matter if you touched pole 1 or center (I won't call it "neutral"). No current would flow. The hot and center have no relationship with earth (except through you, and with only one "wire", it's an open circuit). The system "floats". An isolated system is exactly what you expect. However, we build mains power to be resilient when something goes wrong. Things can go wrong with isolated systems, and one of the scariest is a transformer leak. If transformer primary leaks (even a little) into the secondary, or if there is capacitive coupling, then it de-isolates the isolated system, and "pulls it up" to thousands of volts compared to ground. Now we have a problem. In that lathe motor, coffee maker or LED light, the insulation is not rated for thousands of volts. The equipotential bond makes the neutral To prevent the secondary ("isolated system") from floating at high voltages, we intentionally add an equipotential bond to force a relationship to earth. You might use a transformer for the equipotential bond, e.g. in 3-phase delta (non-wild-leg) to put earth in the middle. You could also use a car battery, giving the system a 12VDC bias from earth. But usually, you use the cheapest equipotential bond available: a piece of wire. You bond one of the conductors to ground, typically "center". **Because it is bonded to earth, you label it 'Neutral'. It really doesn't matter which supply wire you bond to neutral. Ideally you want to minimize the voltage (to earth) of the hottest hot, so the best choice is in the electrical "center" ... however, 240V wild-leg delta is an example of not doing that. So to answer your question, neutral is cold because we made it cold. Neutral is not quiescent; it pulses at line frequency just like the hot. The effect of the equipotential bond is to dynamically change the bias of the whole transformer secondary, to keep neutral at earth potential and make hot move away from it. Other useful reasons A desired side-effect of the equipotential bond is that if there is a hot-earth fault, there is a high-current path via ground wire, conduit etc. back to the neutral-earth equipotential bond, and ultimately back to neutral. This completes the circuit, allows high current to flow, and causes a circuit breaker trip, which arrests the ground fault. Remember, current wants to return to source, not to ground. It doesn't care about ground, except that the equipotential bond makes it care. For a variety of reasons, there needs to be exactly one equipotential bond. Another one would create redundant (paralleled) paths for normal neutral (return) current, and that causes all sorts of mischief.
H: What's the difference between 1kb(64x16) and 1kb(128x8) for EEPROM memory size? In addition to the question in the title, I have the following subquestions: I'm guessing 64x16 means something like 64 cells of 16 bytes each. Is this accurate? What is the significance (if any) of the memory being 64x16 vs 128x8? What is the specific term (if any) for this (i.e. 1kb being composed of 64x16)? The questions are made with reference to this: EEPROM IC memory size comparison From https://www.digikey.sg/short/pb7488 AI: 64x16 means that the memory is arranged as 64 words of 16 bits each. 128x8 means that the memory is arranged as 128 words of 8 bits each (i.e., 128 bytes). You read, erase, and write on a word-by-word basis. In general, wider words are faster, but because you must erase an entire word at a time, they're less convenient. Those are some pretty old memory chips you're looking at!
H: Why the current on this vector diagram have coordinates like this? It is an example from a textbook. It is a really basic example and the purpose of the example is to show how vector diagram works. Here is the example: and this is the vector diagram: What I don't understand here is why \$I\$ has these coordinates. Shouldn't \$I\$ have coordinates \$ 1.5 + 1.5j \$ because \$ 1.5 \sqrt{2} \angle 45 = 1.5 + 1.5j\$ ? On this picture it looks like I have coordinates \$ 5 + 5j \$ . Can someone please help? Source of pictures: faculty of electrical engineering and computing Zagreb AI: I think your understanding is correct. The only thing I can think of is that the coordinates are for voltage and the current is superimposed on the Re (real) and Im (imaginary) voltage axes but is using a different (red) scale which is not shown.
H: Using USB-6210, relay, to control a 12V double solenoid valve I am kinda new for the wiring of the relay. I have read some posts in forum regarding connecting the solenoid valve to the DAQ. But I am still not too sure how it all should be done. My objective is to use USB-6210, a crydom SSR (DC60 Series), to control a 12 V 5/2 way double solenoid valve for the extension and retraction of an actuator. I am just wondering how the schematic should be. Based on some googling, I come up with similar idea. Can someone give me some advice? Since I have a double solenoid valve, I am wondering can I just wire one of the valve ( treating it as just a single valve?) or do I need to wire both valves (which I am not too sure how) to achieve my goal? Thank you so much in advance!!!! The valve I have: https://trimantec.com/products/airtac-4v200-solenoid-valve-4v22008ft The SSR I have: http://www.crydom.com/en/products/catalog/dc60-series-dc-panel-mount.pdf AI: We really need a link to a datasheet to be sure but with the low-resolution image on the linked page it appears that you have the wrong valve type. Figure 1. Upper is what you've got. Lower is what you'd like. Your SSR looks fine for controlling one coil but given that you've only got one output from your DAC you could consider changing to a relay. simulate this circuit – Schematic created using CircuitLab Figure 2. Relay switching arrangement. There are many relay modules available which will accept a logic-level input (5 V, a few mA) to switch a 5 V or 12 V relay coil. One of these would be quite adequate.
H: Does resistance decrease over a resistor? If ohms law pertains to voltage, current, resistance across a resistor, in order for voltage to drop, and current to remain the same, does resistance drop as well across the resistor? To explain what I mean, if we have the circuit: The voltage across the first resistor drops linearly from 5v to 1.667v. Let’s say we picked a point around the middle of the resistor and read that the voltage at that point was about half of the difference across the resistor, so 5v - [(5v - 1.667v) / 2] = 3.3335v. From what I as told, current across resistors in series is constant/equal. So if the voltage at that point is 3.3335v, the current is fixed at 1.667A at that point and every other point across the resistor, does this mean that resistance is dropping throughout the resistor as well to compensate for the voltage drop and so ohms law remains valid? Because at that point if voltage = 3.3335v and current is 1.667A, resistance at that point would have to be 1.999700059988002 ohms, given by V=IR. At a point somewhere between the middle and end if we measured the voltage and got 2v for example, R = 1.199760047990402 ohms. Overall, this would show a downward trend in voltage, a constant current, but also a downward trend in resistance. But is this correct? And if resistance is also fixed, how is it possible current can remain constant when resistance is also fixed and voltage is dropping while obeying ohms law? AI: So if the pressure at that point is 3.3335 V, the current is fixed at 1.667 A at that point and every other point across the resistor, does this mean that resistance is dropping throughout the resistor as well to compensate for the voltage drop and so ohms law remains valid? The resistance will be proportional to the length. The resistance will be the same even if no current is flowing through it. Because at that point if voltage = 3.3335 V and current is 1.667 A, resistance at that point would have to be 1.999700059988002 ohms, given by V=IR. Let's call that 2 Ω. (15 decimal places is just silly.) You are measuring the voltage across the right half of the 2 Ω resistor and the 1 Ω resistor so you get \$ \frac {2}{1} + 1 = 2 \ \Omega \$. Overall, this would show a downward trend in voltage, a constant current, but also a downward trend in resistance. Yes. As you slide your measurement point across the resistors the voltage will reduce in proportion to the resistance. simulate this circuit – Schematic created using CircuitLab Figure 1. A potentiometer as an adjustable voltage divider. This is the principle of operation of a potentiometer. By sliding the wiper up from the bottom to the top the voltage out will vary from 0 V to V+. Note, we say current through a resistor and voltage across a resistor. From the comments: Also to confirm, so across a resistor and nothing but a resistor (taking the first resistor in the attached circuit as an example), voltage would drop from 5v at the entrance of the resistor -> 1.667v at the exit of the resistor ... Yes 5 V at the left side and 1.667 V at the right. (SI units named after a person have their symbols capitalised but are lowercase when spelled out. 'V' for volt, 'A' for ampere, 'K' for kelvin, 'Ω' (capital omega) for ohm, etc. Meanwhile 'k' is for kilo. There's also a space between the number and the unit.) ... and resistance would drop from 2 ohms at the entrance of the resistor down -> 1 ohm at the exit of the resistor ... No, resistance of the left resistor would decrease from 2 Ω to 0 Ω relative to the 1.667 V point. Resistance relative to the 0 V point would decrease from 3 Ω to 1 Ω. ... given by (V = IR, 1.667v/1.667A), therefore keeping current at a constant 1.667A from the entrance to exit of the resistor. What goes in must come out. Provided your voltage measurement device has a very high impedance (typically 10 MΩ for a digital multimeter) it won't divert a significant current so if you have 1.667 A in then you get 1.667 A out. Update 2: But if resistance decreases from left to right of the first resistor, from 2 ohms -> 0 ohms, how could current exit the first resistor at 1.667A? If at that exit of that first resistor, like you said, resistance dropped to 0 or for arguments sake 0.01, by ohms law, the exiting voltage at that point = (1.667V/0 ohms) (1.667V/0.01 ohms) is not equal or close to 1.667A? simulate this circuit Figure 2. Measuring the voltage between the tap-off point and the right end of R1. You have forgotten that the voltage will decrease between your measurement point and the right end of R1. (Re-read the explanation of Figure 1.) If you move the measurement point 3/4 way across R1 you will measure 3.33 / 4 = 0.84 V as shown on the voltmeter of Figure 2. If you move it all the way to the right of R1 you have \$ V = IR = 1.667 \times 0 = 0 \$. Everything works.
H: Inversely proportional current controlled voltage source I need a circuit that senses a current and outputs a voltage, but in inverse proportion. In my case: When the current is around 0A, the voltage source should be around 18V (my Vcc). And when the current is around 8mA, the voltage source should be 5V. Can this be done ? Opamps ? Transistors ? It's just for a simulation. No worry about part count. But generic parts are preferred. Is it even possible ? All I can do is thanks. No reputation to upvote. The following is a directly proportional current controlled voltage source. A small illustration of the idea. All I need is to reverse the proportion. Edit 1: To make this thread short, I removed the part where I explain the impedance requirements. This can still be seen in the edit history. The user Transistor understood correctly my necessities. Edit 2: I "ommitted" the following information to make the opening thread short, but that choice is creating gaps: This whole circuit is a brief and partial model of the LM7805. This IC has a quiescent current (as the datasheet calls) of 8mA leaving the control pin towards the GND. In this scenario, the regulator does its job and outputs clean 5V. Now, if I interrupt this control current, the output approaches the Vcc of the supply. I intend to control this current with a transistor, and this control should take into account the output voltage (so not to break the closed loop). A voltage divider quite does the job, but the output voltage is much below the input Vcc. I know that a transistor will increase the minimum voltage much above 5V, but that's not a problem. I don't have available LM317, by the way. To "generate" this 8mA in the simulator I'll not use a current source, but a Vcc and a resistor. AI: simulate this circuit – Schematic created using CircuitLab Instrumentation amplifier has very big input impedance. It measures the voltage on current sensing resitor (low impedance), then it is amplified G=1+2*Rf/Rg. Bias of 18V is applied, then you have to calculate Rf, RG so that amplified voltage is subrtracted from 18V to get 5V at xyz current. The output impedance is low, but you can add a series resitor of your choice to match hi-impedance output. \$V_{out}=18V-R_{sh}\cdot I\cdot (1+\dfrac{2\cdot R_f}{Rg})\$ \$R_{sh}=10; V_{sh}=10\cdot 8mA=80mV\$ \$\dfrac{dV_{out}}{dV_{in}}=\dfrac{18V-5V}{80mV}=162.5\$ \$(1+\dfrac{2\cdot R_f}{Rg})=162.5\$ \$R_f=2.2k\$ \$R_g=\dfrac{2\cdot R_f}{161.5} = 27.2\$ \$R=500\$
H: Super Regeneration Detector This is a circuit for a remote control toy receiver. Can someone help me understand this. Connecting the antennae to the collector makes no sense to me. RF is my weakness. Datasheet where this came from is here, page 617. http://www.bitsavers.org/components/samsung/1990_Samsung_Linear_IC_Vol_1_Audio_CDP.pdf simulate this circuit – Schematic created using CircuitLab AI: A super-regenerative receiver is actually an oscillator that is arranged to be periodically stopped (or Quenched as it is called) then allowed to build up oscillations again. The time taken for the oscillations to build up depends upon the signal (or noise) level in the circuit. When there is a signal present at the oscillation frequency the oscillations will start more quickly. The time taken to start oscillation will affect the average current so by filtering this the modulation can be recovered. They have extremely high gain and be sensitive to microvolts of signal but have rather broad bandwidth as well as radiating at the operating frequency. Because they can get such high gains from a single active device they were popular when devices were expensive or for very low-cost applications where the limitations were acceptable. The main application until recently was for remote control of garage doors and toys. Garage door openers now use more sophisticated receivers. More stringent FCC requirements also restrict their use. They were invented in the 1920's by Edwin Armstrong who also invented the Superhet receiver technique (super-sonic-heterodyne). In the circuit shown Q1 is configured as an oscillator with the frequency set by L1 and C2 with feedback from c3 from collector to emitter. Since there is a positive feedback loop the antenna can be connected either at the collector or emitter - most circuits I have seen connect it to the tuned circuit (L1/C2). Oscillations build up from noise or the signal and cause a rectified version to appear at the base and emitter of the transistor charging up C4 modifying the bias of the transistor. At some point, the bias will be such that the oscillations will stop and C4 will discharge through resistors R2 and R3. Eventually, the oscillations will start again and the cycle will repeat typically at a few 10's or 100's of kilohertz (the quench frequency). The average collector current is sensed with R4 causing a voltage that varies with the signal level although it also has a high level of the quench frequency. This is filtered by the resistors R5 and R6 and C7 and C8 leaving the modulation as an output.
H: Using pointer of a function's returned value I would like to know if there are possibilities to change the following code: static void ser_tx_ready_ISR(void) { /* put data in tx buffer */ if ((Rb_state(&serial_tx_buff) != RB_E_ERR_EMPTY) && (Rb_used_size(&serial_tx_buff)>=1)) { Uart_put_char(Rb_retrieve_byte(&serial_tx_buff)); } } where the important part is the Rb_retrieve_byte(struct ring_buff *_this) which returns a uint8_t. Now, I would like to change that line by using a (rb_type)Rb_retrieve_byte(struct ring_buff *_this, uint8_t* char_ptr), but still doing it inline combined with (void)Uart_put_char(uint8_t c). So I can read back more optimally the status of the last RB access returned from the function, without using another rb API for that. The only way seems passing through reference. Is it possible to pass the Uart_put_char(uint8_t c) as a parameter, with some reference wizard, to provide the pointer of char_ptr? I think I need to provide the reference pointer of the argument of c to the ring buffer retrieve, but I don't know how to do it without using a supporting variable, which may slow down the ISR. I just try to understand if it is really just not possible. Or assembler with inline pointers is the only way? It is for an ATmega328p, but the code here is the application, not the HAL, so I was liking the idea of keeping it generic. AI: There is not much to improve on the following line. Uart_put_char(Rb_retrieve_byte(&serial_tx_buff)); Since the return of a function is on stack or optimized into the registers. This is not an object you can take a pointer of. Obviously you can remove the function calls, but that would be micro-optimization. It counteracts the split into separate C modules. If you change the producer to work with a returning pointer, then you must also change the consumer to work with pointers. Or have an intermediate. But in the end, nothing changes. Since Rb_retrieve_byte reads char to stack, which the compiler can optimize to return via a register. And Uart_put_char reads an argument from stack, which the compiler can optimize to pass via a register. So, enable the register passing calling convention optimization, and quit micro-optimizing. Or if you are in need of super fast UART, make a custom driver without function calls.
H: Can heavy processes running in background cause lag in arduino's serial port communication with a computer? I have a Ubuntu 16.04 machine talking to a Uno board. This arduino board is sending 100 chars of line at baud rate of 115200 as fast as possible. Usually I get a line every 7ms to 10 ms (I am going to call this value DT). Let's say, on a good day, when I start my trial at time 0. I receive lines at 0, 0+DT, 0+2DT etc. But on not so rate bad days, I receive lines at 0+DT+t, 0+2DT+t, ... where t is the lag. This lag can be quite large sometime (upto 200 ms). This lag remains consistent (not surprising). I am suspecting that running firefox/imagej during the trial on the same system might have caused this lag. But I am not sure. Any pointer on specification/documentation on how kernel handle serial communication would be appreciated. Essentially the question I am looking for: Can other heavy processes cause lag in serial port communication? AI: Even though things seems to look like they run in parallel. They do not. Each CPU can do only one thread at once, and your thread is one of those. If more threads require CPU, then other threads have to wait. How long this wait takes depends on the quantum time of the kernel, and how nice your thread is. So, it depends on your scheduler configuration. To keep it simple: The kernel handles serial communication via the driver. The driver has access to interrupts. This is to read data from the hardware immediately before the buffers overflow. The driver then moves the data to a stream, this signals any threads waiting for this stream. And the kernel acts on these signals to give the threads some CPU to handle this data. If you require low latency serial access you could make your thread less nice, giving it a higher priority over other threads. Biasing the scheduler to preempt other thread to run your thread when data is available. Or write your own driver. In any case, a desktop operating system is not intended to be immediate. That's a real-time kernel task. Which is what you will need when you are interfacing hardware that requires low latency software control on a higher end platform.
H: How do pixels in a LCD display are individually controlled by a electrode? How do tiny subpixels in the Led displays are controlled by those indium tin oxide electrode.How do they provide different voltage for each pixel AI: You will have Row Drivers (the high voltage drivers that clock the gate of the FET switches) and the Column Drivers that provide the precision voltages (including transfer curve gamma shaping for good whites and good blacks) to control the amount of polarization. Together, each pixel's R/G/B has private switching.
H: Single phase appliance on 3-phase circuit Is it possible to have a single phase socket on a 3-phase circuit? It is a 3-phase radial circuit on a 16 A breaker. The last 3-phase socket on the circuit basically wants converting into a single phase socket to be able to plug the fridge in, it is a 2 kW fridge. AI: You have not shared the voltage levels, so it makes it hard to answer perfectly, thing is you have two options to single phase... if you somehow got access to neutral, you can take a phase and neutral and connect to that. Neutral and ground are different. The other option you have is the voltage of your fridge allows it is to take the voltage between two of the phases of your three phase system and use that as a single phase, this is higher than the phase to neutral voltage by about 1.7 times (square root of 3). Once you know which option you can do — phase to neutral or between phases — the next thing you gotta do is calculate the current for the power rating of the fridge and see if your cables can handle that, on top of the current of whatever else is connected to it. If you can please post more info of the fridge (what voltage is written on it) and what voltage your 3-phase system is, better advice can be given.
H: How do you structure large embedded projects? Background: Junior R&D electronics engineer (the only EE in the company) - the hardware and the coding is not the problem. My biggest issue is getting a proper overview of the project, and where to start. So far I've only made minor software projects (sub 500 lines of code), but I can't envision myself doing larger projects without losing overview of the functionality or lack of functionality. How do you best structure / what tools do you use to structure large embedded software systems? What I'm currently doing: I usually start out, by sketching the functionality of the project. It could be one to many layered flow charts or related diagrams (block diagrams, etc.) and doing some research of the components/chips. Then I jump straight into coding (fail fast I guess) while referencing the datasheets / Internet, Coding one functionality at a time and testing it with dummy data, or similar test. It could be writing data to a MEM chip, and then if that works then it could be an SPI driver between the main chip and the MEM chip. What answer I'm looking for: Anything really. I will sort out what I find sensible. It could be a book, an article, personal experience, recommendations, etc. I'm very interested in knowing how seniors tackle this. Edit First off, thank you for sharing your years of experience! All the answers are much appreciated. My take from this is; Create a clear and precise specification document. Create a software design document. (Something I will now add) Design doc templates Think in modules how ever redundant it may seem. (Something I need to focus more on) Follow a coding standard for structuring header/source files. (Never did this) Barr Group C standard Focus on creating the low level implementations first. (Communication etc.) Implement design patterns where ever possible/sensible. Design patterns Set up something for revision control (Github etc. - never used this much) Research continuous integration / continuous deployment (Something new I stumbled upon) CI & CD basics AI: There are several aspects influencing the grade of detail the structuring of a project needs. For me one of the main factors is whether I'm the only one coding (what seems to be the case for you as you write you're the only EE) or if there are others involved. Then there's the question of what "large" actually means. Usually I divide the design process into the following steps: Requirement definition If you get proper software specification to work with a lot of planning is already done. If you just get vague requirements, the first thing you have to do is to sort out what the customer actually wants (sometimes they don't really know in the first place). I know it's tempting to just jump right into coding, but that brings the risk of missing an important feature that might was not obvious in the first place and can't just be easily squeezed into your code just somewhere in the middle of development. System boundaries and maintainability In embedded systems you often have some system interfaces, some to the outside (operator) but also on the inside. Define these well and try to keep dependencies as low as possible, this will simplify continuous engineering and maintainability. Also comment/document code where needed, you never know who else will have to work with it, (s)he will be happy to not have to dig though a dozen layers of code before actually knowing what a function does. Define verifiable tasks Especially if other developers are working on the same code base it's inevitable to define clear tasks (features) and the required interfaces between them. Whenever possible the individual features should be tested/verified independent from others, that's where you need the interfaces well defined so you can define your test cases. One feature after the other People like progress, so if you have a variety of tasks they usually work on whatever promises the most progress. I usually try to finish a task and bring it to a verified and tested state before I start with the next one. This allows your code to be tested by others and you not ending up forgetting something. Revision Control During the life of a project you sometimes need older versions, maybe to identify a bug introduced with some new release or just to build a device that behaves exactly the same way as one you shipped 3 years ago. Make sure you have clear build revisions and tags in your code. Git is definitely your friend here.