text
stringlengths
83
79.5k
H: RL Transient Analysis confusion simulate this circuit – Schematic created using CircuitLab When I am using Thevenin's circuit and deriving inductor currents equations i am getting different Time constant \$ \tau\$ from what I am getting when I use Node Current analysis. Here is my work for Thevenin's Circuit:- \$from\ KVL :\$ \$V_{th} = i*R_{th} + L*\frac{di(t)}{dt}\$ \$\frac{V_{th}}{L}\ = i*\frac{R_{th}}{L}\ + \frac{di(t)}{dt}\$ Now after solving the homogeneous equation I get \$i(t)= A*e^{-\frac{t}{\tau}\ \hspace{35pt} Where\: A\: is\: Constant}\$ \$ \tau = \frac{L}{R_{Th}}\ = \frac{0.8}{8}\ = 0.1s \$ This is what I am getting from Thevenin's equivalent circuit now Look at Original Circuit Equation \$from\ KCL\: at\ node\: A :\$ \$ \frac{V_s-v}{R1}\ + \frac{0-v}{R2}\ - i = 0 \$ \$ \frac{V_s}{10}\ - v*(\ \frac{1}{10}\ +\frac{1}{40}\ ) - i =0 \$ \$ 8*v+i = \frac{V_s}{10}\ \$ \$ now\qquad v = L*\frac{di(t)}{dt}\ \$ \$ \frac{di(t)}{dt}\ + \frac{i}{8L}\ = \frac{V_s}{80L}\ \$ Now solving homogeneous equation \$ \frac{di(t)}{dt}\ = - \frac{i}{8L}\ \$ \$i(t)= A*e^{-\frac{t}{\tau}\ \hspace{35pt} Where\: A\: is\: Constant}\$ \$ \tau = L*8 = 0.8*8 = 6.4s \$ Now here i am getting different \$ \tau \$ from what i get in Thevenin's circuit...also source is just constant. Please tell me where I'm making mistake. AI: Your first approach is correct. Second one, you took the KCL at node A (correct) but then two lines from there its V/8 but you wrote it V*8 PS: \$-V(\frac{1}{10} + \frac{1}{40}) = -\frac{V}{8} \$ ; not -V8!!!
H: How to read 5byte data from a sensor with I2C using the Wire Library? This is my first time having to write my own I2C code. I recently designed a board for usage with KELLER OEM Pressure Transmitter Sensor. They describe how to do that as below in the datasheet. https://download.keller-druck.com/api/download/VeMYAQBxgoSNjUSHbdnBTU/en/2017-10.pdf So I am trying to simulate that as below: uint64_t OEMPT::read_64bit() { uint64_t data = 0; int i = 4; Wire.beginTransmission(ADDR<<1); Wire.write(0xAC); Wire.endTransmission(); Wire.requestFrom((ADDR<<1)+1, 5); while(Wire.available()) { data = (data | (Wire.read())<<(i*8)); i--; } return data; } What I am trying to is this : In the beggining the variable "data" is basically blank. I shift the incoming data each time Wire.read() is called, and deacrease the amount it is shifted each time. So at first it is shifted 4bytes at the end it isnt shifted at all. I took this Adafruit code as reference. /**************************************************************************/ /*! @brief Reads two bytes from the specified register @param reg The address of the register to read from @return The two bytes read from the sensor starting at the given address */ /**************************************************************************/ int16_t Adafruit_ADXL345_Unified::read16(uint8_t reg) { if (_i2c) { Wire.beginTransmission((uint8_t)_i2caddr); i2cwrite(reg); Wire.endTransmission(); Wire.requestFrom((uint8_t)_i2caddr, 2); return (uint16_t)(i2cread() | (i2cread() << 8)); } I dont really know wether my code will work or not and I cant test it right away in the moment as I am working from home. Is there a common method to do what I am trying to do? I would appriciate any thoughts or input. AI: Wire takes care of the read/write bit internally. Just pass a 7-bit ADDR without shifting. And yes, the common usage pattern is to read one byte at a time and shift the accumulator. Although in your case you would normally not pack the five bytes into one uint64, but have three separate variables (uint8_t status, uint16_t P, uint16_t T). I recommend writing helper functions: read_uint8(), read_uint16(), etc.
H: Using 220-240V 50/60HZ appliance in US - transformer or wiring/combining of two separate phases? I have an appliance rated to be working in 220V-240V, 50/60HZ. The typical power draw is 1000W, max - 1500W. For the 240V environment where it is now, the typical/max current draw is less than 5/7A. If I would want to connect it to the US 110V 60Hz socket I would need a step-up voltage transformer with the 10/15A draw. So the question is - can I have a 'silent' transformer for such a setup? The transformer humming noises would be a major problem if I resort to using it. On other hand, if I have 3 phases coming into the house from the utility, would it be better to construct 220V socket using two separate 110V phases? I understand that I would need a licensed electrician to do such work. P.S. Selling the existing appliance and buying one would incur about $500 losses. So if I can get wiring/socket installed for 1/3 of that price, I'd be happy. AI: This is trivially (relatively speaking) easy. Do not use a transformer - there are a bunch of reasons why. Most residential service in the US has two hots + neutral going into a breaker panel with 120V (1 hot + neutral) for most "ordinary" receptacles, 240V (2 hots, no neutral) for some large loads (e.g., hot water heater) and combination 120V/240V (2 hots + neutral) for certain (historical reasons, but at this point "inertia") appliances - typically range/cooktop/oven, HVAC, clothes dryer. There are occasional exceptions where a small home will have only 120V. If that's the case, then "transformer" is the answer. But most of the time: Identify an extra space in your panel. That is the hard part. Actually, you will normally need two spaces because 240V requires a double breaker. In most panels, the poles zig-zag through the panel so that consecutive spaces are on opposite hot wires - i.e., any proper 2-space pair will be 240V between the 2 hots. If your panel is full, there are some possible solutions - ask on DIY. Install a proper (must be the right brand/type for your particular panel) double breaker. For this type of appliance, it would likely be a 15A breaker. But you must use a double breaker and not "two 15A 120V breakers side-by-side". That's because you need to make sure that if one hot gets over-current it will cut power to both hots for safety ("common trip"). Run appropriate wire to the appliance location. For a 15A circuit (the usual minimum), that is any size 14 AWG or larger. For a 20A circuit, 12 AWG or larger. In most places in the US, this will be NM cable (a.k.a. Romex). Two wire Romex has black and white wires (plus a ground wire). Normally white is for neutral. But a simple 240V circuit like this one is an exception where you can use that white wire (in a cable) as a hot, but it should be marked with black or red tape on each end to make it clear that it is a hot wire. If you use conduit (required in some large cities and other special situations) then you can't use white - both wires must be black, red or some other color besides white, gray or green. Install an appropriate receptacle. Such as this one from Leviton: This is a NEMA 6-15 receptacle. The key difference from the usual 5-15 receptacle is that the hot & neutral slots are horizontal instead of vertical. Nothing magical about that, but it makes it impossible to accidentally plug a 240V appliance into a 120V receptacle or a 120V appliance into a 240V receptacle. There is a similar 6-20 receptacle for 20A circuits. Install a 6-15 plug on the appliance. There are a bunch of other general "how to wire things up safely" rules along the way. But the basic point is "installing a 240V receptacle for a 240V appliance" is the best way to solve the problem.
H: Card edge connector "read out" meaning I'm looking for a card edge connector to short the pads on one side of a PCB card to the pads immediately opposite them on the other side of the card. Digikey specifies an attribute called "read out" to indicate whether there are one or two contacts on the other side of the connector (opposite the female mating portion where the card slides in). Here's an image with a single read out, to further clarify. It is single read out because there is only one eyelet for each two adjacent positions, instead of two eyelets (one connected to each pad). My question is: does single read out mean that the connectors on each side are shorted together and the eyelet connects to each? Or, is the eyelet only shorted to one connector and it's assumed that the pads are shorted on the PCB? I was looking at this EDAC connector. I could, of course, get a dual read out and solder them together myself. But, it's a bit easier if I don't have to. If this isn't standard practice/terminology and I should contact digikey or the manufacturer, that would also be useful to know. AI: The datasheet for the EDAC 306/316/356 connectors you linked shows that those connectors do contact both sides of the inserted PC board.
H: What does a 50 ohm coax "look like" when neither the source nor the load are matched to it, and the center conductor and shield are used for signals? Say I have a π-network filter for which the inductor is on a separate board. For convenience, I use a 50 ohm coax (4" long, frequency is 13.56 MHz) to connect to the inductor, using the center conductor and the shield to connect to the leads on the inductor. What does this 50 ohm cable look like in this circuit? How will it impact the tuning of the filter? Since the signals through the cable are neither differential, nor referenced to ground, I don't know how to model this connection done this way (I guess I don't fully understand how/when a 50 ohm cable "is" a 50 ohm cable -- Is using this coax in this way better, the same, or worse than using individual wires to connect to the inductor? In another example (in an effort to better understand the meaning of cables with characteristic impedances), what does a 50 ohm cable look like in a circuit where the source and load impedances are not matched to 50 ohms (assume signal in center conductor, shield grounded). I assume I'd get reflections at both the source and the load ---or do I not care if the length of the cable is less than \$\frac{\lambda}{10}\$? AI: 13.5 MHz has a wavelength of about 22 m, so your 4" (physical length, electrical length around 6") is very 'short', well below λ/20. With a short length of transmission line, you can model it quite well as a lumped series L, series R and parallel C. Increasing the effective L and the C of your inductor will drop its tuning slightly, and decrease the SRF of the inductor, compared to using shorter wires. Individual wires of the same length will have a higher characteristic impedance than 50 Ω so will have an effective smaller C and larger L. They would also be more likely to couple magnetically into adjacent wiring loops. In the more general case, yes, you will get reflections when a line is mismatched. For short lines operated with an actual sine wave meeting λ/20 or λ/10, see the first part of this answer. The reflections add up to give the effect of a small series L and a small parallel C. This effectively makes the group delay element of a low pass filter's passband. We don't get to stopband frequencies as the line is 'short'. For short lines operated with wideband or digital signals meeting λ/20 or λ/10, equivalent maximum frequency of the signal risetimes (not the pulse repetition frequency), exactly the same can be said, but with a time domain rather than frequency domain viewpoint. As the round-trip time for a reflection is much less than the transit time of a signal edge along the line, the first reflection will arrive back at the sending end before a small fraction of the transition has been made. The effect on the small signals is to slow the risetime slightly just like the effect of a lowpass filter. In contrast, when a line is 'long', most or all of the transition will have been executed before the reflection arrives back. If you like, the line is 'storing' most of the edge waveform. In this case, the reflections cause additional discrete transitions to the pulse shape, which is usually bad if you're not in control of it.
H: Why not use a 3w brushed motor to drive the larger 3000w brushless motor by rotating the conductor pattern mechanically? Essentially the smaller motor would be rotating the conductor connections in the same pattern that the motor controller would do, except it wouldnt be solid state. Is there something wrong with that design? This motor controller on ebay is $180 to $120 for the chinese supplier. What I just described would be less than $5. It would still have the benefits of brushless but then be more accessible like a normal brushed motor. Any friction from the conductors would be on the much smaller load. I bought the motors for like $40 less (than the chinese supplier) so paying more for the controller is sorta hilarious right? AI: In order for a brushless motor to turn properly, you need the commutation of phase currents to be synchronzied to the rotor position. I literally have a giant mechanical commutator at work which operates exactly the way you describe and it sucks because it can't synchronize to the main motor. That means that if you load down the main motor, the main motor's rotor lags behind the commutator motor's rotor which happily keeps spinning and you lose synch and torque as the commutator rotor laps the main rotor again and again. I was asked to build a solid-state solution that could commutate based on rotor shaft position. That means that now you need one of two things: Solid-state electronics monitor the rotor position on the main motor and drive the commutator motor accordingly. This would require that the driver for the brushed motor be bidirectional so it could move the brushed motor backwards if required to synch with the brushless motor. This type of drive requires 4 transistors which is already 2/3 of what is required for a brushless motor drive. And the fact you need any electronics at all already defeats your original objective. Or couple the shaft of the main motor and commutator motor together directly or with chains, gears, or belts, and position the commutator rotor so its shaft is always equal to the main rotor (or a bit ahead, known as phase advance). But this is obviously pointless since you could just move the brushes into the brushless motor and have the motor move the brushes itself and get rid of the commutator motor entirely. But then this just leaves you with a brushed motor. Then there is the issue that your mechanical switching of the brushless motor currents has to be done with brushes that have to pass all the higher power of the motor just like a brushed motor. In your example you talked about using a 3W motor to turn the mechanical commutator for a 3kW brushless motor. Well, I doubt you'll get away with 3W. You need to turn a mechanism capable of conducting all the current of the brushless motor which means it will be big, and heavy. More like 100W, or even 200 or 300W. I think you will find that if you actually sat down and started designing such a mechanism, it will be a lot more complex than when you originally envisioned it as a high level concept. The one at my work required a lot of brushes, slip rings, and contacts. Very expensive and noisy as all hell. Easy to describe, difficult to execute. but this nothing but brushless for regular consumers when brushed is so much easier... and the controller is a lot more $ where with brushed you can go directly off the battery because it just seems blatantly obvious that there's some sort of corruption going on... its like these brushless hub motors for the scooters, there's nothing that requires it to be brushless, it could be brushed hub motors, maybe slightly differently like the wheels in the front of an airplane where the shaft extends out to both sides, No conspiracy as far as why there are no brushed motors commutating brushless motors as per everything I said above. It literally doesn't work or is vastly suboptimal if you add the stuff to make it work Now you could argue that there should be brushed motors on the market because you can run them directly off the battery. Even if you needed speed control so could not run them straight off the battery, as long as you only needed unidirectional rotation you could use a speed controller that requires only 1 transistor. However, if you need bidirectional control that takes four transistors and a brushless motor only requires two more transistors and has vastly improved performance. I don't think this point applies to brushed motors for bikes though. But one point that does still apply to bikes is that you're running off a battery and batteries have terrible energy density so efficiency is really important and brushed motors aren't as efficient as brushless motors. That is a good point, it would wear... I dont know how long is usual, are you suggesting the larger watts will regularly burn out brushes? I guess I still dont understand... its just a piece of metal being pushed onto a central shaft (or would that be an outer connection?) by a spring while rotating... surely once every ten years is reasonable? You're missing a very important aspect of brushes: For the types of motors you are talking about the actual brush itself at the end of the spring is of CARBON because of a few characteristics: conductive self-lubricating doesn't corrode it is soft so it WEARS down That's right, brushes aren't designed to wear as little as possible. You actually want the brush to wear because you get to choose for the much more expensive, difficult to replace slip ring to wear or for the brush to wear. You also want it to wear so that constantly conforms to the slip ring for maximum contact. I think you're underestimating how maintenance heavy and inefficient brushes are. My understanding is that when people in the model airplane and truck world were mostly using brushed motors, the brushes would get replaced once every season or something like that, and remember these guys are probably only flying every weekend. The model airplane and truck world moved from brushed to brushless motors long ago and got much better performance for it. This is somewhat obfuscated by the introduction of much better batteries, but you can still get brushed motors for certain models and they do not perform nearly as well even with modern batteries.
H: Harvest AC current by connecting to ground? The other day I was curious and I tried the following: Set multimeter to AC Hold one lead in one hand Plug the other lead into ground plug of a house socket Multimeter shows ~2V Does that mean that these 2V can be harvested? Where are the 2V coming from? From my body? How much current should I expect to harvest? Under what circumstances can I get more/less? Somewhat related question that I'm curious about: when I'm doing this and a lightning strikes the house will I get electrocuted while holding the ground wire? AI: It's not only the voltage that matters, it's the current. And if you are holding that meter into air then you have a lot of resistance (over 10^9 ohms) and pFs of capacitance between the meter and other conductors like ground, which means there will only be less than uA available. So yeah it can be harvested, and not enough power to drive even an LED to any reasonable brightness. As far as lightning goes it depends on the current and the current cannot be predicted
H: What happens to a lead acid battery capacity as its temperature increases while discharge current is the same? I know that storing a battery at a lower temperature will reduce the chemical reaction, thus retaining the battery capacity for a longer shelf life. For a battery in use a higher temperature will result in a battery being able to deliver more amp hours due to making the chemical reaction more efficient. But, it also results in lowering the life of the battery due to increased hydrogen gas production, increased rate of electrolyte solution evaporation. However, if the discharge current is kept the same while the temperature is increased, then, the Ah of the battery will increase! Am I right? AI: The typical lead acid battery is manufactured by using lead plates as the poles in electrolyte liquid. This liquid sulfuric acid creates an electro-chemical reaction that will produce a charge on the battery plates which are connected to the terminals. The warmer the batter the faster the internal chemical activity will be. It is able to put out more energy. In the northern climates it is very common to turn the head lights on for a minute or so before starting the vehicle. Some even use battery heaters. Note: The warmer the battery the faster the internal corrosion within the cells this reduces the lifespan of your battery.
H: Have to drive 4 motors with a Raspberry Pi Pico. Is my schematic correct? I have to drive a total of four motors with a Raspberry Pi Pico. I designed this schematic, but before ordering the PCB I would like to get validation from someone more experienced than me. The whole thing is supposed to control a small car, with 4 motors via PWM. Any advice is welcome and since this is my first question asking here please correct me if something is wrong with the phrasing. UPDATE: Following all the important directions given in the responses and comments I have made changes to my circuit, below is the schematic. The bypass capacitors are all in the right corner. In the PCB I place them as close to the ICs as possible. I hope the majority of the errors are gone, thank you all for your help. AI: There is an almost fatal error: the IRFZ44N are standard level MOSFETs and need to be driven with 10-15V on the gate to fully enhance. You are powering your gate drivers with 5V which is not enough to make them work correctly (especially in PWM). This is easily fixed since you have a 12V rail. 47 ohm is a little high as a gate resistor but should work (depending on your PWM frequency). I don't see the input and output capacitors for the LDOs, they are required (maybe they are some of those in the lower left corner?). The gate drivers also need their own bypass cap, check the datasheet. A bonus side note about MLCCs: most of the time (unless they are NP0) their value depends on the voltage so you need to derate them.
H: CAN Bus Hardware Design with 1000 nodes I am looking to develop a CAN Bus System employing up to 1000 nodes on a single network. I am using an existing design based on STM32F072CB that has the CAN Controller embedded along with TJA1050 as the CAN Transceiver. Below is a detailed insight: The Master is going to be a Personal Computer which will use a RS-232 to CAN Bus Transceiver to send commands to 999 slaves. The slaves all have a STM32F072CB Processor and a TJA1050 CAN Bus Transceiver. Each slave will have a stepper motor with them and the purpose is to drive the stepper motors based on configuration parameters set. The purpose of CAN Bus is to send configuration commands to all slaves. The data rate can be very slow here as well. The master will not continuously send commands but only when needed maybe only once a day. The processors on slaves will store the configuration parameters and do all the processing / feedback comparison such as Planned Position vs Current Position or Planned Speed vs Current Speed. Slaves however will have to report back their status to master every 0.5 Seconds whether there is an error in reading or not. The maximum length of the whole setup will be 400 meters and the nodes maybe variably placed across this length i.e not equidistant. My queries are: What is the best approach / strategy to build a fault tolerant system having 1000 nodes? I understand that I will have to compromise on the data rate which is completely fine in my requirement but what will be maximum limit I can achieve? Can the current design support my requirement? The TJA1050 is HIGH Speed CAN Transceiver but I believe I will need to adapt Low Speed CAN Bus design. Am I correct in this assumption? What should be the hardware design practices in this regard? Is there a document or reference that can help set me up on the correct path? I believe I will have difficulty in achieving such high number of nodes. Is this possible? I am open to changing the system from having a single network to multiple CAN-CAN links, is this more feasible? If so, what is the best design approach in this scheme? AI: 1000 nodes can't be on single bus 100 kbps is suggested for 500m bus length TJA1050 is a high speed device, although intended between 60kbaud and 1Mbaud, it may be too fast for your bus and you may need a slower transceiver. TJA1050 guarantees operation with at least 110 nodes. It might work with more depending on environment, but it is not guaranteed to work with 111 nodes or more. Low speed CAN is fault tolerant Depending on specs and standards, node count could be limited to much lower than 100
H: What factors could have caused the ceramic capacitors on this board to crack? While examining an old VGA card for faults under a microscope I found that all of the ceramic capacitors had cracked. The card is circa 1991 so it does have some age on it. But I wouldn't expect solid state capacitors to crack by themselves due to age. NASA released a report in 2019 about the "cracking problem" with low voltage capacitors but the ones on this board are 50V and have axial leads which would have mitigated a number of additional failure points mentioned in this report. The rated 50V of these capacitors is also well above anything that should have come across the ISA bus connector. I can only guess that this might be a result of a surge or other spike from the motherboard or power supply but I'm unfamiliar with this kind if failure. Is this kind of failure common in this era of electronics? Does age play a factor in the failure or these kind of solid state capacitors? Is this failure type illustrative of a power surge or environmental factor? There are 20 ceramic capacitors on this board, all rated at 50V and every one of them is cracked: some severely but there is no evidence of charring and the glass capsules are all intact. AI: There are no cracks. Probably you think the boundary surface of the resin within the casing is a crack. It's just the boundary between air and resin and it looked like that already 30 years ago. You could desolder / clip any of the capacitors and test it. Probably it'd be be fine.
H: How do I find a replacement for this SMD voltage regulator (top marking "ODM")? The 5 pin SMD voltage regulator: I need to replace this component because it is shorted (I think because it is extremely hot.) I am having trouble identifying which one to buy online because there seems to be a lot of them with varying ratings. I have tried searching the for 'ODM' name but it doesn't have any meaning. I just need a replacement that has the same rating. The voltage on leg 1 = 1.6V, leg 2 = 0V, leg 3 = 3V, leg 4 = 0V, leg 5 = 3V AI: It looks like the part you're asking about may be a TLV700 200mA LDO Regulator the pins matchup with the drawings and the ODM top marking shows on a couple of variants:
H: Using a specific optocoupler to turn on relay I have already done research on how to turn on a relay with an optocoupler but I am still confused on some aspects. My diagram works great even though I am doing things incorrectly. simulate this circuit – Schematic created using CircuitLab Diagram explanation: On the right side: I have an atmega328p chip (arduino) running on 3.3V instead of just a 3.3 battery. I drew it that way to make it simple to illustrate. Arduino datasheet states that it should run on 5V but it runs fine on 3.3V. That circuit uses 40 mA. On the left side: I have a relay connected to a 6V battery. That circuit uses 112 mA. Questions I first used 100 Ohms on the right side of the diagram instead of 50 because that used 20mA of current. Arduino states that you should not use more than 20mA of current per pin. My question is why is it that it does not work with a 100 Ohm resistor? Here is a picture of what I had to do in order to make it work: as you can see on the image I had to solder another 100 Ohm resistor in parallel in order to make it 50 Ohms because it was not triggering the relay. So now I know I am braking the rule and the pin of Arduino is outputting more than 20mA. If it works now with 50 Ohms resistor how long could it run without breaking? Let's say I use another microcontroller where I am able to output as many amps I want per pin. Or just to make it simple I have a battery connected just like on the diagram instead of having a microcontroller like Arduino. How can I know if 40mA is to much current for that optocoupler running at 3.3V? Moreover, on the left side of the diagram how can I know if 112mA is to much current? I been trying to find the datasheet for that optocoupler and I cannot find those specs. Let's say I decide to buy a different optocoupler because I cannot find the datasheet of that one. Let's say I decide to buy this one: I can see on those specs that it can take up to 20mA so I will have to use 100Ohm resistor assuming I still use 3.3V. Where is the info on what is the max current it can take in and what is the max current it can output? For example will 112mA will be a lot of current for that optocoupler? Where can I find that info on the datasheet? I know I can make use more components in order to follow the specs but it will be nice if I could understand what are the maximum values I can use AI: The 4N35 optocoupler input is tested at 10mA so the input from AVR to LED should work just fine with a 100 ohm resistor. But the 4N35 output has an absolute maximum current limit of 50mA, so it can't be used to directly drive a relay that requires more than 100mA. There is also no diode over the relay coil to protect the optocoupler transistor from inductive kickback so the optocoupler transistor may be damaged. Those might be the reasons it needs excessive input current to operate the relay.
H: Splitting power cord As far as I've seen, two-terminal AC power cords connected to mains are always packed together (hot and neutral wire in one cord or next to each other). I'm also no electrical engineer or anything, but I was just wondering this: What happens if we run the wires from a socket to some arbitrary device but split apart the hot and neutral wire? After splitting, recombining the wires at the devices again. So let's say the cables are split for the length of 1 meter from socket to the device and are individually insulated. Also, let's assume the current is 0.5A, and the voltage is 230V, and the frequency is 50Hz. Does splitting the hot and neutral wires from each other create magnetic fields that would be problematic for nearby electronics? Would it be a safety hazard? And lastly, (I wouldn't say it would be handy but just for the sake of the example) would it be legal? AI: Does splitting the hot and neutral wires from each other create magnetic fields? Not the way you mean. Each wire will have a magnetic field. With the wires close together, the magnetic fields of the wires will be close together, of the same magnitude, and in mostly opposite direction, so they'll mostly cancel out. Basically the circuit is a loop, and the more area the loop has, the more the resulting magnetic field is coupled to free space. Put another way -- the more you space the wires out, up to about a wavelength or so of your power line frequency, the better an antenna you're making. that would be problematic for nearby electronics? Only sensitive electronics. Would it be a safety hazard? It would at least double the tripping hazard, and increase the chances that the cord would get tangled and yanked out of a plug, thereby creating an electrical hazard. And lastly, (I wouldn't say it would be handy but just for the sake of the example) would it be legal? "Is it legal" always depends on the jurisdiction you're talking about -- and it's really not for this group. But I'm pretty sure that if you had one in your house and someone told the cops, no one would come knocking at the door. I'm pretty sure that if you invited your local fire officials to your home for a safety inspection (if they do that where you live) then they'd tell you not to do that. And, at least under US (and probably British, and perhaps even most European legal systems) if you have a significantly non-standard cord and a fire starts in that room, the insurance company will use it as an excuse to not pay for your fire damage.
H: Hysteresis curve's Y axis seems to be primarily measuring the DC dual power supply of the opamp integrator I am trying to find the hysteresis curve of a transformer's iron core. The curve looks good, but I do have a doubt: The LM741 op-amp integrates the output voltage signal from the transformer's secondary winding. The integrated output voltage Vout is connected with channel 2 on the oscilloscope and is reflected on the y axis. It is proportional to the magnetic field density B, and H is on the x-axis. From there I can obtain a B-H curve. The op-amp needs a 9V dual power supply, which I provided. What I observed is that the y-axis, which is supposed to reflect the measurement of Vout, actually also measures the DC supply voltage. As can be seen here, the "height" of the curve increases as I turn up the DC supply. I am a bit confused and curious about this: Isn't the y-axis only supposed to measure Vout? Then why does the value on the y-axis increase when DC supply into the opamp is increased? I observed this when I disconnected the input voltage from channel 1, meaning there was no input signal (the signal in red is input.) I even removed the secondary winding (I am using a dissectible transformer) to check if maybe the output signal comes from the residual magnetic density within the iron core. It turns out that it is the DC supply that interferes with the signal. As can be seen, despite there being no input signal and no secondary winding, there was still output signal from channel 2. This signal increased as I turned the knob and increased the DC voltage. The V RMS is weaker compared to when there is a secondary winding and an input signal, but it does vary with the DC power supply. (The output signal is yellow.) Why is this happening? AI: When you say that the 741's output amplitude increases as you increase its power supply, immediately I think that it's saturating. In other words, the input signal is too large, and the output is getting stuck against the positive and negative supply limits. It looks to me like you have a gain of -(1MΩ / 10kΩ) = -100. With power supplies of ±9V, you can't expect the 741 to produce an output greater than ±7V out, which corresponds to a maximum input amplitude of 7V / 100 = 70mV. If your input exceeds 70mV in either direction, the output signal will be clipped. If this is what's happening, you have two options: Reduce the gain, by reducing the 1MΩ resistor or increasing the 10kΩ resistor. Reduce the input signal amplitude. Note: a clipped hysteresis curve would look like a normal one, just shorter vertically, and I suspect this is what you are seeing here. Note 2: the gain bandwidth product of the 741 is 1.5Mhz if you're lucky. That corresponds to 15kHz at a gain of 100. If your signals are approaching that limit, you can expect severe attenuation.
H: Enable vendor-disabled hardware on tablet? I have a nextbook tablet (one of those cheap things from walmart) that I was looking to try to improve the RAM situation on to breath some new life into it as it apparently only has 1G of it. I checked the hardware readout on Linux and it reported one slot as unused, so I was sort of hoping it would be using SODIMM's and make my life easy, but alas, it was not to be with the memory soldered to the board. However, from what I found (pictured below), it actually looks like the tablet has 8GB of memory installed to it (my research says the two Nanya1429 chips on the right are each 4G modules), leading me to conclude it's one of those situations where the manufacturer just uses one hardware platform for a model series and disables some of the hardware for the cheaper models. I'm actually not entirely sure how this is usually done (maybe physically disabled? maybe BIOS?), but was wondering if anyone has any insight/experience into accessing and using such disabled hardware? 1G of memory in todays modern desktop OS's renders this largely useless (I have Fedora installed and running, but I needed to give it a ton of swap space just to keep it from oom-killing itself lol). Appreciate the help! AI: Each of those modules is 4Gb (Gigabit). So you have 8Gb of RAM. A byte is typically 8-bits, so that equates to 1GB of RAM, which is what your OS is reporting. There is no disabled memory that you can enable unfortunately. The only way to upgrade would be to physically desolder the ICs and replace with a larger memory array, but that would only work if the PCB was wired for it (e.g. has unused address lines wired up). In practice it probably wouldn't work. Just for the sake of interest, based on the size of the package, they are the 256M x 16 organisation, which would make sense. Two of them together would form a 256M x 32 memory arrangement, so 256M 32-bit words, which is what you would expect for a 32-bit processor with 1GB of RAM.
H: Am I reading this time till trip vs. current diagram correctly Am I reading this diagram correctly? Top x-axis translates to "rated current for fuse". Bottom x-axis translates to "constant current through fuse in A". y-axis translates to "melting time in s". Looking at the line for 10A fuses that would mean that the minimal ampere needed to melt a 10A fuse is about 18A which would take 10^3s (~16.6m). Can the current be lower if time is longer? Diagram taken from here: Schmelzsicherung AI: Looking at the line for 10A fuses that would mean that the minimal ampere needed to melt a 10A fuse is about 18A which would take 103 s (~16.6 m). Notice that the curve is vertical at that time. The fuse will last indefinitely at that current as thermal equilibrium will normally have been established by then (103 s). They don't bother to go out past 1000 s as it would give no additional information and would reduce the resolution of the graph. Can the current be lower if time is longer? We usually look at it the other way around. If current is lower then the time will be longer.
H: In a JFET, is the gate *always* connected to the bulk/substrate? In a JFET, is the gate always connected to the bulk/substrate ? Or is there "no rule" (sometimes it is, sometimes it is not)? And what about the case of the MOSFET ? AI: When a JFET is produced using the common planar process, the channel is first diffused into the bulk and, in order to insulate this region from it, the bulk is given the same doping as the gate region. Thus, a junction of the same kind as the gate-channel junction (except perhaps for the doping concentration values) is already present on the device; thus a JFET is already present. The subsequent diffusion of the gate region into the channel region creates the final, more performant device: it is like having two JFETs with the channel regions connected in parallel. At this point you have to chose if it is worth keeping the two devices separated or not. It turns out that, while it is possible to keep the two devices separated, it is better both from the point of view of performance and feasibility to make them work as one single device. In short the gate and bulk regions are hardwired together in every JFET. Notes The situation is quite different for small signal (depletion) MOSFETs: for these devices, keeping the bulk and the gate terminals separated is like having a device made of a MOSFET and a JFET with parallel channels, which may be useful in some circumstances. The standard NXP-Philips BSV81 depletion MOSFET is an example of this kind of device. Note also that the above statement is strictly true only for discrete JFET devices. Analog Devices, in some of its high performance OpAmps, uses a patented circuit whose input JFETs have their bulk terminal not connected to their gate: it instead goes to a bias network, and this allows an order of magnitude reduction in their gate bias current and better temperature behavior of this parameter (it increases less with the junction temperature compared to standard JFETs). New edit. Recently I "discovered" the (unfortunately not freely available) following paper by R.S.C. Cobbold and F.N. Trofimenkoff "Four-terminal field-effect transistors", IEEE Transactions on Electron Devices, Vol. 12, Issue 5, pp. 246 - 247 (1965). The authors describe how the different doping of the gate and bulk regions and of the channel the behind them give each electrode a distinctive (nevertheless similar) behavior.
H: Why does this hysteresis curve approach saturation so immediately? I am trying to find out the hysteresis curve of a transformer iron core. I use an LM741 for the op-amp integrator. As I increase my 50Hz input voltage, I observe that Vin (value on the x-axis) does increase, while Vout (on the y-axis) increases very little. This does look like it is getting saturated, but I haven't seen the "linear region" on a B-H curve. To find out why, I measured some data points, calculated B, H, and permeability with my other data, and plotted B vs H and permeability vs H. The left part of the graph is different from what it theoretically should be. Theoretically, there should be a curve at the beginning(shown in the 3rd picture), which contains a section with a linear B-H relationship, but my B values are already so high at the very beginning. I suspect that it's because Vout value also reflects the +-9v DC supply voltage for the opamp. I suspect this, because as I increased the DC supply, Vout increased too, which increased the height of the hysteresis curve.(just for testing, The DC supply was constantly +-9v in other times) This makes the y-axis value already pretty high when my input voltage was only 0.02116v. Every time as I only increase a little Vin, this causes little Vout change. Thus, negligible changes on the y-axis are observed. The iron core can't saturate already at 0.02116v, right? It approaches saturation so fast that it seems wrong. My measured permeability doesn't have a trend line at the beginning that leads up to its maximum point. Am I just thinking too much or is something wrong? AI: I have a couple suggestions here. I would measure both V and I on the same side of the transformer. B=uH. Measure B=Integral(Vprimarydt)/(NturnsAcore) Measure H=Nturns*Iprimary/Lcore. Measuring Iprimary could be done with a current probe or a shunt resistor. Make sure you don’t accidently short out your shunt through the scope chassis. Use your scope to divide B/H to get u or plot them both in XY mode. Nturns, Acore, and Lcore are all constants. You may also have correct for gains of your current probe and voltage integrator but these are constants too assuming a fixed test frequency. Also, the 741 isn’t very suitable as an integrator due to its relatively large voltage offset and input bias currents. Even with no input signal, these dc offsets will cause the 0.1uF capacitor to quickly integrate into saturation. Ex 80nA = I input bias = C dV/dt = 0.1uF dV/dt => dV/dt = 800mV/sec. This could be mitigated somewhat by using a bigger capacitor. I would also add a switch to short the capacitor through a 100 ohm resistor to reset the integrator to 0V. A more precise op amp would help a lot.
H: Which is the voltage on this capacitor? I can't figure out the voltage on this 50uF capacitor. There are three values on it 420 V~ , 470V~, and 250VAC. Can someone tell me which it is? Thanks!! AI: All of them, of course. It meets the European EN60252-1 "class C" standard (meant to indicate no significant degradation within 3,000 hours of run time) if you run it at less than 470 volts. It meets the EN60252-1 "class B" standard (10,000 hours) if you run it at less than 420 volts. It meets some other standard (possibly EIA-456-A, which is meant to test a 60,000 hour lifetime) if you run it at less than 250 volts. Since it shows a 470V rating, operating it at 450 should be fine, but it will probably have a much shorter useful lifetime than it would in a lower-voltage application.
H: Difference between ESD and TVS diode? What is the difference bweteen TVS diode and ESD. Though both of the functions are the same, which do we need to choose for what application? AI: A TVS diode is typically capable of much higher power than ESD diodes. TVS - "Transient Voltage Suppression" can, if rated accordingly, be capable of suppressing surge pulses - these are pulses that have several hundred volts (and a generator capable of sourcing several hundred of amperes) for a few microseconds. A few microseconds might not sound like much, but if you apply these pulse to a normal component it will literally explode. As a result many TVS components are quite large. ESD diodes - "ElectroStatic discharge" are designed to protect against ESD. These pulses can have even higher voltage than a surge pulse, but they are below 1 nanosecond. Similar to surge these short pulses can destroy a normal component but the damage will be invisible and often latent. Still, there are several order of magnitude in difference between a surge and a ESD pulse, so many ESD diodes are tiny, but the internal bonding, junctions, etc, are larger than normal components. So a TVS can be used for ESD protection, but many diodes with ESD protection will explode if you try to use them as a TVS component. All of these components have detailed datasheets listing the ratings, so those must be read and the component must be used correctly.
H: How to modify this circuit so that the second LED turns off completely? Circuit simulation is here There are two parts to this circuit. The first part is a switch that is either floating or grounded, controlling a large number of relays via pnp transistors. (Many relays are omitted but imagine they are there, in parallel) This part of the circuit is working perfectly. The second part is LED indication. One LED should be on if the switch is thrown, the other should be on if the switch is not thrown. This part of the circuit almost works properly, but the problem is that LED "B" glows faintly when the switch is thrown. How do I modify this circuit so that LED "B" turns off completely? (The switch is fixed, replacing it is not an option.) AI: A simple fix is adding a pull-down 1k to base of B. The A emitter voltage was almost high enough to enable B.
H: High power LED array current limiting I am a high schooler with an interest in growing special plants. I made this array of LEDs with each diode using 700ma and a voltage drop of 3.55V across each of them. The array has 30 of them in a 3x10 configuration powered by my variable lab bench power supply at 10.6V 7A and has no resistors whatsoever to control the current flow as I just vary the voltage supply to change the current. Is it possible to power this array using a 12V 5A power supply from ebay without the need to add resistors to each series against voltage spikes? Also, because the power supply will be at 100% utilization if it works, it will be submerged in oil to help cooling. If the ebay power supply wouldn't work what would you suggest I do? Array with bulky cooling and 3D printed shroud: LED array powered with low voltage: The array will be wired something like this - but without the resistors: AI: Simply put, no, this specific power supply will not work. Your array requires (10x0.700A) x (3x3.55V) = 7A x 10.65V = 74.55 Watts of power. This 12V 5A is only capable of delivering 60 Watts, regardless of not being able to deliver the 7A current that you require. You could put some DC-DC regulator in between, if for some reason you really don't want a resistor (for example, for power efficiency reasons). Best suggestion I can give you (or at least the most cost effective or simple, I suppose), is to get a 12V power supply capable of delivering at least 7A (more current is okay as well, less isn't), and do put in the resistor. This resistor then needs to 'bridge' from 12V to 10.65V, so across this resistor would then be a voltage of 1.35V. Given the nominal current of 7A, this means a resistor of roughly 0.2 ohm. This resistor will then burn about 10W of power, so you need to make sure that resistor is capable of handling that. Other alternatives could be some linear voltage or current regulator, but they will still burn away the excess in the form of heat.
H: Analog voltage control signal: Do you need a resistor between DAC and IC? I just wanted to ask a quick question. Mostly with the Arduino with buttons etc. you have to use a pull-up or pull-down resistor for the signal to be received correctly. How does it look like when I want to send a analog control signal/voltage between 2 ICs (DAC and LED-Driver, "PT-4115"). Do I have to place a resistor in between those 2 for current limitation (schematic 2) or perhaps also one to ground (schematic 3) or both variants together (schematic 2 and 3)? If so, does it have to be high/low resistance? Here's a quick schematic attached: edit: I cant use a PWM control signal, therefore needing to control the LED driver by analog voltage from a DAC. AI: A DAC normally outputs a voltage so, if your receiver IC is up close and it shares the same 0 volts line then no need for a resistor in normal circumstances. You might choose to use a series resistor if the DAC can output a voltage that is beyond the input supply voltage for the receiver though. That resistor would be to protect the receiver IC. If the DAC and receiver are on separate power supplies then all manner of different configurations might be needed to get what you really want. For instance, different power supplies (unshared 0 volts but galvanically linked) will require a differential input at the receiver. That involves 4 resistors. Galvanically isolated systems may require a much more sophisticated means of receiving such as isolated signal amplifiers of course. If your system runs on a common 0 volts then I would be tempted to put a series resistor close to your receiver input and maybe a high-value pull-down resistor from the signal line to ground. That second resistor would serve to return the signal to a 0 volt level should the two parts (DAC and receiver) be disconnected. Mostly with the Arduino with buttons etc. you have to use a pull-up or pull-down resistor for the signal to be received correctly. That's because buttons are totally passive circuit elements.
H: What is the correct approach to simulate a predesigned circuit? I want to simulate the following circuit with LTspice, but all the operating parts in the circuit (highlights) are not available in the library. I also couldn't find their spice models on the internet. Is there a problem with how I searched or are spice models on the internet so rare and difficult to find? After hours of surfing the internet, I found the IC model in a Chinese blog. Now I really don't know do I have the correct approach in this way? Some friends recommended simulating the parts by myself, but I don't believe this is the optimum approach. Anyway, we are not living in 1980 and I'm not the first guy using these parts. AI: Some links usefull https://www.electronicproducts.com/understanding-pfc/# https://www.powerelectronicsnews.com/design-considerations-of-digital-controlled-totem-pole-pfc/ Very complete : pdf file ... https://www.google.be/url?sa=t&rct=j&q=&esrc=s&source=web&cd=&ved=2ahUKEwiC1tuerp7yAhUJDuwKHV4UBvQQFnoECBsQAw&url=https%3A%2F%2Ftoshiba.semicon-storage.com%2Finfo%2Fdocget.jsp%3Fdid%3D68570&usg=AOvVaw1SYCNsePCIMkU4dfTj-CZ1 This one for digital controlled PFC https://www.infineon.com/dgdl/Infineon-Digital+PFC+CCM+Boost+Converter+-+300W+Design+Example+Using+XMC+1400-AN-v01_00-EN.pdf?fileId=5546d462584d1d4a015886d4dcaa5ea4 For simulating this PFC, you can start by an "equivalent" schematic. microcap v12 ... free ... from http://www.spectrum-soft.com/download/download.shtm Vcrete is Vpeak ... Vredr is Vrectified ... Vch is Vload ... Vich is current in load ... I hope symbolics are self-explaining ... I don't know if there is same "functions" in LTspice. What is simulated here is a drop in main voltage. What you can see is at the drop, current is higher for same output power. The principle of the method is to "predict", as a reference, the shape of the sinusoidal curve of the "current in the choke" as a function of the power required in the load (voltage 24 V DC and current 1A DC fixed) and to try to follow it as well as possible (sometimes above, sometimes below) by making the power MOSFET lead in all-or-nothing by "small strokes" (hence the sawtooth shape of the current around. The regulation is not the best, it is obviously a study set-up. The current supplied by the source (~ 10V rms) is in principle "sinusoidal" with "triangles" and in a real system, it should therefore filtered by a EMI filter at the head of the assembly (voltage source side at 50 Hz, 240 Veff, EU). As it is a low voltage assembly, you can "work" on it without too much "danger"!
H: Block power supply from charging a battery I am making a circuit to supply power to a 12V fan. I am using a power supply and a battery with a MT3608 connected to it to step up to 12V. I've designed the circuit in a way that when the power supply is connected, the MT3608 is disabled and when the fan is on, there is no charging on the battery (the charging is done by a TP5100.) I saw this question that recommended using a P MOSFET. To prevent the charging of the battery, an extra Schottky diode had to be placed (because of the MOSFET body diode.) My situation is quite different because since I am turning the MT3608 off when the power supply is ON and I already have the D6 diode from the step up. Is the circuit below already adequate for use? By that I mean, am I accidentally charging the battery in some way or messing something up? From what I know the D7 and D6 diodes are doing the diode auctioneering and the 8.4V of the battery is lower than the 12V from power supply, so all is fine. There is no chance of the MT3608 having a higher voltage and damaging the power supply because it will never be ON while the power supply is connected. Since the 8.4V from the battery is lower than the 12V from the power supply, it will not provide any current to the fan while the power supply is ON. Am I missing something or am I good to go? AI: am I accidentally charging the battery in some way or messing something up? There's always a leakage current flowing through the diode when it's reverse-biased: No details about the operating conditions are given, so it's not easy to estimate. For D6 in your case, it should be noted that if the diode's junction temperature exceeds 125°C by any chance (e.g. by external conditions) then it'll be possible to charge the battery from the supply voltage. Am I missing something or am I good to go? Depending on the potential risk mentioned above, you can decide if it's good to go.
H: Can a 100W heating element heat up just as fast as a 300W heating element? Say I have a 100W and 300W heating element that are both drawing 5A of current. The 100W heating element has an applied voltage of 20V, and the 300W heating element has an applied voltage of 60V. Would the 300W heating element heat up faster? I originally thought that all that mattered was the current passing through the heating element that dictated the heating time, but I want to fully understand how power plays a role. AI: What's missing from your question is the heat capacity of each heater. What might be missing is that you want to heat something up with the element -- I'm going to assume that's not what you're talking about. Well, and about a thousand other related things that may or may not pertain. To simplify things, assume that you have heating elements that experience exactly the same temperature rise across the whole of the element, and assume that the only two things that differ is that they consume different amounts of power, and they have different heat capacities. To reduce the math, let's further assume that you don't care about final temperature (we'd need yet another heat-related constant if so) -- let's say "heating up fast" means how fast the temperature rises when you first turn the thing on. Say that heater 1 is a 100W heater, and has a heat capacity of 100 Joules/Kelvin. When you turn it on, its temperature will start rising at one degree C per second (because \$100 \mathrm{W} = 100 \mathrm{\frac{J}{s}}\$, and so \$100 \mathrm{W} / \left(100\mathrm{\frac{J}{K}} \right ) = 1 \mathrm{\frac{K}{s}}\$, and if you're talking temperature rise, a change of one C is the same as a change of one K). Now say that heater 2 is your 300W heater, and has a heat capacity of 300 J/K. The initial rate of temperature rise will be the same. Now let's change this around: say you beat your brains out making a 100W element that has the absolute least amount of material in it. Just for fun, say you've managed to make a 100W element that has a heat capacity of 1 J/K. If you power up that element, you'll see a rise of 100 degrees C per second. You can get higher rises yet -- when you get a slip of paper printed by a thermal printer, that printing happened because of heating elements that heat and cool very fast indeed, and ink in the paper that's activated by heat). So -- can a 100W heating element heat up as fast as a 300W heating element -- absolutely. Now, if you want to heat something up with your element, the story is different -- in that case, you care about the thermal capacity of the element plus the thermal capacity of the thing. In that case, once you get your elements small enough that their temperature rise is governed more by the thing you're heating than by the construction of the element itself -- the 300W element will win the race.
H: Powering an electromagnet I need an electromagnet so I made one out of an old microwave transformer. (something like this: https://www.instructables.com/Microwave-Electromagnet/) To power this electromagnet I have a DC power supply with a voltage limit of 30V and a current limit of 10A. I measured the electrical resistance of the electromagnet coil to be about 0.46 Ohms. The issue is that when I power the electromagnet I can only get around 46W of power into it because when my DC power supply is set at 4.6V it is already hitting the current limit of 10A obviously, as 4.6V / 0.46 Ohms = 10A. My question is is there any way to modify this circuit so I could get higher power to the electromagnet, somewhere in the neighborhood of the maximum 300W the power supply can output? or is this not possible with a 10A power supply. AI: As you said, the DC resistance of the coil is 0.46 Ω. If you want to apply 300 W, then you can use Ohm's Law (and the power law) to determine the other variables: $$I = \sqrt{\frac{P}{R}}$$ This would give you a current of 25.5 A. This is more than double the limit of your power supply, so you would need a more capable unit. The voltage would be: $$E = \sqrt{P R}$$ Or 11.7 volts. Although your power supply may be capable of 300 watts, you've hit one of its limits (10 A). In order to apply 300 W to the coil, you need to increase the voltage to 11.7, but the current would continue to increase beyond the power supply's limit of 10 A. Also consider the wire gauge of the coil. If you were to supply enough power to reach 25.5 A through a fine gauge wire its temperature will rise quickly. You want to make sure the coil is rated for the power intended.
H: How to stop a high torque stepper motor when a certain amount of load is applied? I’m looking for some design suggestions for stopping the linear actuation of a platform when too much load is applied to the moving plate, for both normal and axial loads. I mainly do not want to choke the motor or for anyone else possibly using this system to be hurt if it won’t stop. Ideally, if something were to go wrong, the entire system wouldn’t be damage and would just need a reset/restart. I am considering using a NEMA 17/23 stepper motor with a lead screw & guide rails or a belt & pulley system. I’m not quite sure which offers better safety and reliability with stopping the motor. At first thought, it seems that the lead screw would generate torsion to the point of breaking or damaging some other hardware. Perhaps the pulley can slip under too much load? Is it customary to use other sensors, such as strain gage, to detect overloading or misuse? TIA. AI: My Prusa printer uses Trinamic drivers for its steppers. These have configurable overload detection- something they call StallGuard- that looks at motor current for detecting stalls/load. Here's a PDF that discusses the StallGuard feature. Here's an overview on Adafruit that discusses one of the Trinamic chips...
H: 200Hz electrical noise on an industrial machine The problem I've got an industrial controller that takes an N-type thermocouple and scales its range (0-1300°C) to a 0-10V DC output signal. (For reference, the module is this: https://www.status.co.uk/product/signal-conditioner-temperature/) The 0-10V signal has 200Hz noise coupled to the output. I would like to remove the noise. I've tried using a low pass filter but it does absolutely nothing. The values of components used for the low pass filter are R = 787 ohms and C = 1uF giving me (roughly) a 200Hz cut-off frequency. Analysis The 0-10V signal is fed directly into a op amp in a unity buffer configuration (the op amp is an Analog Devices ADTL084ARUZ.) The signal is then passed into an acquisition system which is sampling the signal 10,000 times a second. There are no other noise issues on any of the other analogue input signals for this system and I've changed the acquisition for an equivalent system so I know there are no issues with the acquisition itself. The signal travels from the signal conditioning module to the acquisition via a screened 2 core cable over a distance of about 3 metres. The question What can I do to remove the noise? I appreciate I could make the capacitor bigger therefore making the reactance lower and creating a quicker path to ground for the coupled noise signal. I suppose I could change the filter for an LC filter or a band pass filter as well. Additionally, what is the best type of capacitor to remove these types of noise issues? I'm currently using a ceramic capacitor but I've also tried MLCC and electrolytic just to see if they would have a different effect but they also did nothing. AI: This is well possible, even with a first order RC filter that you use: You should set the cutoff frequency much below 200 Hz to get good attenuation at 200 Hz. e.g. 10...100 kOhm and 1 uF. In addition, you can use digital filters as your sampling rate is very high. While the Twin T notch filter has good attenuation, this is very sensitive to component values. Caps often have as much 20% tolerance and more over temperature, so building a good (nuch better than a simple low pass) Twin T notch filter is much more involved than it looks on paper.
H: Design custom PCB for esp32 This video ( https://www.youtube.com/watch?v=ndEeFQ5mi_g ) explains how to program an esp32 chip. I will like to design my custom PCB without using the one from the video. So my question is where can I find the diagram of this PCB: https://www.sunrom.com/p/breakout-pcb-for-esp32-esp-32s I already managed to flash my code to the esp32 chip using this product. Now that my code is running on the esp32 chip if I where to power it giving 3.3V will it work? what happens if I do not solder the pins that I am not using? For example if I only solder the 3.3V pin with 3.3V, the ground pin and pin 2 to turn on and off and LED will it work? AI: I was able to run the LED blink sketch like this: I had to program the chip with the help of the part posted on the question.
H: If gate to source is breakdown of P-Channel MOSFET, Will gate to drain be also breakdown? I have failured P channel MOSFETs. During dielectric test or ESD test, MOSFET died. Max. Gate to sorce voltage is only 8V. There is no protection for gate to source. Gate to drain shorted. Also gate to sorce shorted. I don't know the process of breakdown. Firstly, is gate to sorce breakdown? And then gate to drain will also be breakdown? Or if gate to source shorted. Is resiatance between gate to drain almost zero? AI: Maybe there is protection. If the parts are cheap maybe you can sacrifice one by characterizing I vs. V of G-S voltage. There may be a ~9-10V Zener in there. Another way to tell is the relatively large typical (not maximum) gate leakage current. In any case, it sounds like you basically melted the chip. The default state of destroyed semiconductors is generally a conductive blob. If you pass massive amounts of current the bonding wires or chip will go open, but shorted is how they like to perish.
H: What is scope of variables in Verilog modules? I am fairly new to Verilog and can’t find out if Verilog modules have same scope privacy as for example C functions have. For example can I use same name ( say clk ) for variables in different modules ? AI: Verilog has several name spaces for different kinds of constructs. See Section 3.13 Name spaces in the IEEE 1800-2017 SystemVerilog LRM. Briefly, each module definition creates a name space for itself and you can declare variable with the same names within each module. There is no implicit connection between variables with the same name in different modules, you must connect them through ports. Within a module you can have other local scopes and declare variables with the same name inside them. (like inside a function) You might want to read my DVCon paper about variable scopes and lifetimes.
H: Reverse engineering of IBT-4 MOSFET H bridge I have been looking into the cheap IBT-4 MOSFET H bridge to use it as a base for a costume PCB design. But there is one thing I don't get; the PCB has a DC-DC step-up converter (MC34063AB by STMicrolectronics) that, across the recommended 5-12V PCB supply voltage, outputs more or less 14V to all other ICs as supply voltage. I don't get why this DC-DC converter is there. The system has 2 half bridge MOSFET drivers with bootstrap capacitors, shouldn't it be this alone enough to actuate the gates of the high side of the H bridge? Why use a step-up converter as well? For all else the design seems more or less straight forward it uses a 2 comparator IC(LM393M by Texas Instruments), which in case of a signal from the MCU connects the 14V to the half bridge gate driver (L6384 by STMicrolectronics). This effectively decouples the MCU from the PCB. The gate drivers pin out is as expected, nothing special. The only thing I'm missing is why is there this DC-DC step up, and under what circumstances should I carry this DC-DC converter over to me PCB design. Thanks AI: Most MOSFETs require at least 10V of gate-source voltage to achieve their rated on resistance. So what is supposed to provide this if you connect the board to a 5V supply if the DC-DC converter isn't there? Check out the MOSFET datasheet. The L6384 has an undervoltage lockout between 10-12V for this purpose to prevent incomplete proper MOSFET turn which would make it overheat. So the IC itself actively prevents you from trying to drive the MOSFETs with a lower voltage. Having the DC-DC converter there lets you use the board for lower voltage motors.
H: Issue with a touch switch I made a touch switch in PCB based in the following schematic When touching the plate with a finger the BJT turns on and the 555 trigger pin goes LOW activating the pin 3 (OUTPUT). The time the output is on depends of the 100K resistor and the 10u capacitor Below you can see the schematic and the PCB Changes in the original circuit I’ve used VCC=9v instead of VCC=6V To level out any fluctuations in the power supply voltage that might affect the operation of the timer. I’ve added a 10 nF capacitor to pin 5 Probably because of the noise generated by my power supply the circuit was turning on randomly so I’ve added C3 to prevent this (The value of C3 was discovered by trial and error). With the changes described above circuit works well with a power supply with 9V. The issue appears when I change my power supply by a 9V battery. When I use a 9V battery the circuit only works well if I’m not isolated from the earth (touching the floor with a bare foot) If I’m isolated from the earth (using shoes) the circuit usually stops working after 3 or 4 tries and only works again if I touch the earth. When I connect the GND of the circuit to the GND of the oscilloscope the circuit works fine (Probably because the GND of the oscilloscope is connected to earth). How can I improve the circuit to prevent this behavior when using a battery? AI: The touch plate is the input to a differential of 0V. If 0V is floating with some tiny capacitance to earth then the input impedance, although high, shunts the finger capacitance induced voltage. In this circuit with Rc=1M and 6V , Ib must be greater than 5uA/hFE positive current. The better solution to this might be a better touch pad which includes both input and Vbat with interleaved strips of conductors . Then the isolation from earth ground is irrelevant. Basically you need 2 contacts between input and any Vbat within spec of 555 that are both touched anywhere on the touchpad of interleaved tracks. Proof of concept is by finger capacitance or high resistance .
H: How does using a high-pass filter and an amplifier maximize the signal amplitude for analog-to-digital conversion? I am currently reading the Fringe Contrast section of this document. This section says the following: Use a high-pass filter (HPF) and an amplifier (G) to maximize the signal amplitude for analog-to-digital conversion (ADC). How does using a high-pass filter and an amplifier maximize the signal amplitude for analog-to-digital conversion? I'm a novice to electronics, so I'd appreciate a more "basic" explanation. AI: It appears that in this application you are only interested in the alternating signal and not in the DC component. Let's give an example: DC offset = 300 mV. AC signal = 100 mVpk-pk. ADC input = -3 to +3 V. If you feed the raw signal into the ADC you will be using \$ \frac {0.100}{3 -(-3)} = 1.6\% \$ of the full-scale resolution of the ADC. Accuracy won't be as good as it could be. To fix this: Remove the DC component with a high-pass filter. This might be as easy as a capacitor in series with the signal. The output of the HPF will be the 100 mVpk-pk AC signal oscillating around 0 V. Let's say we want to amplify this to a max of ±2.5 V to leave a little headroom at each side. That means a gain of \$ \frac {2.5 - (-2.5)}{0.1} = 50 \$ for the G block. This will give the ADC a signal of ±\$\frac 5 6 = 83\%\$ full scale.
H: Common Mode Voltage in Differential Amplifier used in Voltmeter Circuit After many days of investigation, design and simulations I finally design this circuit used as part of my arduino voltmeter. This circuit uses AD8605 (https://www.mouser.com/datasheet/2/609/AD8605_8606_8608-1716254.pdf) operation amplifier configured as differential amplifier in order to prevent reverse polarity protection. The voltmeter is deisgned to read 0v-20,5v max. In this two pictures I put the simulations with it maximum voltage. Last one in reverse polarity situation. Focusing in the last picture (reverse polarity scenario) as you can see V+ input has -212mv. I read carefully the datasheet of this op amplifier and its says common mode input voltage goes from 0v to 5v maximum. Anyone with vast experience in electronic design could tell me if this minimum negative voltage in V+ will damage the op amp or I simply ignore this voltage in this particular scenario. AI: Data sheet for AD8605 includes the following paragraph: Phase reversal can cause permanent damage to the amplifier; it can also cause system lockups in feedback loops. The AD8605 does not exhibit phase reversal even for inputs exceeding the supply voltage by more than 2 V. So negative input voltage of -0.2V, even though outside the supply range of 0V to +5V shouldn't cause problems. But it doesn't fully answer your question, because bias currents appear to rise precipitously for input voltage below 0V. Data sheet goes on to suggest adding series resistance to limit bias current: The AD860x has internal protective circuitry. However, if the voltage applied at either input exceeds the supplies by more than 0.5 V, external resistors should be placed in series with the inputs. The resistor values can be determined by: \$ {{V_{in}-V_s}\over{R_s}}\lt 5mA\$ The remarkable low input offset current of the AD860x (<1 pA) allows the use of larger value resistors. With a 10 kΩ resistor at the input, the output voltage has less than 10 nV of error voltage. A 10 kΩ resistor has less than 13 nV/√Hz of thermal noise at room temperature. Your diode D1A shouldn't exceed the 0.5V threshold mentioned in this paragraph. Even so, you might consider moving D1A's cathode to the junction point between R4 (1k) and R3 (10k). Doing so allows R3//R2 to limit input current.
H: Help understanding use of step-up boost converter I have a Ryobi battery that I'd like to charge from 12V instead of 230V. The charger comes with a power supply that outputs 36V 1.7A, so I thought I could easily replace this with at step-up boost converter with the same specifications. I am using this converter - I think it should be fully capable of the task. Like this: When connected to my lab power supply, it almost seems to work. On the battery there are 4 steps to indicate charge (see picture.) When it charges one step, the current output on the lab supply goes from 3A to 0.7A in about an hour and then the charging seems to stop. I imagine this is because the battery has four cells, and the current drops to "fill the cell entirely" before moving on to the next. (Just a guess.) The problem is that charging seems to "hang" here. If I compare with the 230V power supply, I see that the charging voltage is slightly higher at this state (38.3V.) If I adjust the boost converter to this voltage, then suddenly the charger returns to using about 2A, and the charging continues. My thought was that since I only replaced the 230V power supply, I would not get into trouble that would possibly destroy the battery - is that true? What can I do to make the charging "run" all the way? AI: Do your bench power supply and your boost converter have enough power output? both of them should have enough current margin to allow brief "spikes" in current drawn by the battery charger. The fact that you matched the "36V 1.7A" spec may not be sufficient. Those ratings tell you nothing about transient response. For example, the charger might draw a sudden current spike at some point, maybe when switching between charging modes, and your boost converter might not react well and allow the output voltage to drop momentarily. This in turn could mess-up the internal logic of the charger. This could also be due to connection wires. Are you sure you connected the boost converter to the bench power supply with thick enough wires? 36V * 1.7A = 61.2W Assuming, conservatively, a 75% efficiency for the boost converter (at 36V), you have a 61.2W / 0.75 = 81.6W to be delivered by your BSP. So, assuming your BPS outputs 15V, it must be able to provide at least 81.6W / 15V = 5.44A output. You need thick wires to avoid a relevant voltage drop at that level of current. For example, a 1ohm total wiring between BPS and boost converter will drop 5V+, which may not be handled well by the booster, especially during transients. Due to the higher voltage, the wiring is less of a concern between the booster and the charger, but still, better check if it is thick enough. If the booster is a module you soldered on some perfboard, for example, you may want to check if the tracks on the PCB are large enough to avoid substantial voltage drops, especially on the BPS side. Moreover, during fast transients, the length of the wires could wreak havoc, because of their inductance. They could cause additional voltage drop or even ringing (oscillations) that, again, could disrupt the logic of the charger. Another problem may be power supply noise. If your BPS is a SMPS, it could generate too much noise (especially if it is on the cheap side). Your booster also generate switching noise. And switching noise tend to be worse at high current levels. All this could be too much for the charger. If you have access to an oscilloscope, you could monitor the charger input during charging and compare the two situations (original PS vs. your setup).
H: Good idea to use UART in half-duplex mode when using RS485 transceiver? Most 2-wire RS485 implementations I have seen use both UART RX and TX pins which works of course. And I have done so. But I was wondering whether using UART in half-duplex mode is a good alternative that maybe(?) has benefit of cleaner code and reducing pin count. The application is Modbus ASCII and timing is so clear (3.5 characters) that the switchover (that I do for DataEnable anyway) could be joined with a TransmitEnable. (Some context: I have had RS485 transmitters with local echo’s on the UART RX line) AI: It might be a good idea if you are in a situation where you need to preserve pins. But it also then makes some things harder. You need to switch single MCU pin between RX and TX modes for the single UART wire, in addition of controlling the transmitter/receiver enable pins. It might also need a pull-up to the data lines so it floats idle between changing direction of MCU pin - some MCUs have internal pull-ups that can stay enabled all the time instead of turning on just when input. It also makes it impossible to read back what is transmitted by the MCU, so detecting glitches, collisions or errors is not possible.
H: longer reliability in power systems The highlighted term "longer", I think it should have been lower. What is longer reliability? AI: If probability of successful operation is the opposite of mean time to failure MTTF and failure rates are constant for each part, then longer MTTF’s result in longer reliability periods. But confidence factors are used here for the probability of MTBF and FIT rates. Preventive maintenance test plans also increase the duration of reliability. These intervals are adjusted according to the margin of the test results. In the grid power industry, they often have 4 levels of ratings for each test type from annual, to monthly to weekly to remove and replace for escalation levels of monitoring margins. E.g. explosive gas concentration levels, temperature rise, PD levels, etc.
H: Non-inverting, closed loop op-amp: How to read datasheet and choose the right resistance network? After reading for about 3 hours about the different problems and situations regarding very low and very high resistor values (source resistance / feedback resistance) with op-amps theoretically I understood all the mentioned facts. But converting this knowledge into practically constructing a real schematic is still a problem to me. The datasheet of the op-amp used (AD4522 doesn't really go into explicit detail (or at least not into sufficiently transferred details for beginners). On page 30 "USE OF LARGE SOURCE RESISTANCE" they go into detail with explicit values, but this is for a Unity Gain Follower circuit and not really a non-inverting amplifier circuit. I tried to transfer this answer (How to choose resistor values in op-amps) to my case, but still struggling a lot. My current thoughts are: Since "the basic op-amp load is the feedback resistor Rf" (Or does it only apply to inverting configurations?): @page6 "paramater@50V Vsupply" it mentions "Continuous Output Current" as 14mA. For safety reasons, let's assume continuous 10mA is okayish (am I right?). Therefore: R_f should be: R_f = V_output,max /I_cont. = 45V/10mA = 4,5 kΩ. Therefore with a gain of 37,5 => R_s = 123 Ω. Am I right or is the calculation of the resistor values based on something completely different? AI: The op-amp load in the case of the non-inverting amplifier is the sum of the two resistors. In general you want to stay well away from drawing the maximum load from the op-amp in most cases at low frequencies (and you've picked a 3MHz op-amp optimized for DC specifications so I assume a low frequency application- kHz). At high frequencies the impedance of stray capacitance starts to affect the feedback. If you actually operated that op-amp at 50V single supply then you'd have thermal issues before current limit issues. For example, the RM8 package has a thermal resistance junction to ambient (under some particular mounting conditions) of 194°C/W. So if we want to limit heating to, say, 20°C we can't dissipate more than about 100mW. Worst case will be with 25V out, so no more than 4mA, which implies a load resistance of no less than 6.25K. In fact we might well want to use less loading than that by an order of magnitude at least. Unnecessary thermal gradients on the chip can cause other issues (such as increased distortion), and the resistor values are plenty reasonable at 10x that. We might use something like 49.9K Rf and 2.74K Rs, or perhaps 100K and 5.48K for an amplifier operating at DC to kHz. The maximum values practical are similarly fuzzy. Usually you want to be somewhere in between (in a log sense) so maybe 10x or 50x the minimum and 1/10 or 1/50 the maximum.
H: 3SPI, 1 I2C, 1 UART connections to esp32 I am trying to make a number of digital connections to an esp32 datasheet As shown in the photo below. I am having difficulty finding a way to read 3 ICs with SPI outputs, because I only have 2 free SPI busses on the ESP. One is used by flash. Each SPI connection is coming from an Pt-100 RTD which I usually use the chip Max31865 to take the sensors reading to SPI datasheet. So my questions are: Can I safely make a 3rd SPI connection with the ESP? Is there a way to take a Pt100's reading to analog with preferably 16bit resolution? Cannot be a breakout board. Is there an IC that can take multiple Pt100 inputs and combine them into 1 SPI connection? AI: You can put several MAX31865 devices on the same SPI bus. They will share the clock and data lines, but each one must have its own separate chip select \$\overline{CS}\$ signal. So, you just need one SPI interface and a separate GPIO output pin for each device. As an aside, be careful not to confuse resolution with accuracy. The accuracy of the MAX31865 appears to be about 10 times worse than its resolution. Using a converter with 16-bit resolution might not give you any better accuracy.
H: What happen if one connects two live phases together? If a house is running on 1 phase wire and is flipping instantly or not stable for a short period as it drops from 200v to 170v and return back to 200v in 10 seconds. Would connecting another phase to the first phase balance the electrical loads? AI: If a house is running on 1 phase wire ... Then all live wires in the house will be at the same voltage. ... and is flipping instantly or not stable for a short period as it drops from 200v to 170v and return back to 200v in 10 seconds. If the supply drops then all the live wires will drop to the same voltage. Would connecting another phase to the first phase balance the electrical loads? If there is only a single-phase supply then you achieve nothing. If it was a different phase of a three-phase supply you would create a short-circuit, a very high current would flow limited only by the cable resistance and the circuit breakers would trip.
H: BJT differential pair on breadboard enters saturation I've built the following circuit on a breadboard (for the purpose of experimentation) and measured the voltages: IN+ and IN- are connected to ground, VCC is 10V. As you can see it's a differential pair (using 2N3904 and 2N3906) loaded with a current mirror for differential to single-ended conversion. The input uses Q5 and Q6 to raise Q1 and Q2 base voltages so that they're turned on even when the IN+ and IN- are grounded. LTSpice simulation seems to confirm the circuit works, but on a breadboard Q5 is saturated. I tried the following things to try to fix the circuit: Diode-connecting the other side of the mirror instead, but then Q6 would become saturated. Replacing Q3 and Q4 with same value resistors - this seemed to help with biasing, but that I think cuts the gain in half. Replacing Q3 and Q4 with some other transistor (2N2222) - this didn't make a difference. I was hoping that it would work, even considering the obvious parameter mismatch between discrete transistors. Any ideas what am I missing? AI: As @user_1818839 pointed out in the comment, there was an error in measurement that I've made. The 0.9V across emitter-base of Q1 is simply out of this world, and should have made me think twice before posting - lesson learned :-)
H: What is a hardware thread in RISC-V? RISC-V PMP limits the physical addresses accessible by software running on a hart (hardware thread). Source: edX course on Introduction to RISC-V, Chapter 4. Developing RISC-V, The Privileged Specification (PMP is Physical Memory Protection). I know what a software thread is, it's a sequence of instructions executed sequentially. What exactly is a hardware thread in this context? Additional context (copied and pasted from edX course material): A common feature of most modern processors is some way of performing secure remote computation or a “trusted execution environment”. Examples of this technology include Intel Software Guard Extensions (SGX), AMD Secure Encrypted Virtualization (SEV), and Arm TrustZone. While the RISC-V ISA does not provide an end-to-end solution for Trusted Execution Environments, the physical memory protection (PMP) capabilities are a solid foundation on which one might construct such a system. RISC-V PMP limits the physical addresses accessible by software running on a hart (hardware thread). An optional PMP unit provides per-hart machine-mode control registers to allow physical memory access privileges (read, write, execute) to be specified for each physical memory region. The PMP values are checked in parallel with the PMA checks we covered in the last section. The granularity of PMP access control settings are platform-specific and within a platform may vary by physical memory region, but the standard PMP encoding supports regions as small as four bytes AI: The comments already pointed to the right direction. It is easier starting from "what is a core". From "Volume II: RISC-V Privileged Architectures V1.10": A RISC-V hardware platform can contain one or more RISC-V-compatible processing cores together with other non-RISC-V-compatible cores, fixed-function accelerators, various physical memory structures, I/O devices, and an interconnect structure to allow the components to communicate. A component is termed a core if it contains an independent instruction fetch unit. A RISC-V-compatible core might support multiple RISC-V-compatible hardware threads, or harts, through multithreading. From "Volume I: RISC-V User-Level ISA V2.2" The base RISC-V ISA supports multiple concurrent threads of execution within a single user address space. Each RISC-V hardware thread, or hart, has its own user register state and program counter, and executes an independent sequential instruction stream. The execution environment will define how RISC-V harts are created and managed. RISC-V harts can communicate and synchronize with other harts either via calls to the execution environment, which are documented separately in the specification for each execution environment, or directly via the shared memory system. RISC-V harts can also interact with I/O devices, and indirectly with each other, via loads and stores to portions of the address space assigned to I/O. We use the term hart to unambiguously and concisely describe a hardware thread as opposed to software-managed thread contexts. In the base RISC-V ISA, each RISC-V hart observes its own memory operations as if they executed sequentially in program order. RISC-V has a relaxed memory model between harts, requiring an explicit FENCE instruction to guarantee ordering between memory operations from different RISC- V harts. From the above, the parallel between hart and Intel's Hyper-threading is very good.
H: Why is this power-on reset generator Verilog module getting optimized out? I am trying to write a Verilog module that generates a power-on reset signal for a few clock cycles. I am synthesizing using Lattice iCEcube2 + Synplify Pro targeting an iCE40 HX1K on the Nandland Go Board. If I write the the module like this, it is getting optimized out: `default_nettype none module reset_generator #( parameter COUNT_WIDTH = 2 ) ( input wire i_clk, output wire o_rst ); reg [COUNT_WIDTH:0] rst_count; assign o_rst = !rst_count[COUNT_WIDTH]; always @(posedge i_clk) begin if (o_rst == 1) begin rst_count <= rst_count + 1; end end endmodule iCEcube2 outputs this warning: ... @N:CL189 : reset_generator.v(13) | Register bit rst_count[4] is always 1. @N:CL159 : reset_generator.v(6) | Input i_clk is unused. ... @N:BN115 : ball_absolute_mv_vga_top.v(19) | Removing instance reset_gen (in view: work.ball_absolute_mv_vga_top(verilog)) of type view:work.reset_generator_4s(verilog) because it does not drive other instances. ... And I can verify that the o_rst signal is indeed never set to 1. I thought all registers were initialized to 0, so I'm not sure why it thinks rst_count[4] is always 1. However, if I explicitly set rst_count to 0, like this: reg [COUNT_WIDTH:0] rst_count = 0; Now it no longer is getting optimized out and works as expected, but iCEcube2 shows this warning: @W:FX1039 : reset_generator.v(13) | User-specified initial value defined for instance reset_gen.rst_count[4:0] is being ignored. This warning also implies that initial values are 0. So why does the first version get optimized out? And why does adding an initial value that gets ignored change the behavior? Is this just a quirk of iCEcube2 and/or Synplify Pro? EDIT 1: I'm using a power-on reset because Lattice can only initialize registers to zero, and I'd like some to start off with non-zero values. The o_rst of this reset_generator component is hooked up to another component at a higher level like this: wire w_reset; reset_generator #( .COUNT_WIDTH(4) ) reset_gen ( .i_clk(i_clk), .o_rst(w_reset) ); ball_absolute ball_absolute ( .clk(i_clk), .reset(w_reset), .vsync(o_vga_vsync), // ... ); The reason it does this is because ball_absolute has a pair of X/Y registers for the ball's position on the screen. I'd like the ball to start in the middle of the screen, not at (0, 0). And because Lattice can only initialize registers to 0, I want to use a power-on reset signal to set X/Y to non-zero values. The full project is actually up on GitHub. EDIT 2: I also understand that a PLL Lock signal could be used as a power-on reset, but unfortunately the HX1K does not have any PLLs. The Go Board uses an external crystal for the clock. EDIT 3: Clarification on the PLL. Some HX1Ks do have a PLL, but not all of them. From the Notes on page 8 of the iCE40 LP/HX Family Data Sheet: "No PLL available on the 16 WLCSP, 36 ucBGA, 81 csBGA, 84 QFN, and 100 VQFP packages". The Go Board has a 100 VQFP package, so it does not have a PLL. AI: This is probably a quirk in synplify. Synplify is intended for synthesizing designs for ASICs, not FPGAs, and as a result is rather opinionated. For ASICs, it's common to not initialize anything, ever, and instead use explicit resets. And as a result, synplify handles initial blocks and inline initializers differently from FPGA tools - specifically, it mostly ignores them, even if it causes strange, unexpected behavior. At any rate, all signals that are not explicitly initialized do not start at 0, they start at X (indeterminate logic level). And then the tools can pick whatever value they like during synthesis if it can simplify the logic. So, it seems that's what synplify is doing here... It notices that it can resolve that particular X to a 1, and as a result delete a bunch of logic. If you initialize that reg to 0, then synplify cannot make this optimization, but it warns you that the initializer is ignored because synplify does not understand how to actually initialize the registers as you can't do that on an ASIC. What you should do is keep the inline init to zero, but also add an external reset input that can also reset that register.
H: Are NMOS and PMOS semantically meaning *enhancement* NMOS and PMOS? Are NMOS and PMOS semantically meaning enhancement NMOS and PMOS? If so, how are depleted NMOS and PMOS called? AI: Semantically, a word means whatever the author wants it to mean. So if you run across a work that uses "NMOS" to mean a kind of ground-clinging non-vascular plant that lives in moist areas -- just roll with it. Typical usage is that if you just say "NMOS" or "PMOS" you mean enhancement mode, because these days depletion-mode MOSFETs are exceedingly rare. If you happen to be working with one you should refer to it as "depletion mode NMOS" or "depletion mode PMOS". But if you run across an article that's really confusing until you finally realize that the author is talking about depletion mode, go back to the start, re-read, and be glad you're not reading about botany when you wanted to know about transistors.
H: Thevenin equivalent or mesh-current in a diode circuit I've been stuck on a problem for a couple days and many hours now and see no other option than to ask here and see if you can help me or give me a lead. What I have been stuck on is this: My initial solution for finding out the current through the diode has been to apply Thévenin equivalent where I first solve the Thévenin resistance according to: The two resistors are in parallel where the voltage sources are shorted, the diode is open, and the Thévenin resistance is 10/7 kilo Ohm. Then I got Thévenin voltage by taking 5V - 2V = 3V. (Vth - Vt) / Rth = I (diode) -----> (3 - 0,7)/ (10/7) = 1.61 mA The solution is supposed to be 1.5 mA. I am not sure what I did wrong here. I also tried the mesh-current method but I got strange numbers. What do you think? AI: The Thevenin voltage isn't \$3\:\text{V}\$, though it's not terribly far from it. There are a variety of ways to compute it but none of them look like what you did. One way to think about solving for it is to just look at the current magnitude that would exist between the \$2\:\text{V}\$ and \$5\:\text{V}\$ sources, via the two series resistors. This current would be \$\frac{5\:\text{V}-2\:\text{V}}{2\:\text{k}\Omega+5\:\text{k}\Omega}=\frac37\:\text{mA}\$. That current, times \$2\:\text{k}\Omega\$, is the voltage that must be added to \$2\:\text{V}\$ to get the Thevenin voltage where the two resistors meet. This is \$2\:\text{V}+\frac37\:\text{mA}\cdot 2\:\text{k}\Omega=2\frac67\:\text{V}\$. The Thevenin resistance is the two resistors taken in parallel, or \$1\frac37\:\text{k}\Omega\$, just as you said it is. All you now need to do is subtract \$700\:\text{mV}\$ from your Thevenin voltage and then divide that result by the resistance to work out the current. P.S. I use a different method to compute the Thevenin voltage in a divider like this: \$V_{_\text{TH}}=\frac{V_1\cdot R_2+V_2\cdot R_1}{R_1+R_2}\$. In your case, that would look like this: \$V_{_\text{TH}}=\frac{2\:\text{V}\,\cdot\, 5\:\text{k}\Omega+5\:\text{V}\,\cdot\, 2\:\text{k}\Omega}{2\:\text{k}\Omega+5\:\text{k}\Omega}=2\frac67\:\text{V}\$. It's just short-hand for the same process used, earlier.
H: How to create a VHDL function/procedure that can return true or false based on value of signals outside it? Here is the function I am trying to write: procedure ASCERTAIN_CALL_VALIDITY is begin (SESSION_CHECK_ACTIVATION_MSG_IN and ACTIVATION_MSG_RECEIVED_INT) or (SESSION_CHECK_ACTIVATION_ACKNOWLEDGE_MSG_IN and ACTIVATION_ACKNOWLEDGE_MSG_RECEIVED_INT) or (SESSION_CHECK_START_SESSION_MSG_IN and START_SESSION_MSG_RECEIVED_INT) or (SESSION_CHECK_STARTUP_CONFIGURATION_MSG_IN and STARTUP_CONFIGURATION_MSG_RECEIVED_INT) or (SESSION_CHECK_TURN_OFF_MSG_IN and TURN_OFF_MSG_RECEIVED_INT) end procedure; I want to return the value from logic processing and store inside a signal or variable outside it. Now the problem is that, functions can't access signals outside of them. Procedures can't return a value. So what do I do now? AI: Either return a value from the procedure call (which is a statement) or use an impure function: entity q231 is end entity; architecture foo of q231 is signal SESSION_CHECK_ACTIVATION_MSG_IN: boolean; signal ACTIVATION_MSG_RECEIVED_INT: boolean; signal SESSION_CHECK_ACTIVATION_ACKNOWLEDGE_MSG_IN: boolean; signal ACTIVATION_ACKNOWLEDGE_MSG_RECEIVED_INT: boolean; signal SESSION_CHECK_START_SESSION_MSG_IN: boolean; signal START_SESSION_MSG_RECEIVED_INT: boolean; signal SESSION_CHECK_STARTUP_CONFIGURATION_MSG_IN: boolean; signal STARTUP_CONFIGURATION_MSG_RECEIVED_INT: boolean; signal SESSION_CHECK_TURN_OFF_MSG_IN: boolean; signal TURN_OFF_MSG_RECEIVED_INT: boolean; procedure ASCERTAIN_CALL_VALIDITY (result: out boolean) is -- ADDED out parameter begin result := -- ADDED (SESSION_CHECK_ACTIVATION_MSG_IN and ACTIVATION_MSG_RECEIVED_INT) or (SESSION_CHECK_ACTIVATION_ACKNOWLEDGE_MSG_IN and ACTIVATION_ACKNOWLEDGE_MSG_RECEIVED_INT) or (SESSION_CHECK_START_SESSION_MSG_IN and START_SESSION_MSG_RECEIVED_INT) or (SESSION_CHECK_STARTUP_CONFIGURATION_MSG_IN and STARTUP_CONFIGURATION_MSG_RECEIVED_INT) or (SESSION_CHECK_TURN_OFF_MSG_IN and TURN_OFF_MSG_RECEIVED_INT) ; -- ADDED ; end procedure; impure function call_validity return boolean is begin return (SESSION_CHECK_ACTIVATION_MSG_IN and ACTIVATION_MSG_RECEIVED_INT) or (SESSION_CHECK_ACTIVATION_ACKNOWLEDGE_MSG_IN and ACTIVATION_ACKNOWLEDGE_MSG_RECEIVED_INT) or (SESSION_CHECK_START_SESSION_MSG_IN and START_SESSION_MSG_RECEIVED_INT) or (SESSION_CHECK_STARTUP_CONFIGURATION_MSG_IN and STARTUP_CONFIGURATION_MSG_RECEIVED_INT) or (SESSION_CHECK_TURN_OFF_MSG_IN and TURN_OFF_MSG_RECEIVED_INT) ; end function; begin process variable result: boolean; begin wait for 10 ns; ASCERTAIN_CALL_VALIDITY(result); if not result then report "result is not TRUE"; end if; if not call_validity then report "call_validity is FALSE"; end if; wait; end process; end architecture;
H: Are 7555 inputs protected internally by diodes? I've tested the inputs of a 7555 with a diode tester and I could read a 0.7V/0.6V drop between each input and GND and each input and VCC. Something that suggests that they are protected for over/under voltage by internal diodes like this These diodes do not appear on the internal schematic that is provide on page 5 of the datasheet https://www.renesas.com/us/en/document/dst/icm7555-icm7556-datasheet Am I correct in assuming that these diodes are present but have not made it in the internal schematics? or is there a way for the input current (say RESET pin) to somehow find a path to VCC and GND (given the correct polarisation of the input) via the NMOS transistors? AI: Yes, that’s generally true of many CMOS circuits (some, such as those with high-voltage tolerant inputs are exceptions). Usually the circuit is a bit more complex than just diodes as you can find by testing it (more like diodes with a few hundred ohms in series, at a minimum). Here is what they look like for inputs on the CD4007 (D2 is kind of a distributed diode): Usually exceeding the voltage by a bit is permissible if the current is limited to some number of mA before the potentially destructive SCR latch-up described in the datasheet Note #4 is triggered, but, unfortunately, the datasheet offers no guidance on how much current is permissible. (Normal operation is not guaranteed under such conditions). For example, the CD4001B has an absolute maximum input current of +/-10mA for one input at a time only. This is a bit of a cop-out. Note that the timing capacitor will often be discharged via the protection network as the supply voltage falls, violating the alleged absolute-maximum voltage at those pin(s). Adding a diode is possible, but anything that limits the voltage to +300mV compared to the supply will be very, very leaky in relation to the 20pA input current. One would expect the device to be more sensitive to ESD-induced latchup at higher supply voltages, and in fact the similar TLC555 indicates that.. Using only passive components to protect the TLC555 with a single 15-V supply is not recommended because the higher voltage allows for an unacceptable amount of current to flow through the device It will likely also be more sensitive at higher ambient temperatures where the gain of the parasitic SCR structure is higher. Note that the parasitic SCR structure mentioned in the datasheet is not unique to the 7555 but rather is present in virtually all CMOS devices (not on silicon-on-sapphire, but that's rather rare). More modern devices are designed to have higher tolerance to currents through the protection networks and substrate diodes which trigger the SCR self-destruct (think of it as the gate trigger current), the first CMOS gates were extremely prone to latch-up. Some modern gates can withstand 100mA spikes without latching up. 74HC04, for example, allows 20mA. It's anyone's guess what the 7555 is capable of, but maybe 1mA is safe enough. Maybe.
H: Does the electric potential of a closed-loop circuit maintain a constant value? This question is related to the electric potential of a circuit point, not the voltage between two points. Here is a sample circuit diagram with \$V_{circuit}=5V\$ and \$ R_{circuit}=5 \Omega \$. If we neglect the voltage meter of the left-hand side, \$I_{circuit}=1A\$ and \$V_{1,2}=5V\$. Let's consider a voltage meter that is connected to the ground and point 1. If we assume the electric potential of the ground as zero, what will be the electric potential of the point 1? In other words, what is the absolute voltage of the point 1, \$V_{1}\$? The circuit itself is valid if \$V_{1,2}\$ is maintained as a constant value \$5 V\$. Therefore, every combination of \$V_{1,ground}=\alpha+5 \$ and \$ V_{2,ground}=\alpha\$ is valid. Is there any theory that can help to determine the value of \$\alpha\$? Or, if it is impossible to determine the value of \$ \alpha \$, does it at least remain a constant value during the circuit operation? P.S. This question is originated from the pipe network analysis. Pipe network is usually analyzed with a similar manner to the electric circuit. The absolute pressure of each pipe point can introduce a safety problem, however, there seems like no theory to determine the absolute pressure, either. AI: Your question assumes there is such a thing as absolute potential. It requires that, somewhere in the universe there is a place "X" where electric charges have no potential energy at all. In other words, there exists no other place in the entire universe that charges could move to, where they they have less potential energy than they do at "X". The only reason an electric charge would move (that movement being called "current"), is because there's a point where it would have lower potential energy, and to get there they don't have to climb a potential "hill" first. Think of it like a ball on a hillside. As long as the ball is sitting on a slope towards a lower gravitational potential energy (otherwise known as "downwards") it will be accelerated in the direction where the downward slope is greatest, and will only settle when it arrives at a point where the slope in all directions is upwards. There may be a valley next door whose lowest point is below the ball's current position, but if it has to climb another hill to get into that valley and settle there instead, the only way it can do that is if it gets pushed up and over the hill separating them, by some external source of energy. There's always a valley somewhere else, whose lowest point is lower than where it is right now. How low can the ball get? Sea level? But some land is below sea level. What about the bottom of the Kola Bore Hole? What about the centre of the earth? Supposing the ball could reach the centre of the Earth without damage, what about the center of the Sun, would the ball have less potential energy there? You see why it's not reasonable to say that potential energy, and by extension voltage, can have some absolute value. It's always relative to some other place. You told us to neglect the voltmeter. In doing so, we assume that point 1 is physically disconnected, electrically isolated from Earth. In the absence of any means by which a charge at point 1 or 2 or anywhere in the circuit can travel to Earth, what you have created is a huge hill between those two locations. You've also relinquished any say you have in the question of which of the two valleys either side of the hill is "deeper", because there are other influences such as capacitive coupling to nearby mains wiring, which have suddenly become far more significant factors shaping the "terrain". Sure, the Earth may have a lower potential, or it may have a greater potential than point 1, but you'll never know. In making the measurement, by inserting a voltmeter, you provide a route for charges to move between those locations, effectively removing the hill between them. Measurement changes the voltage "terrain". By joining the two locations electrically, do we raise the Earth's potential, or do we lower the circuit's potential? It's all relative, and the question is moot. In the end, all you need to know is now the Earth and the point 1 have been joined. In your circuit, neglecting the voltmeter, the only thing you can say that has any meaning, is that point 1 is five volts higher in potential than point 2. Any other statement referring to the Earth or anywhere else ouside the circuit is meaningless (finite electrical resistance of the air notwithstanding) . When you put the voltmeter in place, you join the Earth to point 1, providing a path that charges can use to move between them. However, will any charges make that journey? Is there an potential difference to motivate those charges to flow? In the absence of any other forces at work (like electromagnetic radiation, noise, and so on), the simple answer is no. There's no reason for any charge to move from point 1 to Earth, or the other way. If you want charges to move between Earth and point 1 you have to make them move! You have to explicitly impose a potential difference, so that charges at one place find themselves on a potential "slope" that they can "roll" down. You have to do what you did to move charges through your 5Ω resistor, use a voltage source to impose a potential difference across it. If there's no such voltage source, between Earth and point 1, just the voltmeter, then there's no potential difference across the voltmeter, and the potential at Point 1 is the same as the potential of Earth. Edit: In the parlance of somebody who teaches electricity to 10 year-olds, where generally you must show them that there needs to be a closed loop for current to flow "around", that last paragraph amounts to saying that the addition of a voltage source across the voltmeter creates just such a loop. Current is now permitted to flow through the voltmeter, and the presence of a voltage source in that loop motivates the charges to move. It's quite naive, though, because it lacks many elements of the full picture. Edit2: Where the pressure analogy is concerned, there is such a thing as zero pressure, it's the vacuum, and therefore you may quote pressures relative to the vacuum if you wish. Typically though, that's not very useful, given that locally flow is dependent on the difference in pressure between two points, and has nothing to do with the vacuum, per se. I have always found the analogy between water and electricity to be wanting in a several respects, this being one of them.
H: Connecting 1-Wire DS1820 with 5VDD - needs voltage divider? I am trying to use a DS1820 Temperature Sensor on 5V VDD with an ESP32. Now I have read on different websites that I need a pull-up (4k7) for the data line but some state that it's fine to put the pull-up on 5V (picture 1). Others say I have to do a voltage divider to 3V3 on the data line first or the pull-up on 3V3 because else I get 5V on my ESP32 IO pin (picture fig 2). Or should I simply use 3V3 as VDD (pic 2 fig 1)? I would like to use 5 of these with the ability to use more if neccessary. What is right now? AI: The MCU runs at 3.3V, and thus the IO pins can only work at 3.3V levels as they are not tolerant to 5V levels, and the DS1820B can work with 3.3V supply and IO levels. The only sensible solution is to use 3.3V for DS1820B supply and pull-up voltages. Connecting the pull-up resistor to 5V is not an option. The MCU pin does have protection diodes but they are not meant to be used intentionally. So even if it works in short term, it is not fine in the long term. Using a voltage divider may also work, but why bother with such a complex solution as the resistances must be carefully designed so that the bus works properly. Using 5V as supply to sensors but 3.3V for the pull-up at the MCU is possible, but if there is a risk of 5V and data pin getting shorted, it can damage the MCU immediately if there is no other components to protect against that. So both diagrams you suggest are possible, and you can select either of them based on how you feel like using 5V or 3.3V as the supply as long as you use 3.3V for the pull-up.
H: Digital Signal Processing (Discrete signals scaling, shifting etc.) Given that x[n] = [5 1 7 9 4 3], where 5 is x[0]. Find x[n-1] , 2x[n-1] and -2x[n-1]+3. Attempting this question without any guidance from my professors unfortunately as they did not teach this bit. Searched online and also there aren't many questions like this. From what I know, (I) Having n-1 means you should shift right by 1, which means x[0] is now equals to 0? So x[n-1] = [0 5 1 7 9 4 3]? ii) 2x[n-1] is simply a magnitude scaling of part one, so is it simply just 2x[n-1] = [0 10 2 14 18 8 6]? (iii) -2x[n-1]+3. Is this simply again a magnitude scaling by -2 of part 1? Not sure how to do the +3 function though. Any help will be appreciated here :) AI: Your attempts (1) and (2) are correct. (1) \$x[n-1]\$ : represents time shifting of \$x[n]\$ to the positive side by \$1\$ sample. So, shift each sample to the right. Hence the \$0^{th}\$ sample becomes \$0\$. (2) \$2.x[n-1]\$ : represents amplitude scaling of the time-shifted version of \$x[n]\$ by \$2\$. So, multiply each sample by \$2\$. (3)\$-2.x[n-1]+3\$ : represents amplitude scaling of \$x[n-1]\$ by \$-2\$, and then amplitude shifting by \$3\$, i.e., you have to simply add \$3\$ to each sample.
H: A few questions regarding op-amp filters and DC bias I have a few questions in relation to the attached schematic.....the input signal is a sinusoid of F=1 Hz and Vpeak=2 mV. The signal passes through a band pass filter (BPF) with a gain of 143, and then is DC shifted by 7.5 V... My questions are: Why is the input shifted up by 20 mV after passing through the high pass filter (see V(n006) in the diagram). The capacitor coupled voltage divider bias was able to shift the output signal from the BPF to 7.5 V as expected, but the signal got highly attenuated (see V(n003)). What is the reason behind this and how can I shift V(n002) without it being attenuated so much? Is the capacitor and the resistors of the bias circuit playing a part? AI: Why did the input got shifted up by 20mV after passing through the high pass filter Because the input bias current of the LT1215 is about 0.5 μA and that current into 47 kΩ produces a DC offset of about 20 mV: - The capacitor coupled voltage divider bias was able to shift the output signal from the BPF to 7.5V as expected, but the signal got highly attenuated Your signal frequency is 1 Hz and that means the coupling capacitor (C3 = 1 μF) has a reactive impedance of 159 kΩ. This then drops a lot of voltage when considering that the right hand side of that capacitor (C3) has a loading resistance of 10 kΩ || 10 kΩ.
H: Coaxial Connector Termination I am studying microwave engineering at university, but I never had a possibility to try to manufacture anything that I have been learned in my courses. So I have decided to try it by myself. I have chosen a directional bridge at 10 GHz and I have managed to model it CST. But now I have encountered a selection of coaxial connectors, which seems to not be that easy. I know that the main parameters are: input impedance, frequency range. But when I started selecting some particular connector I have found out that there is something called coaxial termination, see https://uk.farnell.com/c/connectors/rf-coaxial-connectors-accessories/rf-connectors. I have been trying looking for more information on how to select the right type or what does each type name (e. g. crimp or clamp) means. However, every time I have tried to Google this I have only came to the term termination used in sense of input impedance. I have also tried to search for some directional bridges on the Internet and I have found out this one. I know I could try lookup for some similar connectors at the link above, however, I do not want to select just some random look-alike connector. I want to ask you please for help, what are additional criteria for connector selections and if there is any cheatsheet or any other kind of help which described stated connector termination types. The circuit I am trying to synthesize would not be part of any other system or component. It is just a sole directional bridge. Thank you in advance for any advice. AI: For 10 GHz with SMA plugs your best bang for the buck is to choose semi-rigid coax. These can be pre-made or make your own with semi-rigid copper coax soldered to shell. Then choose SMA PCB mount female in straight or 90 deg for your board type , e.g. PTFE (better) or FR4 depending on loss tangent. Look for frequency Ratings ($) and use calibrated torque tool to tighten without thread damage. Unfortunately there is a wide range in quality which is not easy to see from any photograph. Many are rated for 6 GHz will not perform well. Some have a bulkhead thread for metal enclosures which may improve results. Some Uni’ designs I have seen for Spectrum Analyzers even had the alum. machined enclosure flash gold plated. e.g. https://www.mouser.com/datasheet/2/643/pi-CCS-JOHN-131-6701-341-1289834.pdf https://www.mouser.com/ProductDetail/Johnson-Cinch-Connectivity-Solutions/131-6701-341?qs=CgID%252BvbxanevETJlaxk0ug%3D%3D
H: Is there any way to simplify this circuit? I am trying to get the Voltage across R2, R5. Could someone explain with detailed steps? Thanks AI: Never underestimate the power of using your eyes and redrawing stuff to remove clutter. Making stuff de-cluttered makes things simpler and allows you to find an answer. Here's a simple helping hand for what you do next: - No more clues; you should be able to solve this yourself.
H: MOSFET reverse GATE-SOURCE voltage My application is such that the current needs to be blocked or allowed in the positive half cycle using the gate triggering as shown. But in reverse voltage cycle it must pass through the load. I can understand, in the reverse mode even if the gate is NOT triggered, the body diode will allow to flow the current through the load which meets my criteria, but in that case when negative peaks occur, a voltage of -111v will be applied to the GS junction which is pretty high. As we know typically maximum GS voltage is around 20V, but how about in the reverse GS situation? is there a parameter like "reverse gate-source voltage"? if yes, what can be the average value for this parameter? AI: As we know typically maximum GS voltage is around 20V, but how about in the reverse GS situation? is there a parameter like "reverse gate-source voltage"? Data sheet used Can you see the +/- symbol next to "20"? The maximum reverse gate source voltage is 20 volts and is the same as the normal gate source voltage. but in that case when negative peaks occur, a voltage of -111v will be applied to the GS junction which is pretty high. The schematic you have shown will not permit that voltage because the gate source voltage is fixed at +9 volts by V2.
H: Is this a correct 'Bare metal' motor driver? I need to make a simple motor driver, I'm using a IRF510 and I wonder to know if this could work. The circuit - falstad simulation UPDATE I added the freewhelling diode as recommended by Tony Stewart and the design worked correctly. AI: No that’s a burnt metal driver with kV on the drain. A push pull driver or half bridge works best as the impedance is low to control the flyback voltage. But here I’ve shown with a power diode that has some benefits but still very lossy. Also I increased the Beta 20m which results here with Rdson=10 ohms to beta=5 for the Nch Fet to reduces the RdsOn to 0.6 ohms. You didn't tweak the parameters so it only rotates the motor with milli-RPM with armature R=1ohm and dumps all the heat in the FET.
H: From where can I get the impedance graph/ frequency response information of a capacitor? I want to know the self resonant frequency (SRF) of a tantalum or aluminum capacitor. Is this usually supposed to be there in the datasheet? I am wondering why it is not mentioned in datasheet since it is an important piece of information to really judge the effectiveness of a capacitor (to remove the ripple current) at a given switching frequency. Only ESR and capacitance is given. ESL information is missing completely. Same issue with multiple manufacturer datasheets. https://industrial.panasonic.com/cdbs/www-data/pdf/ABE0000/ABE0000C51.pdf https://datasheet.octopart.com/TCNT476M016R0200-AVX-datasheet-66474706.pdf AI: Most recognized suppliers of capacitors (including AVX and Panasonic) do provide extensive data on their websites regarding the important information that isn't included in their data sheets. So, go to your favourite recognized supplier (such as this one from Kemet) and look at the data under the product part number: - And scroll down to you find the graph you want: - Most decent suppliers will provide this information. Here's the detail more precisely linked to ESL: - I don't buy components from anyone not supplying this information (if it's needed in my design). Of course a data sheet is the preferred method to get this information because it will have a revision number and date but, you can easily make your own visual record of the data as I have done in the screen shots above.
H: How can I turn this motor in CW or CCW direction using a DC supply mechanically? I want to Move this small metal plate attached to the motor from point A to point B if initially, it was touching point A AND from point B to point A if initially, the plate was touching B [See the diagram for understanding] All the points T1, T2, T3, T4, T5 can be used as terminals to supply power if necessary here I want to do this using a Battery on pressing a button till it reaches either of points A or B T3 is the metal plate that can be used as a terminal through the body of the motor I prefer using the mechanical method over the usage of ICs or transistors or Arduinos, etc. Any help is appreciated. Thanks in Advanced : ) AI: You can't. You will need some components to remember the button press during the transition. prevent automatic reversal and starting the reverse journey when a contact is made. alternate the direction when a contact is made. If you are prepared to use relays then edit your question to explain that and to explain further what you are trying to achieve. You also need to cover the case when the circuit is powered up and T3 is touching neither A or B. Really you need to consider some sort of programmable logic and Arduino-style microcontroller board is an easy one to work with.
H: batteries with different voltages in parallel with diode I have done research on the internet about connecting batteries of different voltages in parallel and it makes sense that it can be dangerous because current from one battery will be flowing into the one that has the fewer voltage. This video explains it https://www.youtube.com/watch?v=44_Uj6D-cEI But what if you use diodes? For example what if I have something like this: simulate this circuit – Schematic created using CircuitLab (note the battery on the left is a 9v battery connected to a diode and the one from the right is a AA battery connected to another diode. They are connected in parallel to power some load) My 9V battery has only 500 mah of capacity. I will like to increase its capacity using a AA battery. Will that be possible? AI: You can't increase the capacity that way. The 9 volt battery will supply all the power until it is almost completely discharged, while the 1.5 volt cell will effectively be disconnected until the 9 volt battery is discharged to about 1.5 volts. When using diodes like that, the highest-voltage source will supply all the current to the load, until its voltage drops to the same as the lower-voltage source.
H: Pogo pin version of ISP cable for AVR mega8 in TQFP-32 package There are a few 6pin and 10pin pogo variants of Atmel ISP adapters that require dedicated ISP pogo pads on the PCB. There are full TQFP-32 ZIF sockets that can be used to program any AVR in that package, but it needs to be done before soldering to the PCB. However, there is something like a pogo connector that goes directly over the TQFP-32 package (after it was soldered to the PCB and doesn't require dedicated ISP pogo pads) and has a pinout that allows the mega8/mega88 (and probably some other AVRs which have ISP on the same pins) to be programmed with ISP. I had one in the past and I know it exists. But no matter how I'm searching for it I fail to find it. Does anybody know how it's exactly called or where to buy it? On the other side, it ends with a ribbon cable and ISP 10 female pin header socket. The adapter looks something like this: https://www.youtube.com/watch?v=t5unHRB2sV4 But can't find anybody selling it, I think before it was all over the ebay. AI: Hobbyking used to sell them, but it's been discontinued apparently. It looked like this: You could search to see if anyone still has it in stock, or if you have access to a milling machine with a DRO and a handful of one of the smaller sizes pogo pins it would not be hard to duplicate the business end from a small chunk of acetal plastic or other suitable material and solder a cable with heat shrink onto it. The TQFP is fairly crude at 0.8mm lead pitch so it does not require the skills of a master machinist.
H: Connecting a bulb and a buzzer onto the same output of a relay I am currently doing a project to light up a bulb and a buzzer at the same time. This circuit is an Arduino UNO which is connected to a relay to light up a bulb and the buzzer. Can a 40 watt bulb and a 240V buzzer be connected to the same output of the relay to power them as in the image below? My circuit is currently like this. How can I add in a 240V buzzer through this circuit? My Equipment Arduino UNO Resistor 100 ohm Jumper wires 40 watt light bulb Short breadboard Relay (5VDC , 10A 250VAC, 15A 125VAC, 10A 250VAC) A 240V alarm to be installed into the circuit. AI: The line is 120V, right? Add 120/240 transformer, 120V side (or 0 - 120V tap) parallel with the bulb. Connect the buzzer on 240V side (or 0 - 240V tap) of the transformer. Whatever you do, be safe.
H: Repair wiring of ATR6550 Condensor Microphone with 3.5mm Jack I own a ATR6550 Condensor Shotgun Microphone in which at some point before going to my university i forgot a battery at it leaked causing corrosion on connections in battery Section and some broke out. The Spring on -ve battery terminal also broke and the wire Marked with Number E203950 was connected to the -ve terminal. There is a wire i am not sure where to connent. Please ask if you need any extra information. Connections on +ve terminal of battery are fine. AI: As suggested by @jonk I browsed around and found a Youtube Video by KrauseHouse where he is sorting out his broken microphone.This is how you do the connection for -Ve Terminal Both the wire i knew about and the other wire I marked as coming from or going towards microphone are to be connected to -ve Terminal. I finally did it and its working great ! Soldered both wires on the end metal plate and made a new spring out of Paper Clips I had with me.Punched a hole in and soldered that spring on back of the plate.
H: Relay protection circuit I came across a relay circuit that uses two diodes and a capacitor. I know the diode across the coil (D1) is a flyback diode and that capacitor (C1) is a filter capacitor. What is diode D2 for? AI: There are many circuits that need to cause a relay to remain active for a short time after power is removed or set to zero. So, when the supply (Vin) drops to 0 volts, the charge on the capacitor will provide an energy source for the relay to keep it activated for a few more tens of milliseconds to several seconds. What is diode D2 for? If D2 was replaced with a short and the power supply (Vin) dropped to 0 volts then the capacitor would be immediately discharged and not provide a turn-off delay. I know the diode across the coil (D1) is a flyback diode and that capacitor (C1) is a filter capacitor. Do you really know that C1 is a filter capacitor or did you just make that assumption?
H: How to get signal wires to a rotating object (steering wheel)? How do engineers get electrical signals to a steering wheel? For example, in Formula 1 they have a whole screen they need to supply with data, and a normal car has to connect the buttons somehow. How would one get signals to a rotating steering wheel? AI: Most auto manufacturers use what is called a "clock spring" to carry signals from the rotating part of the steering wheel to the steering column. They use these vs. other methods like a slip-ring due to reliability concerns. Since important safety signals, like airbag deployment, come through here in most vehicles, the reliability and also complexity of a slip-ring system makes them unsuitable for this application. This is just a long coil of flexible wire that winds/unwinds as the wheel is turned.
H: Question about assembly with DIP packages I'm sending a board for assembly with a through-hole DIP-8 package with a standard horizontal lead spacing of 7.62mm. However, at their ends the pins are wide with a pin spacing of ~8.47mm. Should I modify my footprint to accommodate this wider width or leave the footprint at its default width of 7.62mm? I'm not sure how the fab assembles the DIP packages. AI: It is normal for a new unused DIP package to have its pins flared outward. The assembly house will run the chips through a lead former to bend them inward to the nominal width.
H: Ceramic capacitor, does the size matter? I am making a buck power supply and I need on the input and the output 4x 22uF @ >5V ceramic capacitor. Even at 10V I find plenty of cheap X5R MLCC in the sizes 0603, 0805 or 1206. By looking at this datasheet, I don't see any noticeable difference between these models. I guess the smaller is the better, am I right? AI: the size is less sensitive to ESR in the AVX source range you linked but the voltage rating and bias has a significant effect on reducing C value. In order to make the voltage rating greater the size must be increased so bigger can be better the chip with the greater Vmax rating in any family will have a greater C value used at 50% vmax. with a higher Vmax rating. Choices are slim with 16 or 10V @ 22uF in MLCC Also supplier choice makes a big difference and in this category, I would suggest TDK’s X6S parts with 10 mOhm ESR over AVX parts with 100 mohm for ripple reduction.
H: What type of connector for RS-485 is this? I have an Actor from 'Warema' (datasheet). I need to connect my control unit to it. The RS485 bus needs the following connectors: I was unable to find the right connector in online markets (RS, Mouser.) The company also does not want to share this information with me. Is this a standard connector or is it custom made? AI: Those connectors are known as KNX or EIB connectors. They are quite popular in smart home applications. They allow the user to insert the cable directly inside the connector: Img Src: KNX Association - KNX Basics Course There's no matching connector or receptacle for KNX/EIB connectors. Just insert the stripped cable inside.
H: What is the input impedance of the ADC the SAMD21 on the Arduino Zero? I'm looking through the data sheet and I can't find the answer. Datasheet AI: 41.10.4 Analog-to-Digital Characteristics (ADC) Table 41-23. Operating Conditions. p.1017 3.5kohm max + Cin=3.5 pF typ ___. Not measured but by design NOTE :(Rs+Rin)*Cin must settle within sampling interval , so Rin is kept low for higher speed,
H: Please help me understand the reason for using this 5V battery and 2k resistor at the gate of this MOSFET Please help me understand what that V3 source and 2k resistor are doing here. The output from the comparator U4 will form the gate voltage of MOSFET. Because of the 2k resistor, the voltage at the gate terminal should have no influence from the 5V source. I don't see why they are added in the circuit. AI: U4 is a comparator with an open-drain output. It needs a pull-up on the output to work, which is shown as V3 (5V) and the 2k resistor. It could have just as easily used V+ for the pull-up resistor voltage so long as V+ doesn’t exceed the 2N7000 maximum gate-source of 20V. The comparator output will be as follows: ‘excitation’ < GND: output high-Z, pull up to 5V, FET on ‘excitation’ > GND: output low, FET off I’m guessing that this part of the circuit is to provide a blanking / gain control function for the INA132 based on the excitation state.
H: Detect when resistor value changes without a microcontroller I have a sensor that has two pins. The resistance value of that sensor is 1.6 kiloohms. I want to detect when the resistance of the sensor changes to 300 ohms. In other words the sensor resistance changes from 1600 ohms to 300 ohms. I want to have a digital 1 (LED on) when the sensor has a resistance of 300 ohms and a digital 0 (LED off) when sensor has a resistance of 1.6 kiloohms.** The circuit below is what I have tried with a transistor. It did not work. Where should I start from? I can try OP amps with help. simulate this circuit – Schematic created using CircuitLab AI: You can use a comparator (or just an op amp with no feedback) for this. Set up two voltage dividers, one with your sensor and one with a reference resistance. The voltage in the sensor divider will be either above or below the reference divider. The comparator will convert this difference to a fixed high or low voltage. simulate this circuit – Schematic created using CircuitLab
H: How to connect a load to a relay I know the conventional way of wiring up a relay would be Option 1. However, I have seen Option 2 on the famous source of info (Google images). Is there anything wrong with Option 2 when it comes to switching an AC load using a 12V DC source? Should the live line be on the relay common terminal or one of the poles? simulate this circuit – Schematic created using CircuitLab AI: Working with mains voltages is always a safety hazard if improperly handled. In both examples, you have 240 V AC effectively present on the PCB or wherever the relay is mounted. It should be designed with proper clearances, labeling, and safety guards and so forth. (Even if it's a one-off hobby project, I always would make sure to insulate and label so that future me or anyone else is well-aware.) In both examples, the load is on the neutral line, so when the relay is switched off someone could interact with the load and be safe. (I would still open the mains breaker before touching any part of this.) Also in both examples, if the DC voltage to the relay fails or is interrupted, the way you've connected them, it would open the AC side and therefore is somewhat of a fail safe (it fails to safe mode). Something to consider is that when switches open and close, there is always a bit of arcing. The relay must be rated for the correct current and voltage. You may note that relays will be rated for a different voltage and current for AC versus DC, and this is because there is a zero-crossing with AC, which allows the contacts an opportunity to open. In a worst-case scenario, say with too much current, the contacts might "stick". It's possible, therefore, to switch off the coil side of the relay but the switched side doesn't switch. Again, this is "worst case" and is unlikely to occur as long as everything is rated for the appropriate load. Personally, I find both options functionally equivalent, but if for some reason I wanted to alternate between two loads, I would prefer to have the live line connected to the relay common - and because of this, I think it more conventional. Thus option 1 is my preference, but I don't think there's much to say beyond this being a preference.
H: What effect does a capacitor have in controlling a small DC motor? I have a small DC motor which was salvaged (shaft is 1.5", total height of case [excluding shaft] is 1.132" and it's .82" inches wide). It has no markings that I can discern, other than a handwritten "+" and "-" on the terminals. It also has a 100uF eiectrolytic can cap soldered to the + and - motor terminals. I have a B100K pot and am using a 9V battery to power the motor. When I adjust the pot, the motor goes to full power with only the center terminal of the pot connected to the + of the motor. It sounded simple to me. I've seen a related question, except in that case the motor would not turn on at all. Is there a way to do attenuate the motor's speed with the parts listed, or do I need to use an Arduino? AI: A motor is not going to work very well with any value potentiometer directly connected. A small motor can be controlled to some extent with a rheostat connection, but the value needs to be on the order of motor rated voltage divided by rated current. The rheostat power needs to be on the order of motor rated power. A 9V battery of the type with snap connectors on top is likely to have too little current capacity for most motors. I recommend that you try AA or AAA cells. Try 1, 2, 3 or more in series. That will give you several speeds. There is not likely any good reason to connect a capacitor. If the motor turns with a 9V battery, you may need about 1K variable resistance in series to control the speed with no load. Any load will further decrease the speed or stall the motor.
H: What is the maximum input voltage for the external voltage regulator of the stm32 bluepill? I am referring to the regulator connected to the USB 5V ( the 5V pin), can it handle a voltage of 12v and step it down to 3.3V for the chip? If not, then what is the upper voltage limit for that regulator? AI: For ones that use a Shanghai TX Electronics TX6211B 3.3V regulator, the input range is 3.6V to 5.5V. If you’re drawing external current from the 3.3V rail there may be thermal considerations.
H: What does it mean to say that it has "opposite polarity"? Furthermore, what is meant by "isolation of the input and output ground references"? I am currently reading the textbook Fundamentals of Power Electronics, third edition, by Robert W. Maksimovic and Dragan Erickson. In the introduction, the authors say the following: In a dc–dc converter, the dc input voltage is converted to a dc output voltage having a larger or smaller magnitude, possibly with opposite polarity or with isolation of the input and output ground references. What does it mean to say that it has "opposite polarity"? Furthermore, what is meant by "isolation of the input and output ground references"? AI: Remember that voltage is always measured between two points. Isolated: The input terminal and output terminal do not share a common reference. That is, the input voltage is measured between two terminals and the output voltage is measured between two different terminals. No pair of terminals amongst the four need to be at the same potential. simulate this circuit – Schematic created using CircuitLab Unisolated There are only three terminals, not four, because the input and output both share a terminal thus reducing the number of terminals by one. There is one input terminal, one output terminal, and one reference terminal which is shared by both the input and output terminal. So the pair of terminals that the input voltage is measured between is the input terminal and GND, while the pair of terminals that the output voltage is measured between is the output terminal and GND. An isolated converter becomes unisolated if you connect one of the output pins to one of the input pins such that they both share the same potential and become the same electrical node. simulate this circuit Opposite polarity: Only applicable if the converter is not isolated. It means that if the input potential (i.e. positive or above) is on one side of the reference potential, the output potential is on the other side (i.e. negative or below).
H: How to calculate overflow in ARM mathematical operations Consider: LDR r0,=(1:SHL:31) ; this means r0 contains = 2^31 = 0x80000000 ADDS r0,r0,r0 ; which means r0 = 0x80000000+ 0x80000000. Firstly, I know it is an overflow from the looks of it, but how do I exactly calculate it? Do I use the brute-force method, convert it to binary and sum them together using 1's and 0's? Or is there an alternative way? Also, I noticed that the flags are updated with N=0 Z=1 C=1 V=1. While I can understand why C=1, why are Z and V=1? Why is 0x80000000+ 0x80000000 a zero and has unsigned overflow too? AI: Add the two numbers together and truncate to the lower (right) 32 bits or 8 nibbles. So 0x80000000 + 0x80000000 = 0x100000000, we then truncate and we have 0x00000000 left in the 32-bit register (so the Zero flag is set- it only cares about what is in the register- or more specifically what was in the register from the last flag-setting operation) with a one in the extra bit- which shows up as a Carry flag set in the ARM. When you're adding unsigned numbers that means you have an overflow. The N flag indicates that the result from the last flag-setting operation was negative if interpreted as a 2's complement number. A 2's complement number is negative if the MSB is 1. The V flag indicates an overflow in adding when the numbers are interpreted as 2's complement (signed) numbers. One way to look at the signed overflow is that if the two numbers being added have opposite signs then overflow is impossible. If the two number have the same signs but the result has the opposite sign from the operands then overflow has occurred. No need to look at the carry. Neither, both or either flag may be set, depending on the numbers. For example 0x7FFFFFFF + 0x7FFFFFFF = 0xFFFFFFFE C = 0, V = 1, Z = 0 indicates an overflow if the addition was signed but not if unsigned. Or 0xFFFFFFFF + 1 = 0x00000000 C = 1, V = 0, Z = 1 indicates an overflow if the addition was unsigned but not if signed. The ARM core does not know what interpretation you are using, but provides both flags so you can use the one that is appropriate.
H: Which resistor should I add in place of potentiometer in XL6009 boost converter module to increase 3.7 V to 12 V? I'm using 18650 batteries with XL6009 boost converter module to increase 3.7 V to 12 V. There is a potentiometer to control the output voltage in boost converter. But can we fix the output voltage to 12 V using resistor in place of potentiometer? AI: According to datasheetspdf.com the feedback pin of the XL6009 works at 1.25V so you'll need a pair of resistors that can make 1.25V from 12V so from the hole for the middle pot pin 1K to 0V and 8.6K (from the same starting place) to the output voltage.
H: Can steel nails be substituted for the silicon steel laminate in a motor/generator/alternator? This is as diagram of a generator/alternator in which steel nails are used in place of silicon steel laminates: AI: It very much depends why you are doing this. If for a demonstration of the principle, then fine. If you are making any attempt at a practical generator with reasonable output and efficiency, then forget it. There are two different things at play here, the material, and the shape. The material. Steel nails aren't too bad as a core material. They are magnetically 'harder' than the ideal steel for laminations, so will have higher hysteresis losses than proper iron. The shape. The nails are only filling about 50% of the length of the air-gap around your rotor, so will only give you twice the field that you would have had with an air-core. You could leave them out completely and use a stronger rotor magnet. There are some commercial motors and alternators built with strong magnets and air cores for lightness and simplicity, albeit with low power densities. If you look at the diagrams of motors and alternators, it's very easy to miss the return path round the outside of the coil cores, thinking it's just the case of the motor, the one that you've not drawn on your diagram. This is air at the moment, and responsible for your nails only giving you a 2:1 improvement in field. You need to put a return path that magnetically connects all the sharp ends of the nails. Nails don't have the ideal shape to make a good connection, but if you can fill most of this air length with steel, you'll get a further perhaps two-fold improvement in field.
H: Push-pull MOSFET amplifier problem I am trying to drive a motor accelerator. For that, I am using a push-pull amplifier. Sketch below. The left part of the sketch is driven by a micro controller. It generates +/- ~19V for the MOSFETs to turn on. The right part should drive the accelerator by giving negative and positive voltages respectively. When I had it on the breadboard there was no problem, now I transferred it to PCB. Now when I try to accelerate the motor it works as expected on the first try, but later on it does not work. I measured the Rload signal after it broke down and it just gives positive pulses and no negative, it used to give both as expected. I replaced the IRF530 a few times and it worked as expected on the first try but same thing happens for the other runs and it doesn't work. What might be the problem here? Edit: I changed the schematic since there was a sketch mistake. + Sketch fix. AI: Read (1) then read (2) then read (3): - I expect that your original build had source and drain reversed hence it worked. Do you see why having 1N4148 diodes is probably pointless? EDIT following schematic update by OP: - Those diodes (the 1N4007s) in series with each MOSFET are going to cause problems with back-emfs from your inductive load and damage your MOSFETs - you want the internal MOSFET bulk (parasitic) diodes to act as inductive flyback clamps to the power rails. You don't want the 1N4007 diodes to try and block these back-emf currents. To do so is asking for trouble because where does the flyback energy go? Think about it and short them out.
H: ARM How to invoke branching? Was looking through a code with regards to loop. loopinner .... SUBS R2,R2,#1 ; j-- BGT loopinner ;in this case, loop should continue when j>1 In this case, I am not sure how BGT branches to the loopinner again. Don't I need to specify what it is greater than? Since SUBS invoke the flags, let's say if j-- becomes the value of 1. How does the branch knows what value it is greater than? AI: From ARM conditionals you can readily find that the instruction examines the Z, N, and V status flags and branches when Z=0 & N=V. Since it examines the V status flag and not the C status flag, this is clearly intended as a signed test. (This means to me that this isn't useful for unsigned loop control -- FYI.) I wrote this not so long ago, with enough information to understand what's going on. But I can summarize it here. Let's use simpler 4-bit words where there are only 16 symbols: Word Signed Subtrahend 0000 0 1111 0001 1 1110 0010 2 1101 0011 3 1100 0100 4 1011 0101 5 1010 0110 6 1001 0111 7 1000 1000 -8 0111 1001 -7 0110 1010 -6 0101 1011 -5 0100 1100 -4 0011 1101 -3 0010 1110 -2 0001 1111 -1 0000 Above, the third column is what the ALU actually uses when subtracting by that value. It simply inverts each bit before adding. (The ALU never subtracts anything. It doesn't even know how.) So, the SUB instruction actually performs addition, using the subtrahend form of the value when adding. (If you want to understand status bit semantics, it's pretty important that you master this concept as it will help you when you'd otherwise be confused.) Stamp it onto your forehead -- A CPU ONLY ADDS. IT CANNOT SUBTRACT. If you ever feel the temptation to go down the primrose path of believing that any kind of subtract instruction actually subtracts, and this includes all comparison instructions that set status bits but don't change register values, just kick yourself really hard, really fast. It doesn't happen. A CPU ONLY ADDS. IT CANNOT SUBTRACT. Everything has to be cast into addition semantics. Everything. A SUBS R2, R2, #1, in this 4-bit universe I just created, would add 1110 plus a carry-in of 1, as well. There are only 16 possibilities: Actual Operation Operation Result Operation Comparison R2 SUBS OP Z N V C ALU Semantics Semantics Z=0 & N=V? 0000 + 1110 + 1 0 1 0 0 1111 0 - 1 = -1 0 > 1 ? False 0001 + 1110 + 1 1 0 0 1 0000 1 - 1 = 0 1 > 1 ? False 0010 + 1110 + 1 0 0 0 1 0001 2 - 1 = 1 2 > 1 ? True 0011 + 1110 + 1 0 0 0 1 0010 3 - 1 = 2 3 > 1 ? True 0100 + 1110 + 1 0 0 0 1 0011 4 - 1 = 3 4 > 1 ? True 0101 + 1110 + 1 0 0 0 1 0100 5 - 1 = 4 5 > 1 ? True 0110 + 1110 + 1 0 0 0 1 0101 6 - 1 = 5 6 > 1 ? True 0111 + 1110 + 1 0 0 0 1 0110 7 - 1 = 6 7 > 1 ? True 1000 + 1110 + 1 0 0 1 0 0111 -8 - 1 = -9 E -8 > 1 ? False 1001 + 1110 + 1 0 1 0 1 1000 -7 - 1 = -8 -7 > 1 ? False 1010 + 1110 + 1 0 1 0 1 1001 -6 - 1 = -7 -6 > 1 ? False 1011 + 1110 + 1 0 1 0 1 1010 -5 - 1 = -6 -5 > 1 ? False 1100 + 1110 + 1 0 1 0 1 1011 -4 - 1 = -5 -4 > 1 ? False 1101 + 1110 + 1 0 1 0 1 1100 -3 - 1 = -4 -3 > 1 ? False 1110 + 1110 + 1 0 1 0 1 1101 -2 - 1 = -3 -2 > 1 ? False 1111 + 1110 + 1 0 1 0 1 1110 -1 - 1 = -2 -1 > 1 ? False Under Operation Result I have a column for ALU. The ALU field is what goes back into R2 after the SUBS instruction completes. (The V status flag is generated by an XOR of the carry-out of the next-to-most significant bit during the operation and the carry bit itself.) Note also that there is a single case marked with E where a signed overflow occurred. You can now easily see why the BGT instruction applies those particular status bits in exactly the way it does. Admittedly, this uses 4-bit words. But the exact same idea applies to much wider word sizes, without any change to it. Looking back at the table, you can see that the condition is True if and only if R2 was 2 or greater before the subtraction, and not 1 or 0 or smaller. Your question: Don't I need to specify what it is greater than? Since SUBS invoke the flags, let's say if j-- becomes the value of 1. How does the branch knows what value it is greater than? Let's start with the following table from the ARMv6-M Architecture Reference Manual, page A6-99: The GT condition is described as "Signed greater than". The reason the documentation doesn't specify a constant is that this test occurs after some prior instruction. That prior instruction defines the context. But without having that context, all that can be said is a general signed >. So, if the prior instruction were CMP: Then the context would be the comparison of two signed values and the BGT instruction would then mean "branch when signed operand 1 is greater than signed operand 2." But in your case, with "SUBS R2, R2, #1" the context changes and the BGT instruction would then mean "branch while signed R2 still remains greater than 0." The conditional branch instruction itself doesn't actually know what the prior instruction was. It also doesn't even know what register(s) are involved. That knowledge is left to the individual (or compiler) that is generating the instruction stream. So the branch instruction doesn't actually have a fixed constant value, nor does it have a register with which to compare against. It depends entirely upon what earlier instructions did with the status bits. It just examines the resulting status and then does what it does. It's up to you to know the context and to use it, correctly. (Speaking of which, the source code comment may be misleading or wrong.) Note Elliot takes issue (see discussion below) without evidence. He writes, "I could equivalently argue that a CPU can only subtract." He can make that argument, but it is only academic. The actual fact of the matter is that CPUs don't subtract. They add. So while this is partly my response, providing clear, unequivocal evidence in support so that even Elliot can understand the situation on the ground, today, it's also an excellent segue, too. So I'm very glad for the opportunity Elliot affords me in expanding the discussion. My first CPU was made from 7400 parts that I built and successfully completed in 1974. Newspaper reporters, to my surprise, showed up and wrote an article about it. That's my first experience. Since then, I professionally worked at Intel doing chipset testing for the BX chipset and, as a matter of relevance to teaching this subject, I've taught Computer Architecture classes as an adjunct professor at Portland State University in the 1990's, with class sizes of approximately 65-75 students. This is the largest 4-year university in the State of Oregon. I feel equivocation (expressing ambivalence about how computations might be done) about how processors generate their status bits and how they compute only leads students into unnecessary uncertainty, confusion and difficulty that can take hours, weeks, months and sometimes even years to correct. Just as teaching group-theoretic abstract algebra before getting the basics across would confuse most first-year algebra students, so also would teaching academic abstractions about how computers could do things. More students would be damaged, than helped. The simple truth is that instruction decoding emits an ADD, even when the instruction text (it's just text, after all -- it's not what is actually going on) says SUB. The decoding still issues an ADD. It just modifies some operand details along the way. Similarly, as it must also be in the case of the ARM processor, the above theory is all you need to understand how things are actually done. Please don't confuse yourself! Computers add. They don't subtract. They just fiddle around a bit to make it look like they subtract. For good or bad, it's important to understand what a computer actually does in order to understand certain status bits; what they do and why they do it. There's no other way around it. The above theoretical model is the way things work in modern processors and it is how to work out and understand the status bits, correctly. There is a good reason why things are the way they are. It's my hope that these details, above, and those I'll write below will be useful. Any failure to communicate here is mine and I'll gladly work to repair, amend, and improve this document where I may. To continue, I'll be using the ARMv6-M Architecture Reference Manual as a reference. Let's start on page A6-187 (register case): Here, you can see that they clearly document this behavior: AddWithCarry(R[n], NOT(shifted), '1') This is an addition, with operand 2 (the subtrahend) inverted and the carry-in set to '1'. Just as I wrote happens, above. (It's just how it is done.) In the case of multi-word extensions, go to page A6-173, and find SBCS: Here note that they again use addition: AddWithCarry(R[n], NOT(shifted), APSR.C) Instead of the carry-in being a hard-coded '1', as it is for the SUBS instruction, it's now using the last-saved carry-out value. In this case, it's usually expected that this will be the carry-out from a prior SUBS (or SBCS) instruction. For multi-word operations, one starts with SUBS (or ADDS) and then continues the process with subsequent SBCS (or ADCS), which use the carry-out of earlier instructions to support a multi-word operation. In multi-word addition, this carry-out can be thought of just as a carry-out, which it is. A '1' indicates that a carry occurred and needs to be dealt with. A '0' indicates no carry occurred. In the case of multi-word subtraction, this carry-out is better seen as an inverted borrow-from. A '1' indicates that there was no need to borrow from a higher-order word. A '0' indicates that there is a need to borrow. Since a SUBS instruction always sets this to '1', this means there's no borrow (the subtraction result requires an 'increment' in order to compensate for the inverted operand 2.) But for the SBCS instruction, if APSR.C is a '0', then no 'increment' takes place and this is the same as borrowing (since an increment is required, if there is no borrow.) The ADCS instruction, found on page A6-106 but not displayed here, also uses the carry-out of prior instruction executions. It doesn't invert the carry-out value or otherwise do something weird or different, just because it is an ADCS instruction. It does exactly the same thing as the SBCS instruction except and only for one minor detail -- the SBCS instruction will invert operand 2 and ADCS won't. That's it. This is one of the really cool aspects about the way these details work. Very little added logic is required to turn an addition into a subtraction and/or a multi-word addition into a multi-word subtraction. And finally, to complete the story, see page A2-35: Consistent with my descriptions of how things actually do work, above. It's really a pleasure to see how all this works. It's worth some time playing with different signed and unsigned values and, by hand, setting and using status flags. It really deepens these ideas. And they are very good ones! All of the above is about understanding the status bits and how they are generated and why they are generated in the way that they are. If you focus on what actually happens in a CPU, the rest just falls out as the necessary consequences and it's very easy to understand, then. A CPU only adds. It cannot subtract.
H: Purpose of soft iron in a permanent magnet moving coil instrument Why is the coil in a permanent magnet moving coil (PMMC) instrument wound on a soft iron core, even though we are dealing with direct current? Is it to avoid sudden increases in current, or because the iron core increases the inductance of the coil, or some other reason? On the other hand there are disadvantages such as eddy current and core loss will increase. What is the actual purpose of the soft iron core? AI: The high permeability of the soft iron core and fixed air gap to the magnets surrounding it, offers several benefits: Independent of core permeability variations relative to the air gap when high enough. No hysteresis with the DC operation of the meter. High mutual coupling of winding current flux through the air gap. High immunity to nearby magnetic fields Low aging or thermal effects as the fixed gap determines the flux and torque. Damping ratio due to L/R=T ratio when used as a low current meter such as 250mV/10k or even slower with a shunt R <1 ohm has a mechanical damping affect and since it is DC responding , Eddy current losses have no effect on steady state.
H: How do I edit the EEPROM of a K30 CO2 sensor? EDIT - Corrected code is at the bottom of the OP. Background While working on a circuit to log carbon dioxide with a K30 CO2 sensor using an Adafruit Data Logging Shield, I ran into a problem. The I2C address of the RTC on the shield has a collision with the address of the CO2 sensor. The address of the RTC is baked into the silicon and cannot be changed, but the address of the K30 sensor is mutable. According to the I2C guide (see PDF in I2C/I2C_comm_guide, zipped PDF warning!) the I2C address of the sensor can be any value: 0x00 to 0x7F Precedent This appears to be a common problem. I have found multiple threads (see a, b, c, d, e, f) which have attempted to solve this challenge. Most either fizzle with positive results or suggest using a different interface. YET, according the the datasheet, it should be possible to hack this change to the EEPROM. Workarounds I Am Avoiding K30 RX/TX - Since the K30 has both I2C and RX/TX pins, why not switch to using the RX/TX and skip this whole mess? The sensor is mounted on a breakout board with many other parts and a protective shield epoxied onto it. I would like to avoid digging into the hardware to reach these pins. GasLab software - the manufacturer provides the GasLab software to hack the sensors using a GUI over USB. Unfortunately, it only works for Windows. Choose a different RTC - I need something quick and easy to log values as I am time constrained. I don't want to reinvent the wheel when the Adafruit shield works so well. Address 0x7F - According to the datasheet, I should be able to call all K30 sensors using this address, however I could not get it to work in practice when in the same circuit as the RTC. My Hardware I am running an Arduino Uno clone wiring the I2C to A4 and A5. The I2C lines have 2.2K pullups. The K30 is running at ~9V. Sanity Check Running the Arduino code provided by the manufacturer, I am able to read the sensor response, and it makes sense. Code to change EEPROM #include <Wire.h> byte CheckSum(byte * buf, byte count) { byte sum=0; while (count>0) { sum += *buf; buf++; count--; } return sum; } void setup() { Serial.begin(9600); Wire.begin(); delay(1000); byte changebuf[4] = {0x31, 0x00, 0x69, 0x00}; changebuf[3] = CheckSum(changebuf, 3); Wire.beginTransmission(0x68<<1); for (size_t i = 0; i<sizeof(changebuf); i++) { Wire.write(changebuf[i]); } Wire.endTransmission(); } void loop() {} The message is 0xD0, 0x31, 0x00, 0x69, 0x9A. Bytes are: The default address shifted left by one (I have also tried plain 0x68) Command to write 1 byte to EEPROM Address in EEPROM to write Payload to write Checksum These values are based on the datasheet. After running this, I power cycle the device so the EEPROM values propagate to the RAM per the datasheet. Observations After running the above code, the address is not changed. The device still responds to the original default address 0x68 and fails to respond to the new address 0x69. The Question Restated Why is my attempt to command the EEPROM of the K30 to change the value associated with the device I2C address failing? Is there something wrong with the byte sequence I send? SOLUTION - Per accepted solution, I missed the obvious extra LSB in the byte string. I am now able to change the address. Here is the complete corrected code to achieve this: #include <Wire.h> byte CheckSum(byte * buf, byte count) { byte sum=0; while (count>0) { sum += *buf; buf++; count--; } return sum; } void setup() { Serial.begin(9600); Wire.begin(); delay(1000); byte changebuf[5] = {0x31, 0x00, 0x00, 0x69, 0x00}; changebuf[4] = CheckSum(changebuf, 4); Wire.beginTransmission(0x68); for (size_t i = 0; i<sizeof(changebuf); i++) { Wire.write(changebuf[i]); } Wire.endTransmission(); } void loop() {} AI: The eeprom address is two bytes. You only supplied one. The eeprom address you want is 0x00 0x00
H: Identify SMD voltage regulator with top marking: V1TF I've a circuit powered by a 3.3 V regulator. The regulator is a SMD one, with this logo and code on its surface: footprint is SOT23-3 or very similar. I need to know the valid range of incoming voltage. Unfortunately, I do not find any information about the V1TF marking code nor recognize the logo. Any hint about how to continue? The pinout is: where Vout is 3.3v. AI: A manufacturer with a matching logo is Nanjing Micro One. (Here's a link showing their logo on LCSC.) Updated: Further investigation shows that your device with top marking V1TF is the Nanjing Micro One ME6209A33M3G 3.3 V LDO, which has a maximum input voltage listed in its datasheet (both maximum operational and absolute maximum) of 18 V. The top code is V1xx where the xx varies (e.g. batch number / manufacturing date or similar) and V1 is the device identifier. Explanation: After the OP managed to find a photo from an AliExpress seller claiming to show the Nanjing Micro One ME6209A33M3G LDO with top code V1RC (though no manufacturer's logo), I found others claiming to sell the same device with the correct logo and these top codes: V1RC here V1SE here V1Q1 here and this seller even says in Chinese, that the top code starts with V1
H: Transistor base current A while ago I posted on here for some help with my circuit design. I received some great advice which thoroughly improved the original. I made the changes to the breadboard design and the circuit ran well. Then, on one test I left the relay activated for a few minutes by leaving sw1 closed. After a while I found the 2N2222 began to get hot. I thought maybe the resistors R5 4.7k and R6 1k are stopping the transistor being saturated, so I swapped the values round making R5 1k and R6 4.7k. When I ran the circuit again I saw the voltage drop across the transistor was less and it did not get warm at all. The relays coil resistance is 100ohm and its a normal 12v relay which draws 120mA. The 2N2222 is rated for 800mA so there should be headroom. Could someone advise if I have the right base resistor setup? The original idea behind the potential divider R5 and R6 was to limit the voltage into the base, as I read in the datasheet the maximum emitter base voltage was 5V. I think I'm misunderstanding something here. This is as the circuit stands with the resistors in the swapped position so the 2N2222 runs cool. AI: The AS358 is not a rail-to-rail output; the maximum output is VCC-1.5. Some back of the envelope calculations with a VBE of 1.2V and hFE of 50 indicates that a base resistance of 4.7k is too high for the 120mA coil. The way you have it with 1k is fine. You should expect about a 7 degree Celsius rise in temperature assuming your 2N2222 is in a TO-92 package.
H: Help in explaining op-amp voltage follower behavior In the following circuit, I'm having a hard time figuring out the reason for the output. The op-amp is the OPA1662, powered at 3.3V. It is rail-to-rail and unity stable. When R?/Rth is not installed, the voltage on the positive input is 3.3V but the output is at 2.45V. My understanding is that the op-amp will try to put out enough current at the output to keep the + and - at the same potential. The short-circuit output current is over 30mA and the output voltage seems to be independent of Ro (i.e., the output is the same even if Ro=100k or even open). So why is the voltage not 3.3V (or at least near that)? When the resistor R?/Rth is installed results are as expected, the output tracks the input. I have run various Spice simulations and get the same results I'm getting on the physical circuit - changing the op-amp will get the output closer to 3.3V but I'm trying to understand what is going on here. I considered the bias current but the output voltage seems to be immune to the value of R28. AI: You are exceeding the opamp's input common-mode range. Although the output of that particular opamp can get close to the positive supply rail the input has limitations and may not be able to get closer than 1 volt. Opamps that guarantee the input will still function when at the positive supply rail are usually described as "Rail-to-rail input capability". Similarly, the output may have rail-to-rail ability (the OPA1662 does) but this does not apply to all opamps. Not all opamps behave well when the input voltage range is exceeded, their gain can go negative or they may latch-up or even be damaged. Most modern opamps are well-behaved under these conditions even though they do not function correctly and their operation returns to normal when the voltages are in the allowed region. Here is the relevant section of the datasheet. OPA1662 datasheet
H: Modding popcorn popper: shut off heater while keeping fan on So, I'm trying the age-old tactic of roasting coffee with a popcorn popper, and while it works, I would like to have better control over the heat applied in order to prolong the roasting. I've seen other mods to popcorn poppers, but the schematics for this one are bugging me. I've got a bifinett 1200w popcorn popper, and to the best of my ability, this schematic represents how the internals are wired (I'm not an electrical engineer so I might be wrong). Note: I'm missing a capacitor connecting the two AC wires. This is an image of the "Fancy Bridge Rectifier", which connects to a motor working as a fan: And this is a picture of the heating element, with the labeled HL, HT, and HR points: I would like to accomplish two things, both related to controlling the heat while leaving the fan always runnning: Add a switch to, at least, the main coil, so that I can control the heat. This would be my main objective. However, from the schematic, I don't see how I can turn off the main coil without turning off also the fan and secondary coil. Plus, it seems to me that the main coil lowers the voltage that is passed on to the rectifier and secondary coil, so I don't see how to go around it. Later I would like to control the main heating element with a solid-state relay so that I can control the temperature through an ESP8266 I have that is measuring temperature with a thermocouple positioned inside the heating chamber. This one I have no clue how to wire up, but this is also more for "future work", right now I want to accomplish 1) first. AI: This popcorn popper uses essentially the same circuit as many hair dryers- the elements form a dropping resistor for the DC fan, so you can't turn the heater off without affecting the fan. Image from here. Ignore VD and the switch, that's for the "low" position. What you could do is provide a separate DC supply for the fan motor and disconnect it from the bridge rectifier assembly. To avoid affecting the remaining circuit you could replace the fan with an equivalent resistor (that may not be necessary but it's safer since the short element may otherwise get too hot). To do this you need to figure out the fan voltage and current rating. It may be marked on the motor, but if not you could (carefully) measure it. For switching the remaining elements you could use a relay or an SSR. It's a trade-off the relay will have limited life (but for a coffee roaster maybe that's not a big deal), and the SSR will require a big heatsink and/or a fan of its own. You could also use a relay and a resistor to switch a triac which is pretty much the same as an SSR. It wouldn't hurt to add another thermal safety fuse, especially if you're depending on firmware to turn the fan on whenever the heater is on. The unit will have been designed, tested and certified not to cause an unsafe situation if the fan motor fails, but you're increasing the chances of that if you use firmware, and making other modifications so extreme care is called for. The current arrangement ensures the fan is always powered whenever the heater is on. Edit: DPDT selection (CAUTION, this requires one side of low voltage supply to be tied to the mains). It would also be possible to use a somewhat higher (like 1.5V more) voltage and switch the input to the bridge rectifier), but I have a suspicion the fan motor voltage will turn out to be something convenient like 12V at 5-10W. simulate this circuit – Schematic created using CircuitLab
H: Procedure is unable to find function since it is defined after the procedure, how to fix this? In my VHDL entity, I have declared some procedures in the header of the architecture i.e before the keyword begin. Some procedures are calling functions. The functions are actually defined in a block after the block that define the procedures. When I compile the code, I get "Unknown identifier" error. I could just move the function definitions above the procedure definitions i.e cut paste the block of code or just shift it up in the source file. However, there must be a better way around this. How do I write the code so the procedure knows that the function it is trying to call is actually defined after the procedure definition? AI: If the functions are defined in blocks inside the body of the entity (between the keywords "begin" and "end") then they are not in scope in the declarative part of the entity (between the keywords "is" and "begin") where you are defining the procedures. You need to move the function declarations into scope somehow. The most obvious way would be to put them in the declarative part of the entity declaration before the procedure declarations. entity foo is end entity; architecture bar of foo is --declare functions here --declare procedures here begin X:block --don't declare functions here because procedures can't see them. begin end block X; end bar; I don't see any way to solve this other than to move the function declarations into scope at the point where the procedures are declared. You could alternatively try defining the functions in a package an then referencing the package with a statement like "use work.my_package.all".
H: Can we use Zener diode as battery low voltage cut off? Suppose we have 150 watt and 300 watts portable photovoltaic system with 13.5V battery (50Ah) and we want the low voltage cut off point to be set at 10V. Can we achieve this simply by using zener diode? If yes, then how? AI: Case# we have 150Watts & 300Watts portable PV System with 13.5v Battery (50Ah) and we want the low voltage cut off point to be set at 10v. Can we achieve this simply by using zener diode...? No If yes, then how...? A zener doesn't make a good reference by itself, and it certainty can't control an output. You could use a zener diode as part of a voltage reference circuit. You could then compare the battery voltage to the voltage reference and turn it off when it dropped below, using a relay or high-side MOSFET. But that's all rather more than 'a zener diode'. Here's a circuit from a few years ago that does the job for a 12 V supply. original posts here . Alter the resistor divider values R2/3/4 to get a different threshold voltage. With the on/off buttons, it also doubles as the load switch. It uses the voltage referencing function of the TLV431 to set the output trip voltage. It uses M1 and IC1 in a 'thyristor' configuration to form the on/off memory. simulate this circuit – Schematic created using CircuitLab If we want to configure this circuit for a 10 V cutoff, then we'd choose components depending on how accurately we wanted it. The main consideration is the reference voltage of the TLV431. That's nominally 1.240 V, but can be as far out as 1.194 to 1.286 V over temperature and for the lower grade versions. We also need to make an allowance for the bias current, which is typically 150 nA, but can be as high as 300 nA. If we allow a 10 k impedance at R3, that means a typical offset of 1.5 mV due to bias current, insignificant compared with the possible variations in the reference voltage. If we want to omit R4 and set R2/3 for the nominal 1.242 V (including the 2 mV for the bias current) at 10 V, then we need a resistor ratio of 8.758/1.242 = 7.0515:1. That can't be made from any two E24 values, but it's possible to use three resistors to get close. R3 = 10k, R2 = 70.515k = 68k + 2.4k gets within the 1% tolerance of typical resistors. You could fine tune the ratio further in testing by adding further resistors (small ones in series or large ones in shunt) If you want to include R4 to adjust the +/- 50 mV tolerance of the TLV431, then we want at least 1.19 to 1.29 volts across R4. Use for instance R3 = 10k, R4 = 1k, and R2 = 72.5k, though given the adjustment, 75k will probably do. It's good policy to keep the adjustment range as small as possible. If you only have a large value adjustable resistor to hand, it's possible to reduce its range by putting a small value resistor across it to reduce the voltage available to it.
H: Role of CAN bus protection circuitry Here is CAN protection circuitry as suggested by MORNSUN in their datasheet of CAN transceiver with integrated power. I have few questions regarding few components used there: What is the purpose of R3 and C1? What is the purpose of R1 and R2? Shouldn't the GND of different nodes be connected together, say with the shielding section of a twisted cable? What is the purpose of D1 and D2? Why aren't TVS from CANH and CANL to GND recommended? AI: I will answer some of your questions: What is the purpose of R3 and C1? You have a digital circuit that its ground (i.e. digital ground) should/can not be connected to the earth (chassis ground) directly. And you have high-speed signals flowing around which may cause EMI problems due to high-speed switching. To manage this and to prevent other systems connected to your circuit to be affected, you want the excessive noise to go to the earth. Hence the capacitor C1: Provides the shortest path from digital ground to earth at very high frequencies (i.e. noise) by its nature. C1 is open at low frequencies or DC, but you want a path from your digital ground to the earth. Hence the resistor R3. 1M/1n pair is widely used for that purpose (e.g. ethernet chassis to earth). What is the purpose of R1 and R2? They are protection resistors. Since there are TVS diodes across the CAN lines, excessive clamping currents may flow through them when there are spikes (e.g. lightning) 1. Those resistors simply limit the clamping current so that the bus does not be latched up by the transceiver by any chance. Their values should be low enough not to affect the line impedance (120 Ohms). 1 In some applications where the spike immunity requirement is higher, MOVs are used instead of TVS diodes. What is the purpose of D1 and D2? I don't know. I've never seen such an implementation. Hope someone answers. Why aren't TVS from CANH and CANL to GND recommended? Who says that? There are many applications having uni- or bi-directional TVS diodes from CAN lines to GND.
H: How to disassemble ESP8266 code written in Arduino IDE? I want to see the assembly code of my code written in the Arduino IDE. What I've tried is: Sketch > Export compiled binary Then, I found that I have a gcc toolset in my ESP8266 directory in: Documents\ArduinoData\packages\esp8266\tools\xtensa-lx106-elf-gcc\2.5.0-4-b40a506\bin> And there I have a xtensa-lx106-elf-objdump.exe So I tried to run this objdump on the outputted compiled binary, but I got: PS> xtensa-lx106-elf-objdump.exe -D <path/to/binfile> file format not recognized AI: -D is for disassemble -b bin tells objdump to expect a bin file There may be ways to inject compiler/linker directives in Arduino, but I would not know. Platformio certainly does allow this, so you could get the asm as emitted from the compiler.
H: What is a 44h command? I am reading the datasheet of a devive and don't understand the format of the commands. They are talking about 44h and BEh commands. I assume the h just stands for hex. If so, I don't understand why they don't write 0x44 or 0xbe to make it clear. AI: I assume the h just stands for hex? True. If so, I don't understand why they don't write 0x44 or 0xbe to make it clear. the 0x prefix originates from the creators of C (just to distinguish from decimal numbers), so it's widely used in C and C-derived languages. h suffix originates from intel-derived assembly languages. There's nothing magical.
H: PID: Should one introduce limit to only some parameters? I am working on a heating control for a hotplate using PID. I managed to make my system work as I want it to be with the PID values I use. My heating goes from 0-100%, but I impose a limit to the Integral term, I do not let it go beyond 100% and below 0%. All my other terms (the Proportional and derivative) have no limit (they can go as high or low as they want, even negative). I decided to limit the Integral in order to limit the 'memory' my system has, since : It can lead to overshoot since my system takes too long to heat up, and then it becomes large. It becomes so large it ignores the P and D. I could just reduce the Ki, but I tried just limiting the I factor between 0 and 100 and It worked just fine. Of course, the final PID is limited to 0<PID<100. So, if I really want to use the PID formula "the mathematical way", should I limit also the P and D to 0-100% or should I not impose any limits to any of the P,I,D and just limit the final PID value between 0 and 100%? (I think the last one is the more 'mathematical' way, since PID formula does not have any limits on its own, and then I just impose my real-world limit to the final PID value) AI: There are quite possible variants of PID. I can point you to two mostly used strategies, I do use: incremental algorithm: it calculates the tiny increment y = y + dy, where dy is a function of P, I and D. When you limit the output, you get the new output in the next recursion from the last point. link Åström anti-windup PID with integral tracking. It's very similar to a classic PID with separate calculation of terms P,I and D, but then you have one additional tracking integrator that adjusts the I term, so that the output becomes close to the limit value. link You can do whatever you want, but I would first read some scientific articles on how to do it the best way.
H: Trouble using the UART with Raspberry Pi Pico I'm making a remote controlled machine using a Raspberry Pi Pico to drive the motors and read some sensors, and a Raspberry Pi 4 to send commands to the Pico via serial and host the web interface. I'm working on sending and receiving commands from the Raspberry and for now I'm stuck with this code: #include <string.h> #include "pico/stdlib.h" #include "hardware/uart.h" #include "hardware/irq.h" #define UART_ID uart0 #define BAUD_RATE 19200 #define DATA_BITS 8 #define STOP_BITS 1 #define PARITY UART_PARITY_NONE #define UART_TX_PIN 0 #define UART_RX_PIN 1 static int chars_rxed = 0; char uCommand[32] = {0, 0}; void on_uart_rx() { char tmp_string[] = {0, 0}; while (uart_is_readable(UART_ID)) { uint8_t ch = uart_getc(UART_ID); tmp_string[0] = ch; strcat(uCommand, tmp_string); if(uart_is_writable(UART_ID)){ uart_putc(UART_ID, '-'); uart_puts(UART_ID, uCommand); uart_putc(UART_ID, '-'); } chars_rxed++; } } int main(){ uart_init(UART_ID, BAUD_RATE); gpio_set_function(UART_TX_PIN, GPIO_FUNC_UART); gpio_set_function(UART_RX_PIN, GPIO_FUNC_UART); uart_set_hw_flow(UART_ID, false, false); uart_set_format(UART_ID, DATA_BITS, STOP_BITS, PARITY); uart_set_fifo_enabled(UART_ID, false); int UART_IRQ = UART_ID == uart0 ? UART0_IRQ : UART1_IRQ; irq_set_exclusive_handler(UART_IRQ, on_uart_rx); irq_set_enabled(UART_IRQ, true); uart_set_irq_enables(UART_ID, true, false); uart_puts(UART_ID, "\nOK\n"); while (1){ tight_loop_contents(); if(uCommand[0] != 0){ uart_putc(UART_ID, '/'); uart_puts(UART_ID, uCommand); uart_putc(UART_ID, '/'); } } } My idea was to take the command sent via serial during the interrupt and place it in a charset, then parse it and execute it externally. Trying it, I notice that it never enters the if inside the while and it doesn't 'fill' the 'uCommand' charset completely but only a few characters compared to the ones sent. I hope my question is not off-topic. UPDATE I am extremely disconcerted. The following code seems to work... but... If I remove the if with is_uart_writable coding and its content it doesn't work. Does anyone have any idea why? #include <stdlib.h> #include <string.h> #include "pico/stdlib.h" #include "hardware/uart.h" #include "hardware/irq.h" //DEFINES #define UART_ID uart0 #define BAUD_RATE 19200 #define DATA_BITS 8 #define STOP_BITS 1 #define PARITY UART_PARITY_NONE #define UART_TX_PIN 0 #define UART_RX_PIN 1 #define LED_PIN PICO_DEFAULT_LED_PIN static int chars_rxed = 0; volatile char uCommand[32] = {0, 0}; void on_uart_rx(void) { char tmp_string[] = {0, 0}; new_command = true; while (uart_is_readable(UART_ID)) { uint8_t ch = uart_getc(UART_ID); tmp_string[0] = ch; strcat(uCommand, tmp_string); if(uart_is_writable(UART_ID)){ uart_putc(UART_ID, '-'); uart_puts(UART_ID, uCommand); uart_putc(UART_ID, '-'); } chars_rxed++; } } int main(){ uart_init(UART_ID, BAUD_RATE); gpio_set_function(UART_TX_PIN, GPIO_FUNC_UART); gpio_set_function(UART_RX_PIN, GPIO_FUNC_UART); uart_set_hw_flow(UART_ID, false, false); uart_set_format(UART_ID, DATA_BITS, STOP_BITS, PARITY); uart_set_fifo_enabled(UART_ID, false); int UART_IRQ = UART_ID == uart0 ? UART0_IRQ : UART1_IRQ; irq_set_exclusive_handler(UART_IRQ, on_uart_rx); irq_set_enabled(UART_IRQ, true); uart_set_irq_enables(UART_ID, true, false); uart_puts(UART_ID, "\nOK\n"); while (1){ tight_loop_contents(); if(uCommand[0] != 0){ uart_putc(UART_ID, '/'); uart_puts(UART_ID, uCommand); memset(uCommand, 0, sizeof(uCommand)); } } } AI: This looks like the classic "missing volatile" bug. You should have volatile char uCommand[32] = {0, 0};. I also don't see where you reset uCommand after the first reception. In addition void on_uart_rx() is obsolete style and might be the wrong type if the callback expects void func (void). Replace empty parenthesis with (void).
H: How to understand EIRP, PSD for a given bandwidth? I have troubles to understanding what is the meaning of parameters for transmitting power of RF-signal. So for RF signal in the same frequency band and same application, on one hand I see the max. allowed mean power is e.g 50dBm. On the other hand I see another max. allowed power spectral density is e.g -3dBm/MHz. This really confuses me. So the questions are: What is the relation between mean power and power spectral density? How to convert one to the other ? For e.g. if my device uses a 2GHz bandwidth, how do I know how much power the device is allowed to transmit ? How to calculate it ? Thanks very much. BL AI: If your Power Spectral Density is -0.3 dBm / MHz that's a real power of 0.5 milliwatts per MHz hence, if your bandwidth is 2000 MHz, that's a total permissible power of 1 watt across the whole width of the spectrum you are allowed to use. If you are allowed to use a signal of 50 dBm (100 watts) AND, you must simultaneously ensure that it doesn't exceed the PSD of -0.3 dBm / MHz, you have to consider the signal bandwidth. If the bandwidth is 5 Hz, that's 100 watts in 5 Hz and, equivalent to 0.5 milliwatt spread over 1 MHz.
H: STM32 and dreaded HAL: something wrong with only using HAL for basic setup and skip it for the application part? Many have a hate relationship with ST's HAL. I have a like/hate one and was wondering if my approach will bite me later on. I like the peripheral and clock setup of current CubeMx. The code generated is so much more readable than my own bare metal stuff and it is complete all the time. And I believe it will help me with porting between different models. Example of code I like: RCC_OscInitStruct.HSIState = RCC_HSI_ON; RCC_OscInitStruct.HSICalibrationValue = RCC_HSICALIBRATION_DEFAULT; RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON; RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSI; RCC_OscInitStruct.PLL.PLLM = RCC_PLLM_DIV1; RCC_OscInitStruct.PLL.PLLN = 8; RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2; RCC_OscInitStruct.PLL.PLLQ = RCC_PLLQ_DIV2; RCC_OscInitStruct.PLL.PLLR = RCC_PLLR_DIV2; if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) { // Error_Handler(); } and for instance: static void MX_LPUART1_UART_Init(void) { hlpuart1.Instance = LPUART1; hlpuart1.Init.BaudRate = 209700; hlpuart1.Init.WordLength = UART_WORDLENGTH_8B; hlpuart1.Init.StopBits = UART_STOPBITS_1; hlpuart1.Init.Parity = UART_PARITY_NONE; hlpuart1.Init.Mode = UART_MODE_TX_RX; hlpuart1.Init.HwFlowCtl = UART_HWCONTROL_NONE; hlpuart1.Init.OneBitSampling = UART_ONE_BIT_SAMPLE_DISABLE; hlpuart1.Init.ClockPrescaler = UART_PRESCALER_DIV1; hlpuart1.AdvancedInit.AdvFeatureInit = UART_ADVFEATURE_NO_INIT; It really works all the time. And it is only executed at startup and even then, the compiler makes this quite efficient (does it?). But what I really hate is HAL overhead during running an application. E.g. getting a single byte from a UART after its interrupt using HAL. I rather do that directly. My question: what would be wrong with just using CubeMx/HAL for the configuration part such that that remains so readable as it is in the examples above and not using it any further at all? I figured that if you delete HAL_Init() and comment out the error handlers for the clock and peripherals setup that are triggered by all kind of checks of HAL's systicks, things work pretty well. But question is: will it byte me at the end? AI: You usually get the bad with the good. In a recent project I had to read pins statuses even though they were set as outputs. This is where the bare metal stuff comes in handy. Another aspect is speed and handling interrupts. Handling multiple external interrupts that may be spaced very closely apart is best done with bare metal purely because it’s fast. I believe any function that is not time critical can be implemented using HAL and for everything else there is bare metal. I don’t know much about this, but I think if you are building software for industries such as medical, aerospace etc HAL would not pass qualification.
H: Code Composer Studio problem with fread() on c5502 chips/windows 10 Problem: fread does not seem to work for TI tms320vc5502 cpus using any code composer studio on windows 10. I have tried with multiple installations to confirm this, I am currently using CCSv6. TI does not support the product anymore, so they have not been able to offer help. Description: When using fread, it always returns 0 and populates the buffer with garbage. If I switch to another project with a c6713 chip instead of c5502, it works fine. The file is certainly where I am pointing fopen to. Perhaps fopen is the real culprit, but the error manifests with fread? fopen does not return an error. None of the f operations return an error using ferror. code: unsigned int bin_dat[1]; unsigned int end_of_file; FILE *fid; fid = fopen("C:\\file1.bin", "rb"); end_of_file = fread(bin_dat, 1, 1, fid); while(end_of_file != 0){ end_of_file = fread(bin_dat, 1, 1, fid);//fread will return 0 at this line //some operation } Does anyone have experience with addressing this? What was your workaround? AI: A few things first; It's been sometime since I used c5502. My CCS is updated from v6 to v9, with some pain. I had to touch a few library calls while upgrading. Some of my processors are no more supported in newer CCS updates. I assume you are using Ti's file system. I had a similar problem of "deceiving responses" from the file system. I agree with you about your question belongs to "low level". So, here is my opinion: "C:\file1.bin" and "FILE *" looks like your code is trying to keep some compatibility with a 'host' platform. Check if "FILE *" is associated correct with the library. It seems I do not use that (I need to look into more). Though you see no error at fopen(), double check mounted "drive name" is "C:". Further, you can trace into the Ti's file system (mine was copy of ELM-CHAN or something like) and see it opens correct, where it reads (SD card, or USB?), what it reads. Edit, around the "question belongs to low level" As an EE, when my design makes software engineers lose hairs, dragging a critical project; Instead of exchanging hot conversations in the meeting, instead of trying to teach software engineers EE stuffs, EE is the right person to probe the hardware using a debug tool. And, the EE, who designs the system, needs to know the low level mechanism of the firmware/software. It belongs to EE area.
H: How to design a parallel-able lab power supply? I want to design a power module that can be configured in series or parallel if the power sources are isolated. The problem is I don't know how to implant master/slave function, at first I was thinking to add a diode to the output of each supply but then I can't compensate for the diode voltage drop because moving the feedback after the diode is point less. simulate this circuit – Schematic created using CircuitLab How the power supplies in the market do it? do they disconnect the slave op amp output and drive the slave transistor with the master op amp? Can someone please explain how master/slave in lab power supplies works? AI: When paralleling supplies (assuming that the outputs of both are close to each other), a small amount of resistance needs to be added between supplies. Why? No supply is perfect and small variations in voltage or voltage offsets can cause current to move from one supply circuit to the next. (for example, even if you set both circuits to 10V, one may be outputting 10.1V and the other 10V from amplifier offsets and component variability) The offsets lead to problems with the paralleled circuits not sourcing current evenly, and could lead to instability or overheating among other problems. How the power supplies in the market do it? What you have above is somewhat like an LDO (Linear Dropout Regulator). The way that you parallel those is with resistors between them. Source: https://www.analog.com/en/technical-articles/paralleling-linear-regulators-made-easy.html There are also schemes that are more related to switching circuits which have a master/slave control loop. Also keep in mind when paralleling switching circuits one also needs to worry about syncing or not syncing the feedback loops so they don't interfere with each other. Note: One problem in the diagram above is the voltage is different on each supply circuit (one being 5V and one being 10V) which would cause issues for the circuit (so you may want to change the diagram).
H: Can leaded BGA chips be reflow soldered with lead-free process? We have a board with two BGA chips. Due to the current shortage of many parts, one of the chips is next-to-impossible to find; except that we found a supplier with a good stock of the non-RoHS / leaded version of the chip (which is a discontinued product, but this supplier happens to have a pretty good stock of them). Problem is: the other BGA chip is only available in lead-free balls. I know that using leaded process for lead-free BGA chips is not acceptable, because the solder balls of the BGA will not melt and the joint will be unreliable. My question: is it ok to solder leaded BGA chips with a lead-free (thus, higher temperature) process? For context: This is for a research project; the boards will be deployed in indoors environments (most likely places with air conditioning, etc.) We do not need to worry about long-term reliability (the boards will be operating for less than a year). Also, the boards are not part of a safety-critical or mission-critical system; sure, we want them to work reliably for the purpose of the quality of the research data; if a small fraction of the boards fail, it is still acceptable. AI: I would talk to your assembler and see if you could use two different temperature processes. Do the Lead free profile first (that goes to a higher temperature) then after those parts are done solder the leaded parts on with a leaded temperature profile. This satisfies the requirements of both. (you don't need to worry about stenciling as BGA's have solder balls) Another option would be to have the lead free BGA's installed with a IR rework station (which also support temperature profiles) which is more difficult but possible. At the end of the day it would depend on who is doing the rework and what they are capable of and their experience with BGA parts.
H: DC Motor Overvoltage operation with current regulation I want to drive a DC motor (linear actuator) rated at 12V with a 24V DC supply. Will using a driver IC that does current regulation (e.g. MP6515) be enough, or would I need additional measures in place? All other components would be properly sized (capacitors, etc.) DC Motor Overvoltage Operation suggests that using 24V instead of 12V would be ok from an insulation perspective, and I know stepper motors in 3D-printer stepper motors are regularly run at voltages much higher than rated. I'm just unsure if I miss anything that would be different for DC motors. I don't aim at getting more power or torque, I just want to use existing motors with another power supply needed for different reasons. AI: Depending on cable capacitance, the driver losses may cause an increase in temperature rise with twice the supply voltage, so heatsinking may need attention. Otherwise, the current in the outputs are limited using a constant off-time control circuitry of 16 us typ. Thus, depending on the actuator dI/dt=V/L on-time with this hysteresis, will promote a PWM astable activity.