texts:
I have two e-bike batteries. One of which i am using to power my ESP32. Now i want to switch to other battery when my batt-1 is low. I am switching battery using relay. But doing so, I suspecting i might reset esp32 and hence state will be lost. I need solution around this problem.

P.S. Can not give external power supply to esp32


texts: Difference between the terms voltage generation and power generation

texts:
What exactly is the difference between 'generating a voltage' 'generating a current' and 'generating power'? Are all these terms linked in some way? And for which situations do I use each term?
For example, do we say a solar panel generates power or voltage when radiated by sunlight?


texts: How one can increase voltage given by a battery?

texts:
I want to know if there is a way of increasing a voltage drop by a given battery at a time.

So, I have this hp 50g graphic calculator here which uses 4 AAA batteries and they last like 4 hours of constant use. I've used a battery bank on the calculator usb port but it doesn't last long either because if there is a usb connected to the battery bank, even if the other end of the usb cable is disconnected, a small irritating green led stays on, and the bank lasts like 3 days disconnected from everything.

A solution that I've come up, is to buy a Tp4056 lithium battery charger and use a 3.7v nk18650 battery, then install it at the bowels of the calculator to make it rechargeable by the usb port.

So I need to make 3.7v go to at least 5v, (because the low bat warning starts at 5v), or to simply come up with two or three of the batteries and make the voltage go up 4.2v, because that voltage is the max chargeable voltage of the tp4056.


texts: Need help for a Dflop implementation in LTspice

texts:
I'm trying to implement an analog debouncing filter which uses a 555 timer and a D-flop. Here is the recommended circuit.

But when I simulate this in LTspice as below, the output is 1V constant:

(please left-click to enlarge)

Above red V2 represents the 555 timer clock, green V1 represents the noisy input signal; and blue Vout represents the output.

Why is the debounced output not the same as in the page I follow?
How can I correct it?


texts: Synchronise SPI: options? Dedicated reset line? Series of reset bytes not allowed in data? Long break?

texts:
When using SPI, is there a common way of ensuring that when sending 8-bit words, that the sender and receiver know what is the start and end of a byte?

I'm guessing the best way is to assume that some period of no clock pulses from the master should be interpreted as a sort of reset, so the slave should assume any incomplete bytes/words should be abandoned, and the shift register reset? Is there some standard length accepted as a reset, either in multiples of some clock frequency, or some absolute time period?


texts: What are the pros and cons of using different transistor types in a Colpitts oscillator circuit?

texts:
When I do a generic search for "Colpitts oscillator circuit" I get lots of results with circuit examples that use an NPN transistor in a common emitter or common collector configuration as the means for providing the amplification/feedback necessary to sustain oscillations in an LC tank circuit. I have also seen a number of circuit examples that use a JFET instead of a BJT. However, I see almost no circuit examples that use a MOSFET.
Is there any reason MOSFETs in Colpitts oscillators seem so rare? Are JFETs and BJTs in fact used in Colpitts oscillators more frequently in practice? If so, why? What are the pros and cons of using each type of transistor in a Colpitts oscillator?


texts: Step-down with external mosfet - why heavy current surges?

texts:
I built this circuit, which is supposed to deliver currents up to 20 amps (when everything else works...).

The purpose is (eventually) to build a constant current source (as opposed to a constant voltage source) which will be used for anodizing aluminum. To keep the current constant see the alternative feedback path with a shunt and an instrumentational amplifier. But set that aside for the moment.

Let the input voltage be 19V and keep the voltage divider variable (with a poti). Load about 4 Ohm.

The problem: Some output voltages work fine, i.e. the voltage stays constant and the current (drawn from the source) is as expected. But other voltages produce a strange phenomenon: The switcher is on (i.e. mosfet is on almost all the time) so that the current increases over a lot of periods (the voltage at the feedback pin goes way above the reference voltage) and results in a heavy current surge which results in current limiting of my voltage source and voltage drop. The switcher turns off and the current goes back down. This repeats a few times per second.

Here scope shots, when good and bad, zoomed in and out (in time):
This is ok, voltage stable.

Signal from former pic zoomed in. Caution, yellow signal measured at the input of the mosfet, therefore it is inverted (low=Mosfet on).

Here the problem occurs. The voltage at the feedback pin rises far to high (note different volt/div) and the supply voltage drops (seen at the yellow signal).

Again a zoom of the bad signal.

Why does this occur?

Next I provide some additional information which may be needed.
L=60uH
C some thousand uF
Mosfet - P-channel
Converters used were LM2576 and MC34063 (scope shots for the latter) with basically the same results.

(Forgot to draw the pull up resistor at base of T1.)
The strange looking use of a transistor wrapped around a diode is to discharge the gate capacitance faster (imagine the lower transistor T2 turns off, then base of T1 is immediately pulled up while the gate capacitance is low -> T1 turns on and pulls gate high with a low resistance). This seems to work all right.

(Also forgot to draw a speed-up Schottky diode for T2, but it's there, promise:-) )

An optional follow up question:
When using the shunt circuit mentioned above, the same problem occurs all the time and no predictable behavior is observed.

Edit: There are also large input capacitors. Sorry for having forgotten half of the parts, I sketched the schematic quickly. With input I mean gate, where the yellow trace is taken from. When taking a scope shot on the output of the Mosfet you will see the same on and off signal plus ringing after the current has decreased so that the diode becomes more of a capacitor.

When starting a project, you just set some parameters without anticipating which choices you have to justify afterwards E.g. I took a long time to focus on and develop the needed inductor since this seemed to be the crucial part (at the time I started) while the buck converter just seemed to be not as crucial.

Furthermore, my Layout is a mess, because I have made a lot of changes until now. Give me some time to clean up.


texts: DC-DC buck converter controlled by ATTINY - optimize PWM for maximum resolution

texts:
I got a solenoid with the following data:

1.25W
24V
460Ohm resistance
Inductance value unknown

I'm working on a sensor PCB which also needs to control the force of the solenoid. The sensor PCB is already using an ATTINY44 and has a 24V supply.
To control the force of the magnet I want to basically use a buck converter, with the ATTINY as controller. When configured as fast PWM 8bit with no prescaler and running on a 16Mhz crystal it should give a PWM signal of 62.5kHz.

This PWM signal I want to feed into the following circuit:

The value of VOut5 is fed back by a resistor divider to one of the ATTINY analog inputs. The ATTINY ADC is configured to convert it in "free running mode" and the PWM signal is adjusted according to this value.

Which is basically working fine except for one Problem (btw. I want to control the magnet voltage VOut5 from 5V to 24V).
To get the following voltages the PWM signal is settling at about:

5V -> ~15% (PWM comparator OCR1B ~ 38)
10V -> ~28%
15V -> ~44%
20V -> ~61%
24V -> ~75% (PWM comparator OCR1B ~ 191)

This reduces my resolution to \$ Res=191-38=153\$ instead of 255.
As I need quite a bit of precision I would like to use the full resolution of 255.
By trial and error (mostly by changing the inductor value) I got to the chosen values in this circuit.

So my question:
What do I have to change to get nearly the full resolution of 255 (e.g. 5V at close to 0% PWM and 24V close to 100% PWM)?
Or is there a better way to than my trial and error (because each simulation run on my computer takes about 20min)? Can I calculate this?

As I need to make about 200 of these boards I would like to find a simple / cheap solution (that's basically, why I wanted to use the existing ATTINY, which had 2 free pins left as a controller in the first place).

P.S. to simulate this circuits behavior I build up below LTSpice model:

The part of the circuit in the red box emulates the ATTINY. Due to the rest of the program running on the ATTINY it is only able to adjust the PWM signal every 0.5ms (modeled by the sample and hold part. The LTC6992 is used to generate the PWM signal of 62kHz (R18 set to 800k) out of 0V to 1V voltage at the MOD pin.
This emulates the behavior of the ATTINY pretty close.

The model can be downloaded here in case you need it.


texts: Could I double the batteries for double the usage time?

texts:
If I were to double the exact same battery of a particular device (noted below), could/would that effectively ~double the device's usage time (more or less)?

For reference --

There's a motorized wheelchair I'd like to increase usage time of before needing to recharge. I'm curious if doubling the exact same batteries in parallel could be an option for roughly doubling the wheelchair's use time -- perhaps enabled by custom circuitry for cell/charge balancing/monitoring.

The wheelchair uses lead-acid 12-volt/70 Amp-hour batteries (sealed).

If doubling batteries is not feasible (particularly in this case), how might one go about increasing the usage time of a device, without neutering/trimming already present functions/features of such device?

(Note -- I'm asking this question in the feasibility of such approach, and not in a "I'm about to do this willy-nilly and I'm waiting for either thumbs-up or thumbs-downs". I understand that, if feasible, such a route would likely require more than simply "stacking" batteries in parallel.)


texts: Motor vector control and parameters estimation

texts:
Vector control methods require good estimation of magnetic flux. In Direct Torque Control it would vector of stator flux. In order to estimate it properly one has to know motor parameters such as rotor and stator resistances and inductances and mutual inductance as well.
Best would be to perform free and locked rotor tests and obtain those parameters accurately by experiment, however it is not always easy to do (for example when motor is already connected to the load machine and you can't easily dismount it). There are some other methods, like calculating the parameters from nameplate data (nominal power, nominal speed, current, slip, Istart/Inom and so on). However this method has quite a big margin of error, up to -/+ 50%.
Thing is the motor and control scheme would still work, even with such high mismatch of parameters. Most likely not as good as with perfect parameters, transients would be longer and with higher oscillations but it would eventually still work. And since in real world you don't have information about real stator flux, how can you know how bad the parameters are under or overestimated?

Please take a look at above picture. In simulation I can easily know that parameters are in mismatch as estimated stator flux (red, calculated from nameplate data of modeled motor) doesn't correspond to real stator flux (blue, modeled motor paremeters). How can I know it in real world, with physical motor and an actual inverter?


texts: How to connect USB mini-b pins on a PCB?

texts:
I want to design a PCB which contains either PIC24FJ128GA010 or PIC24fj256gb110 (still haven't decided). Now the second contains a USB 2.0 on the go and the first one doesn't. I want to power the board through USB for prototyping purposes.

Through some research I found out that USB mini-b has 5 pins, 4 as usual for D+, D-, VDD and ground. The 5th pin can be connected to ground by a USB host and not connected for a USB device. Does that mean that the MCU may behave as either device or host not both or what ? and how to connect it to each of the MCU above ? and do you suggest other USB types ?


texts: Adding antenna gain to RX and TX sensitivity

texts: Let's say I have a transceiver with 10dBm of TX gain, and an RX sensitivity of -10dBm.   If I then attach an antenna with a gain of -2dBi do I then have an RF output power of 8dBm and an RX sensitivity of -8dBm?   I'm not clear on if I have to flip the sign when adding to the RX sensitivity but that would seem to make sense.


texts: Can a triac which is driven by another triac be used for switching AC continuously?

texts:
MOC3041, BTA06

I am considering cascading two triacs like this in order to make a solid state relay. I'm not going to control the phase angle of the voltage on load as done in dimmers. I only want to make an electronic switch which turns on or off a resistive load for long time durations (minutes to hours).

I have some doubts on the output waveform of this circuit.
We assume that the LED in MOC3041 is always lit. At the zero-crossing points of the 220V AC sinusoidal voltage, both T1 and T2 will be turned off. When a positive or negative half cycle starts, T1 will conduct first and start supplying gate current to T2. T2 will stat conducting as soon as it has enough gate current. This waiting time brings out an issue of time delay which will clip the voltage waveform on the load.

How do I calculate this time delay? I'm aiming to find out whether this delay time will cause great distortion on the waveform, or it is negligible. Can this circuit be used for switching AC voltage under the given conditions?

(Assume that the frequency of the AC voltage is 50Hz.)


texts: How is the current limited through the LEDs in this LED matrix design?

texts:
I was studying some LED matrix designs on the Net and came across the one below:

DMD: Dot Matrix Display 32x16 (link to product)
(somewhat poorly drawn) schematics of an old version of the product.

Its design puzzled me because I couldn't tell how it limits the current through each LED and through the shift registers outputs without any current limiting resistors.

For clarity, here are the relevant parts of the schematics diagram linked above.

VCC is 5V.

Here are the relevant datasheets:

APM4953 - Dual P-Channel Enhancement Mode Mosfet
74HC595 - 8-bit serial-in, serial or parallel-out shift register
Unfortunately, I know nothing about the LED used (so I assumed common 2V, 20mA red LED indicators).

As far as I can tell, to light a LED, say D512, one has to:

turn on the high-side PFET by setting HI1 to LOW, thus turning row HO1 on, and
set the '595 shift register output QH (pin 7) to LOW

In this case, the current path would be the following:

My question is: what is limiting the current through the LED and '595 QH output?

My best guess is that, somehow, the '595 is clamping the current to the desired value of 20mA, which incidentally may be the forward current intended to be pushed through a common LED indicator. Is that it? If so, why does that happen?

Another guess is that there is a specific combination of VCC, multiplexing scheme, LED forward voltage and current that magically limits the current.

In any case, is this the Right Way of Designing It(TM)? Or is this just a trick in which the '595 is being used outside its specs?


texts: Eagle how to restore default autorouter settings?

texts:
I'm testing Eagle autorouter while changing the value in various ways.

Is there way to reset the parameter values for returning to default settings?


texts:
I am trying to build a driver for my M140 laser diode. I made a circuit following a guide. Then I made a test load. When I change the pot value to the minimum I get a maximum current of <100mA on the 1 ohm resistor.
Can someone please explain why the maximum current is only <100mA?
Thank you in advance!


texts: does frequency multiplier work with signal that contain multiple frequency components?

texts:
for example, say we have a wide band frequency multiplier that takes the input of 100MHz-200MHz and the output have frequency of 300MHz-600MHz（a frequency tripler).

if the signal contains a 110MHz and also a 150MHz components (to be more realistic, with different power levels), will the output be two components signal that contains 330MHz and 450MHz?

----update below-------

The problem comes from a project where there are two surfaces that reflect MMW wave (\$f_0\$=50GHz) and one surface is moving, the other one is not. And both reflected signal go into a receiver and were downconverted into RF signal with a carrier frequency of 630MHz (this frequency was chosen to fit the frequency multiplier requirement).

From Doppler Effect the reflected MMW from the moving surface will have different frequency (\$\delta f=f'-f_0\$). So the intermediate frequency (IF) from the receiver will have two frequency components, one is 630MHz, the other one is 630MHz+\$\delta f\$.

Next we try to frequency multiply this IF signal with two frequency multipliers (with amps, mixers, filters), as shown in picture.

The frequency multiplier we use are

1 HMC445LP (Hittite, X16, 618.75M-687.5MHz, output 9.9-11GHz, a cascaded X2 multiplier)

2 RMK-5-83+ (Mini-Circuits, X5, 1.0G-1.6G, output 5G-8GHz, a diode quad)

So the question is, we only want the signal that comes from the moving surface, but we cannot eliminate the signal from the not moving surface. If the multipliers work with two (or more) frequency components, this project will probably work. If not, then other solution is needed.


texts: Please help me to identify 6 pin SMD IC with top marking ADS


texts: Power rail oscillation during MOSFET turn-off

texts:
I'm implementing a simple manually controlled low frequency (120 Hz) PWM which drives MOSFET switching a rather heavy load (battery is 2S Li-poly 7.4V high drain, load current is up to 80A). Simplified schematic of that part of device flollows (I omitted a sawtooth generator and the other parts of device which are not involved here and are physically disconnected from this curcuit during testing anyway):

AMS1117 here is a 3.3V fixed LDO.
I found out that LM393 (actually LM2903) output is oscillating during MOSFET turn-off period:

(Yellow channel is MOSFET drain and cyan one is the LM393 output, note that channel scales are different).
After making research I found that LDO output, providing reference voltage to the comparator through R3-R5-R6 divider is guilty:

(Here yellow is LM393 output and cyan is LDO output)
Although input and output of LDO and reference voltage input of comparator are debounced with rather large capacitors, LDO output still bounces along with LDO input during transition of MOSFET which significantly affects comparator reference voltage:

I'm mostly newbie in questions of power, my primary skill is MCs and what I usually do to power rails is selecting debouncing capacitor according to IC datasheet. So I had to read some application note from Murata on debouncing and constructed a pi-section filter at LDO input as per their recommendations:

... which didn't change the situation. I mean there's no eye visible change of waveforms on the LDO input oscillorgam after adding a pi-section filter. At this point I realize that either physics works wrong or I don't understand something. I believe the latter is more probable.
Any suggestions are appreciated.

P.S. Adding a hysteresis to comparator didn't help either as the oscillation amplitude is over 2 V and hysteresis would be unacceptably huge.

P.P.S. All the measurements are taken regarding to the negative pole of battery.


texts: Circuit for turn on a led when load connected

texts: I'm searching for a circuit that turn on a led when the load is connected on its output, let's say for example a 5v power supply. I've seen few circuits that used two resistor in series with the positive supply rail, in order to make a voltage divider and drive a npn transistor, but in this way there will be a noticeable voltage drop on the load. Are there other way of detect a load?


texts: How to get a Timer started without interrupt?

texts:
I use an STM32F103c8t6. What I want is to measure time between several statements. I found out HAL_getTick does not work since the resolution is too small (1 ms).

However, I cannot seem to initialize the timer correctly. With CubeMX I selected:

TIM2:
Slave mode: Trigger mode
Trigger Source: ITR0
Clock Source: Internal Clock
Rest disabled

And the following code is generated:

/* TIM2 init function */
static void MX_TIM2_Init(void)
{

  TIM_ClockConfigTypeDef sClockSourceConfig;
  TIM_SlaveConfigTypeDef sSlaveConfig;
  TIM_MasterConfigTypeDef sMasterConfig;

  htim2.Instance = TIM2;
  htim2.Init.Prescaler = 35999;
  htim2.Init.CounterMode = TIM_COUNTERMODE_UP;
  htim2.Init.Period = 35999;
  htim2.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1;
  htim2.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_ENABLE;
  if (HAL_TIM_Base_Init(&htim2) != HAL_OK)
  {
    _Error_Handler(__FILE__, __LINE__);
  }

  sClockSourceConfig.ClockSource = TIM_CLOCKSOURCE_INTERNAL;
  if (HAL_TIM_ConfigClockSource(&htim2, &sClockSourceConfig) != HAL_OK)
  {
    _Error_Handler(__FILE__, __LINE__);
  }

  if (HAL_TIM_OnePulse_Init(&htim2, TIM_OPMODE_SINGLE) != HAL_OK)
  {
    _Error_Handler(__FILE__, __LINE__);
  }

  sSlaveConfig.SlaveMode = TIM_SLAVEMODE_TRIGGER;
  sSlaveConfig.InputTrigger = TIM_TS_ITR0;
  if (HAL_TIM_SlaveConfigSynchronization(&htim2, &sSlaveConfig) != HAL_OK)
  {
    _Error_Handler(__FILE__, __LINE__);
  }

  sMasterConfig.MasterOutputTrigger = TIM_TRGO_RESET;
  sMasterConfig.MasterSlaveMode = TIM_MASTERSLAVEMODE_DISABLE;
  if (HAL_TIMEx_MasterConfigSynchronization(&htim2, &sMasterConfig) != HAL_OK)
  {
    _Error_Handler(__FILE__, __LINE__);
  }

}

My own code in the main / while loop:

....
__HAL_RCC_TIM2_CLK_ENABLE();

And later I get the value with

uint32_t value = __HAL_TIM_GET_COUNTER(&htim2);

However, I only see 0's returning from this function.

I wonder if the timer is started at all (I tried to do it very soon after initialization of the timer, but did not make a difference). The timer always has state HAL_TIM_STATE_READY.

How should I start (and possibly restart) the timer?


texts: Estimating Path Loss from Measured 2.4Ghz/Wlan Signal Strength to get Distance

texts:
I want to estimate distances between Wlan Routers based on the RSS (received signal strength) indoors. Im fully aware that I only will get rough estimates. For that I studied some radio propagation models like the ITU model for indoor attenuation which defines path loss as:

$$L \; = \; 20 \; \log_{10}f \; + \; N \; \log_{10} d \; + \; P_f(n) \; - \; 28$$

where,

''L'' = the total path loss. Unit: (dB).
''f'' = Frequency of transmission. Unit: (MHz).
''d'' = Distance. Unit: metre (m)
''N'' = The distance power loss coefficient.
''n'' = Number of floors between the transmitter and receiver.
''P''f(n) = the floor loss penetration factor.

so to get the distance I have the formular

$$d = f^{\frac{-20}{N}} 10^{\frac{L-P_f(n)+28}{N}}$$

Now I only need the Path Loss to get the estimated distance in meters. This is defined in several places as:

Path Loss (dB) = Transimitted dBm + Receive Antenna Gain dBi + Transmission antenna Gain dBi - Received Signal dBm

But the problem is, derived from this formula, if you set 2 Routers next to each other the receiving device should see signal strength of at least 10dBm which NEVER is the case, since RSS is usually between -30dBm and -95 dBm. So therefore this formular is useless for me.

So the question is: Can anybody elaborate how to get the Path Loss from measured RSS in Wlan context? I have the info for antenna gain and transimitted power and usually know the exact model/specs.

Further Detail: The ITU Model works quite well for me when I do not calculate the path loss but just use the absolute value of the RSS (So if -40dBm, I use path loss 40 dB)

Edit: Just for the curious here are my measured RSS for a good signal AP with high sample size of 750:


texts: Built a electret preamp but poor low frequency response

texts:
I have built this preamp using the TL071 IC.

It works, but it does have a bad low frequency response. If I plug the mic directly to my PC i can hear low frequencies much better. I don't have any software equalizers active on my PC.
What is the problem? Also, is this design good?


texts:
Do you know any port of Pi4j for PCDuino boards or anything similar?
 I am particularly interested in I2C, oneWire and Serial reading.


texts: Powermanagement of a minicomputer in an automotive vehicle by engine start/stop and voltage threshold detection

texts:
Revison 1.3 (New circuit, more background information added, PCB made and tested, it WORKS)

Background:
I would like to use a BeagleBone Black (=Minicomputer) for data acquisition in an automotive vehicle. It will be plugged into the OBD interface and will therefore be supplied by the 12.0 V - 14.0 V battery power / alternator.

The following specifications were defined:

The minicomputer has to power on when the engine starts.
The minicomputer has to stay alive when the engine goes out (e.g. new start/stop system in new vehicles at traffic jams)
A clean shutdown (i.e. not cutting the power) should be made when no CAN or OBD messages have been received for 2 minutes.
After the BeagleBone Black shutdown the power has to be cut to the automotive battery. (i.e. no further power consumption)

Actual progress/solution (Thanks to Olin and Dave!)

Two separate circuits. The trigger voltage indicates if the main switch is open or closed.

Voltage sensing by TL431: When a voltage > 13.25 V was detected, the main switch will be opened by a P-Mosfet.
A NP-MOSFET switches the power supply for the BeagleBone Black. When the battery voltage is above a specific threshold (e.g. 13.25 V) it closes the P-Channel (engine started, vehicle battery ~ 14.0V, the BeagleBone starts up). When the BeagleBone Black starts up, the internal 3.3 V closes also the N-channel MOSFET (This will keep the BeagleBone on, also when the car engine is out)
When the engine is out, and the BeagleBone receives the poweroff system call, the BeagleBone powers down. The connection to the vehicle battery is cutted (No trigger voltage and no 3.3 V of the BeagleBone).

The circuit is shown below. Of course there is a protection circuit before and a step down converter after that part.

MOSFET used: VISHAY SI4564DY-T1-GE3
+12.0V = Vehicle Battery
TRIGGER = When vehicle battery is > 13.25 V, this voltage will be pulled down
VDD = Supply voltage for the BeagelBone Black (Goes into a step down converter)


texts: Timer2 period match interrupt on dsPIC33F not working

texts:
I'm trying to get the Timer2 period match interrupt on my dsPIC33FJ128GP802 working. I want it to interrupt after ~480 cycles. I'm using MPLAB C30.

I have, to initialize the timer and interrupt:

// Initialize Timer2, which is used for output timing.
T2CONbits.TON = 1;
T2CONbits.TSIDL = 0;
T2CONbits.TCKPS = 0;
T2CONbits.TCS = 0;
T2CONbits.T32 = 0;
// Initialize Timer2 interrupt with a slightly
// higher priority.
IPC1bits.T2IP = 5;
IFS0bits.T2IF = 0;
IEC0bits.T2IE = 0;

(the timer interrupt is initially disabled)

I have already got pin change interrupts working with a priority of 4. I want the Timer2 interrupt to have a higher priority.

And to set up the interrupt I have this:

T2CONbits.TON = 1;
TMR2 = 0;
timer2_osd = 480 + vid_hoffset;
PR2 = timer2_osd;
IEC0bits.T2IE = 1;

I also have an ISR,

void _MY_ISR _T2Interrupt()
{
    IFS0bits.T2IF = 0;
    return;
}

However I find the processor just resets and will not run with this enabled. It will work with a busy loop checking the timer, but that wastes cycles.

Can anyone see where I've gone wrong?


texts: Friis transmission equation: how do I consider power loss along other directions?

texts:
I do not understand a basic concept about Friis transmision equation between two antennas:

where Dt and Dr are the antenna directivities (with respect to an isotropic radiator) of the transmitting and receiving antennas respectively, λ  is the wavelength and d is the distance between the antennas.

Let's consider for instance the case in which both are dipole antennas, whose pattern is drawn below:

How can I apply the previous formula to this case? Precisely, I have the following doubt:

1) Since dipoles are not isotropic radiators/receivers, their directivities will depend on the direction considered. So, I'd say that Pr will depend on direction. How do I find the total received power?

2) Part of the radiation from TX goes at also other directions (for instance at left). Is this fact considered in the Friis equation (and, if yes, which factor describes it?)? How can I distinguish, numerically, a situation like that in the previous picture, from something like this (a RX antenna, drawn in green, that surrounds the TX and so receives more power):


texts:
I'm planning a project involving the ADNS-5050 optical mouse sensor package. The data sheet for this package says that it needs to be combined with 4 capacitors, and it has a diagramme that I think is supposed to tell me what capacitors to use, but I don't have a great deal of experience with electronics and don't know exactly how to interpret it.
The relevant part of the diagramme is:

As far as I can tell, the document does not elaborate on these four capacitors. Obviously, the 0.1, 3.3 and 4.7 are measures of capacitance, but I don't know what the units are, or even if they are all the same units. I do recognize from the symbols that two of them are polarized and two are non-polarized, but I am kind of floundering at figuring out what exactly I need to hook up.
What capacitors exactly is this diagramme calling for, and how might I have figured it out by myself? :-)


texts:
I'm trying to learn about RF amplifier design and build a common emitter stage with an BFR92P.
And now I'm struggeling with the simulation in LTspice, or maybe with reality.
As you can see attached is a simple common emitter testcircuit, that I have tried to optimize . .asc -file: https://drive.google.com/file/d/1T7y4zdWiqA7fs3u-jYscfxaS7kk1qGwp/view?usp=sharing
Stepping Re from 200 to 800 ohm there is a sudden change in amplification. 350ohm is maximum an 400ohm is completely broke down.
I can't see this from DC characteristics (also attached) or I don't unstand something fundamental
The spice model is from infineon.
Maybe someone can help me to understand what's happening and how get a maximum voltage amplification.
Many thanks


texts: Driving a single-relay board with Raspberry Pi

texts:
I have one of these single-relay boards and I am trying to control it with my RasPi's GPIO. (I'm a complete noob).

I am using WiringPi and in this particular case I'm using pin 1 (aka BCM pin 18) as the control pin. From the relay board, I have the + pin wired to the RasPi's 5v, the - pin to RasPi's ground and the S pin to the control pin.

As soon as I connect the wires, the relay clicks and its led turns on. If I run a program that turns it on and off every 3 seconds, the relay's led turns on and off, but the relay stays connected (it doesn't click either). If I disconnect the control pin or gound then it clicks and turns off.

What am I doing wrong? Do I have to ground something else? I thought that by sending a LOW signal to the control pin, I was effectively sending it 0v, which should turn off the relay, but that doesn't seem to be the case.

Closeups of the relay board: Back and Front

Update:

I've gotten it to work by using the 3.3v pin on the RasPi instead of the 5v. Could anyone explain why the 5v + GPIO pin on LOW doesn't go to 0v, but to 1.5? Will having my 5v relay connected to the 3.3v damage it?


texts: Trying to understand why voltage supplies have high in-rush current

texts:
I have a pair of buck switching converters in a circuit, the LM2673 and the LM2679. However, the LM2679 is being used in a buck-boost configuration as shown in this app note, AN-1157, and I'm converting a positive voltage to -10 volts. The LM2673 is being used to convert a DC voltage down to 5 volts. You can see my circuit below:

So far, I've tested it with a bench power supply (in a single-supply configuration with the single supply capable of up to 3 amps), outputting at 12 volts and 15 volts. However, when a load is connected to the output, the power board and load seems to be drawing more current than 3 amps, bringing the bench supply to current-limiting mode (output voltage being around 1-2 volts with current being 3 amps). The work around I've found is to
change out the current-adjust resistors on the regulators (increase them to limit the current to lower values, 1 amp and 3 amps). The problem is that the bench supply can't supply enough current on start-up. When I tested it again in a parallel supply configuration (single voltage, output up to 6 amps), it turns out that with the load I'm working with, the power supply pulls 4 amps of current on startup when the load is attached. When there is no load, the power supply pulls 2 amps. Why is the power supply pulling 4 amps of current on startup, and what can I do to reduce it?


texts: Slip Frequency Factors In Indirect Field Oriented Control

texts:
I am attempting to configure a asynchronous motor with a IFOC drive.  I have an encoder on the motor, however I have been struggling with getting the drive parameterized to operate correctly.

My issue seemed to be that there was no effective torque beyond a particular speed and beyond this point, the motor could only accelerate very slowly.   I ruled out issues with field weakening, because this was happening before I hit the specified field weakening range.  I noticed that during acceleration, if I plotted the direct and quadrature measured voltages of the vector control, the direct component would drop as the quadrature component increased.  From my understanding, the direct component should remain consistent as the quadrature increased.

I cross referenced as many motor parameters from the motor mfg. to the drive mfg., but I did not have sufficient information to fill the Rotor Time Constant in which I understood to be the Rotor Inductance / Rotor Resistance.  I tried lowering this value from the default of 109 ms to 25 ms and noticed I was now able to accelerate with ample available torque and the direct component stays much more consistent.  I have gone back to the motor mfg. and they supplied me with a rotor inductance of 11.2 mH and I already had a rotor resistance of 0.14 ohm.  I think this leaves a rotor time constant of about 80 ms which is closer to the 109 ms default, and when I was testing I noticed at 50 ms I still had issues.

My questions are:

How should I go about determining the correct factor for this?
What other factors of the motor model may be incorrectly offsetting this?
Is this correct the 0.0112 Henry over 0.14 ohm is 80 ms?


texts: High pass filter is not resulting as good as the scope's AC coupling

texts:
I'm generating sine waves by using a micro-controller and DDS module. The output sine normally swings always positive between 0 to around 1V. But I want to generate a real alternating sine with symmetric swing.

If I AC couple via a scope the sine output becomes absolutely symmetric. For instance if the sine wave Vpp is 1.04V. Scope's AC coupling results a swing between -520mV to +520mV.

But if I myself AC couple with an RC high pass filter with 22uF cap and a 1Meg resistor the scope in its DC setting shows a sine with around 10mV error between the swings I observe a swing between -512mV to +528mV.

What could be the reason and how can I fix this to a symmetric swing?

EDIT:

Unfortunately using such large cap for AC coupling to obtain frequency  independent solution has problem. I first observed this after sampling the data in plot. This new problem is not related to leakage or DDS offset ect. The problem is the response time is too long when switching from one frequency to another. By response time I mean the time taken for the sine to take its final form when the DDS sine output freq. is varied.

I simulated the circuit to show what I mean see green plot decaying(for this case not that bad but depending on when it is varied and freq. change that decay varies a lot):

Above freq. is switched from 0.1Hz to 1Hz. Response is even worse for different frequencies. I don't need a crazy fast response but definitely this is not reliable. And here from a real data acquisition shows the bottom of the sine wave how it is varying for many seconds. I also observed more weird transitions for different frequency changes:

Basically the above RC AC coupling will not work for me.

So I think my last solution is to remove the offset by a circuit like this:

If I use the above technique there is no issue with the response time. But I need to find a way to fine tune the 1V by a voltage divider and rely on Vref will be stable and DDS have same offset. Anything can be improved for this above circuit?


texts: Interrupt Priorities- What does it actually mean?

texts:
I have one generic question regarding interrupts. My software has 2 interrupts,lets say interrupt_x (timer), interrupt_y(spi).

Both interrupt has its own ISR. Interrupt_x has higher priority than interrupt_y. What does assigning priorities actually means?  Does it means that Interrupt_x and interrupt_y will actually interrupt the core when it is supposed to, but the corresponding ISR will only execute based on their priority? Or does it means interrupt_x will prevent interrupt_y to interrupt the core when both interrupts happen together, because interrupt_x has higher priority and because of that their ISR is executed accordingly? The CPU is RL78/G14


texts: What is the significance of "microcontroller based on microprocessor"?

texts:
I am aware about the basic theoretical differences between the two. Like micro controllers have ROM RAM memory etc., but microprocessor has none. But I am still confused.

Why is it said "A microcontroller based on microprocessor" (the very first line).
If ARM is a microprocessor, then why STMs use it and call it as micro controller. What's the difference?
Is eval board like "TI c-series launchpad" has a micro controller or a micro processor or both.

Kindly correct me if I am wrong anywhere.


texts:
I have a circuit composed of Arduino Mini Pro 3.3V and GY-GPS6MV2 (GPS Ublox NEO-6M). I have tried to power it with 3 different sources:

3xAA NiMH in serie connected to RAW pin of Arduino and using its VCC pin to power GPS
DC/DC Step-up power converter powered by 2x2 serial-parallel NiMH AA connected to VCC of the Arduino
(high current) USB via FT232RL FTDI 3.3V

If GPS module is not attached then measured VCC is in all three cases almost 3.3V but once I attach the module then it drops again in all cases to around 3.0V (it varies a bit depending on how much current does GPS module just need).

If I was powering it with USB then in some cases GPS module was restarting repeately because it had not enough voltage. I've fixed this by bypassing built-in voltage reglator of the GPS module.

Input current of the GPS module is measured max 70mA which I think is not that much. Input current of the whole circuit is then around 100mA (so it is 30mA for Arduino + some other parts).

Why is there that big voltage drop and why I observe it in all three cases? I don't think that 100mA is that big current for any of the three powering solutions.


texts:
I am working on a design that has at least a dozen FPGA's.
In the past I have had an FPGA get damaged by a faulty  voltage regulator and short out the supply input to ground.Chasing down which FPGA was defective was challenging.
I want to have the several voltages be interrupted to each FPGA so I can debug by removing components in series with the power lines to each FPGA. Has anyone done this before? How can it be done?


texts: Buck Converter Inductor current at Steady State

texts:
I am trying to learn about Buck converters from the below page.
https://www.allaboutcircuits.com/technical-articles/analysis-of-four-dc-dc-converters-in-equilibrium/
Below line is confusing me completely
from the steady-state perspective, magnitude of the inductor current increment during switch on is equal to the inductor current decrement during switch off; i.e. |(Imax−Imin)SWITCH−ON|=|(Imax−Imin)SWITCH−OFF|.
⇒|VS−VOLDT|=|−VOL(1−DT)|
⇒VO=DVS
I have few questions regarding this .
1)May I know what you mean by steady state here
2)How inductor current becomes (rising and falling) become equal during steady state.
Please reply


texts: What is the difference between the LT1054 from TI & the LT1054 from Linear Technologies, other than price

texts:
The following has me puzzled:

The specifications on the datasheets of the LT1054 from Texas Instruments appear the same to me as those of the LT1054 from Linear Technologies.

In Europe the TI LT1054's cost half as much or less than the ones from Linear Technologies.

Have I missed something important on the datasheets that justify a higher/lower price between the two?


texts:
Are these 2 products compatible with each other?
https://www.spooky2-mall.com/product/spooky2-cold-laser-twin-free-shipping-via-china-post/
https://www.amazon.com/Koolertron-Generator-Precision-Dual-channel-Arbitrary/dp/B07211YWMK/ref=pd_ybh_a_9?_encoding=UTF8&psc=1&refRID=5M0CDG6CBTGCX3HP6C73


texts: Current and voltage increasing with duty cycle from buck- converter

texts:
I am designing a 2s Li-ion battery charger using a buck converter from a 10W (18V, 0.55A) solar panel. So I understand that the duty cycle controls the ratio of the input power vs output power and therefore Io = Is/DC and Vo = Vs.DC, but when I increase my duty cycle both the voltage and current increase to a point where all 0.55A are being drawn and then the voltage becomes limited causing a massive voltage drop. I am using an arduino uno to generate a 20kHz switching frequency and the circuit diagram can  be found below.I am using an 8 ohm power resistor in place of the battery to ensure I dont damage the battery. Any help/advice would be greatly appreciated.

Edited: Updated circuit, NMOS MOSFET changed to PMOS MOSFET for M2


texts: Non contact (contactless) AC or DC detection?

texts:
I'd like to detect AC or DC current (not the current level just nothing or something => ON/OFF) in a wire with a (DIY) sensor just in contact (glued) with the wire plastic insulator.
At the end the goal is to detect if the wire transport current or not (conduction is ON or OFF) with an arduino input. The voltage could be between 5V to 24V and current around 10mA to 20A.

Is there solution like hall effect or transistors in serial with antenna?
Non invasive current loop/sensor only work with AC current!


texts: Circuit todelay RS-232 TX pin closure after device power up

texts:
We have two devices connected via a cable, an ARM based computer on one side and a sensor on the other.  This cable carries an RS232 TX, RX, and ground.  In addition there is 28V provided from the sensor to the ARM computer.  When the sensor is powered on, it provides the power to the ARM platform so both systems power up at the same time.

It was observed that in this configuration the sensor refuses to communicate with the processor.  If the processor is powered on a seconds after the sensor, then communication works as normal.

An o-scope trace showed that when the processor was powered on, the RS232 TX goes from undefined to 0 and then immediately pulses to 1 and then back to 0.  My guess is that if this pulse occurs during the sensors boot, this will cause the sensor to ignore any future IO.

The simple solution would be to disable the TX line for a few seconds while both systems boot. What is the simplest circuit that could be used to perform this? This circuit would need to be built into the cable.

I have seen a lot of delay on and off circuits on this site but most of them look to be switching power, I am not sure if it would be different if it was an IO line.


texts: What is the best solution to parallelize non-rechargable batteries for best efficiency and low self discharge

texts:
I want to parallelize few non-rechargeable batteries like this one (Tadiran TL-5104/S, lithium 3.6V and 2.1Ah) for bigger capacity.

https://www.digikey.com/product-detail/en/tadiran-batteries/TL-5104-S/439-1012-ND/512514

What option do I have for longest self life aka, not discharging one to another, of course, in context of maximum efficiency.

I am thinking of back-to-back mosfets on each battery but not sure this is the best option.

Thanks.


texts:
I've got a 12V source which I want to measure the voltage (or basically, just to check it's there) so have a voltage divider. Currently, with a 10k and 3k resistor, that brings it down to 2.77V and well within the Analog Input of an Arduino to measure, which is great. With this setup, it pulls ~923uA of current, but with a 10M and 3M resistor I get around ~923nA. Obviously I want to pull as little current as possible, but would the current with the 10M and 3M resistor be too low for the arduino to pick up? I read somewhere someone saying that the max should be 10k and 3k resistors for Arduino to read it reliably, but can't find it anywhere now and it's just sticking in my head.

This is probably a silly question, but I don't have an arduino to test it with right now.


texts:
My goal is to measure PWM pulses. But to achive that I'm making baby steps, so my first goal is to set a pin when an edge of the PWM signal is detected. The PWM signal enters the microcontroller (pic18f25k80, Datasheet) on the INT1 pin (RB1). I wrote the code to initialize the external interrupt:
#include <stdio.h>
#include <stdlib.h>
#include <pic18f25k80.h>
#include "config.h"

void main() {
        TRISB1 = 1;                 // INT1 as input
        LATB1 = 0;                  // Clear INT1
        TRISC6 = 0;                 // RC6 as output
        LATC6 = 0;                  // Clear RC6

        //Setup of INT1
        RCONbits.IPEN = 0;          //Disable priorities
        INTCONbits.GIE_GIEH = 1;    //Enable Global interrupt
        INTCONbits.PEIE_GIEL = 1;   //Enable peripheral interrupts
        INTCON2bits.INTEDG1 = 1;    // Edge select for INT1
        INTCON3bits.INT1IE = 1;     // Enable the INT1 external interrupt
        //INTCON3bits.INT1IP = 0;     // Low priority
        INTCON3bits.INT1IF = 0;        //Clear external interrupt flag bit

        while(1) {
        }
    }
    //Interrupt Service Routine

    #pragma code isr=0x08
    #pragma interrupt isr

    void isr(void)
    {
        if(INTCON3bits.INT1IF){
            LATC6 = 1;
        }
    }

    #pragma code

It seems that the interrupt flag doesn't go high, because the RC6 pin is low. I've measured that with an oscilloscope. What am I doing wrong?
BTW is that the correct way to call a ISR?


texts:
I need simple circuit that can provide step down of voltage after some time. For example after connecting 24V, on output there will be 24V for 500msec, after that voltage will step down to 8V and stay there. After each power on, the circuit will repeat this.
What is simple way to do this? (not using any controller etc.)


texts:
Hi everyone,

I had recently received a lot of SLA batteries. A bunch of 12V 7Ah Portalac APC batteries, which seems to be in good condition after testing. Also I had received three 6V 12AH batteries. A Fiamm-GS(it's kinda dead), but the other two CSB batteries seems to charge. But the issue is that after full charge and keeping it for a few days the battery voltage settles down to 6.33V and 6.35V for two batteries and then pretty much stays like that for quite a while. And it doesn't discharge either too quick when connected to a load.

So is the battery still okay? The date code as shown in picture says 991109M2. I'm not sure if it means 1992 & 2011.


texts: What Would I Need Electrical Wire Testing Hooks For?

texts:
I want to buy accessories for soldering but was curious about electrical wire testing hooks:

What are they for? For picking hard to access little wires? How do i work with them?


texts:
Having done the exercise 2.2 from Horowitz's "The Art of Electronics," I feel uncertain and would like somebody familiar with the matter to check my solution. With this aim in head I've searched the forum and found this topic: Designing a stiff voltage source using an emitter follower, which gives a solution. But, even if this is useful and solves the exercise, it uses another approach than the one intended to be used in the textbook (this exercise is given in the section talking about follower's input and output impedance). Furthermore, my solution gives lower values for the resistors and I don't understand where my error is.

Briefly, my solutions are (for simplicity I don't use emitter resistor—just the load):

1st version:
Voltage divider equation is
$$V_{in} = V_{source}\frac{R_2}{R_1 + R_2}$$
where \$V_{in} = 5.6V\$ (input to the follower) and \$V_{source} = 15V\$. From this we can express \$R_2\$ from
\$R_1\$:
$$R_2 = \frac{5.6}{9.4}R_1$$
And for simplicity we denote \$\frac{5.6}{9.4}\$ as \$k\$

Next, the resistance of the divider lower leg is actually parallel resistance of \$R_2\$ and \$r_{in}\$ (the follower input resistance). So, the actual
voltage at the lower leg is
$$V_{div} = 15 \frac{\frac{R_2r_{in}}{R_2 + r_{in}}}{\frac{R_2r_{in}}{R_2 + r_{in}} + R_1}$$ solving this and using \$k\$ we get
$$V_{div} = 15 \frac{kr_{in}}{(k + 1)r_{in} + kR_1}$$

Dividing the nominator and denominator here by \$k\$ and denoting \$k' = 1/k\$ we have

$$V_{div} = 15 \frac{r_{in}}{(1 + k')r_{in} + R_1}$$

\$V_{div}\$ should not be lower that \$5.35V\$. So,

$$15 \frac{r_{in}}{(k' + 1)r_{in} + R_1} \geqslant 5.35$$

Finally, resolving this regarding \$R_1\$ and using the relation \$r_{in} = (h_{fe} + 1)R_{load}\$ from the book gives:
$$R_1 \leqslant \frac{(15 - 5.35(1 + k'))(1 + h_{fe})R_{load}}{5.35}$$

Choosing the value of \$R_{load}\$ from condition of \$I_{max} = 25mA\$ at \$5V\$ which gives \$R_{load} = 200\Omega\$ and using \$h_{fe} = 10\$ as proposed in the topic mentioned above I've got \$R_1 \leqslant 275.4\Omega, R_2 \leqslant 164\Omega\$

2nd version
We can also consider \$R_{source}\$ which is the divider impedance:

$$R_{source} = \frac{k}{(k + 1)}R_1$$

The \$R_{source}\$ formula is derived using one more time the denotion \$k = \frac{5.6}{9.4}, R_2 = kR_1\$

Then we use \$Z_{out} = \frac{Z_{source}}{h_{fe} + 1}\$ from the book substituting \$Z\$ with \$R\$ which gives
$$R_{out} = \frac{k}{(k + 1)(h_{fe} + 1)} R_1$$
As the load forms voltage divider with the follower output impedance and as the voltage drop at the load shoud be \$ \geqslant 4.75\$
we have
$$V_{load} = V_{out} \frac{R_{load}}{R_{load} + R_{out}} \geqslant 4.75$$

Resolving this with \$V_{out} = 5V\$ and using earlier derived formula for \$R_{out}\$ we have
$$R_1 \leqslant \frac{0.25(k + 1)(h_{fe} + 1)R_{load}}{4.75k}$$

Using one more time \$R_{load} = 200\Omega\$, this gives
\$R_1 \leqslant 310 \Omega, R_2 \leqslant 184 \Omega\$

So, as one can see, the values are about 10 times less than in the topic mentioned above and, furthermore, they are different in my 2 versions.
I can't see where is my error.

Could someone help me with this?

Thank you very much


texts: Is it possible to program PIC18F device with .hex and .bin files

texts:
I have .bin and .hex files that I want to load into my PIC18F2480 device. I also have a .doc file explaining how to configure PIC18F2480 before programming. I've been told that it is possible to use PICkit 2(3) programmer and these 3 files to program a brand new PIC18F2480 device.

Here you can find the files.

I could not make it with PICkit 3 programmer and MPLAB X IDE/IPE because I don't know how to combine all the files (.hex + .bin + some settings).

Would you, professional PIC users, take a quick and experienced look on the files and let me know if this is really possible?


texts: Will USB-PD work with and extension cable in the circuit?

texts: I want to replace the USB type A port on my trucks dash with a USB-C panel mount and give it the ability to "fast charge" my phone. Unless there is a product that I am overlooking it seems I would need to install a PCB charger this and than plug in something like this panel mount which is essentially a 1' Male to female. Should it work if I have charger > extension cable > phone cable > phone? Or should I strip the male end of the extension cable, desolder the chargers female port, solder extension cable to charger?


texts: MOSFET in LTspice sim conducts below the threshold voltage

texts:
Electronics noob here! I'm trying to create a circuit that feeds the output of a piezo transducer into a comparator, in order bring an arduino pin high when the piezo's output exceeds the comparator's reference voltage.
The annoying thing with this is that in order to test it, I have to physically depress the piezo. So in order to allow remote testing, I am trying to add the capability of bringing the input to the comparator high using software (in essence "emulating" a voltage from the piezo's output).
Here's the circuit I came up with:

The voltage source MCU is how I've modelled an output pin on the arduino, and similarly for the Piezo voltage source - both of which are 5v pulses.
When I simulated the circuit, it appeared that the MOSFET M1 always conducted ~4.5V between the drain and the source, even when the gate voltage was 0. Here is the simulation:

You can see that the input to the comparator "V(CompIn)" is always high, even when the MOSFET should be off. I'm sure it's just my lack of experience but could someone tell me what I'm missing here?


texts: NODEMCU _ MCP23017 IO Port Expander Schematic Design

texts:
I am designing a relay driver using NodeMCU and need additional IO Ports, therefore I have designed a schematic utilizing MCP23017.
I think the schematic looks good, however before I order PCB's based on this, I would request a review of the logic by experts.

I want to use GPB0-7 as GPIO INPUT mode, therefore using 10K pull down resistor.
MCP23017 reset pin is connected to VCC.
MCP23017 INTA, INTB pins are left unconnected.
DHT11 data pin is connected to VCC via 5K.
General observations if any.

Thank you for your valuable time to go through and giving your feedback. Thanks a ton. :)


texts: Bug and Best Practices for Interrupt Handling/Organization

texts:
I've read a few documents on best practices for interrupt handling and thought I was doing things correctly, ensuring the variable set in the ISR was declared volatile. In my code the interrupt handler is operating properly, firing at the correct rate per the timer settings (checked by toggling an LED). The problem I'm encountering is that when I check the status of the flag set in the interrupt from my main loop, I get seemingly random updates at rate much much slower than expected. Some more specifics:
Timer ISR Period: 500ms
Main Loop Execution Period: 50us
Effective period of CheckPeriodicTimer() being set: anywhere from 2 - 45 seconds
MCU: STM32F030R8  48 MHz
IDE: STM32CubeIDE 1.3.1
I have tried compiling with and without optimization and am getting the same behavior.
tim.c

volatile uint16_t PeriodicTimerFlag = TIMER_FLAG_CLEAR;
volatile uint32_t TimerOverflow = 0;

...

void HAL_TIM_PeriodElapsedCallback (TIM_HandleTypeDef *htim) {

    // check which timer
    if (htim->Instance == TIM1) {

        // check for stale flag - something is wrong (but also occurs when
        // debugger stops execution)
        if (PeriodicTimerFlag == TIMER_FLAG_SET) {
            TimerOverflow++;

        } else {        // set the flag and get out of here

            PeriodicTimerFlag = TIMER_FLAG_SET;

        }

    }
}
...
uint16_t CheckPeriodicTimer (void) {

    return PeriodicTimerFlag;
}

void ClearPeriodicTimerFlag (void) {

    PeriodicTimerFlag = TIMER_FLAG_CLEAR;

}

main.c
...
uint16_t mainPeriodicTimerFlag = TIMER_FLAG_CLEAR;
...
int main(void)
...
  while (1)
  {
    /* USER CODE END WHILE */

    /* USER CODE BEGIN 3 */

    //timer check
    mainPeriodicTimerFlag = CheckPeriodicTimer();

    Task1(mainPeriodicTimerFlag);
    Task2(mainPeriodicTimerFlag);

    // Clear timer flag once done
    ClearPeriodicTimerFlag();                       // remote
    mainPeriodicTimerFlag = TIMER_FLAG_CLEAR;   //local
  }
```


texts: Choosing an optocoupler for a digital interface with old -ve polarity -5V electronics

texts:
This is an amateur application - 'adding auto control to a manual motor control circuit' using an optocoupler to bridge opposite polarity circuits.

The existing 20 yo motors x 2 (-12V) are controlled manually, forward and reverse, by push buttons. The push buttons switch -5V to motor control hardware (TTL presumably).

I am adding auto control of the motors from a +5V (ST-4 guide camera) source.

With help from Stackexchange experts, I have come up with a basic layout, below.

Switch off auto to use manual. The push buttons will be physically guarded and wont get much use. This might need some modification to lockout inadvertent activation of the PBs.

My questions...

I need to choose an optocoupler (there are 4 channels). The optocoupler must be capable of a similar output as the push buttons (which I presume is logic level) and fast enough to be responsive to the ST-4 pulse guide commands.

The circuit should not be overly complex, have few components and therefore be reliable - it's mission critical.

I have perused a number of likely datasheets and to my inexperienced eye the FOD0721 look promising. It's fast and has an appropriate voltage rating.

Is this a sane choice, overkill or just inappropriate for the application?
What should I be looking for in an optocoupler for this type of application?

simulate this circuit – Schematic created using CircuitLab

This is the edited version based on discussion below.

simulate this circuit


texts: Ambiguity in ADC conversion of analog voltage to digital value

texts:
I have question about the common formula used to turn analog input voltage of ADC into an integer binary number that is as bellow :

I think that in the equation above N is not integer but floating-point value. And also we can not consider [] as integral part function in this formula.
How is it turned into Integer number? do we have to use ceiling or floor function?
According to the graph bellow, I guess that we have to round it to the nearest integer number.
For example if the N is 243.8 we should round it to 244 and if it was 243.2 we should round it to 243, So we should not use ceiling or floor function, right?

Edit:
To better explain my mean i added this better demonstrating plot with its correspondent quantization error graph. Based on the quantization error plot, i guess the rounding function should be used instead of floor or ceiling.
I mean that if every voltage value in range of [0, 1/8) was converted to 000, And every value in [1/8, 1/4) was converted to 001 and so on, Then using floor function was correct. But obviously some rounding is done, right?

Thanks in advance!


texts:
I want a battery back up for a monitoring system.

  Power supply is 4.8V-6V.

  Battery is 4.8V-6.4V (with 100uA leakage it goes 4.8V after one year).

I designed this circuit but on simulation it seems that is not working. What is wrong?

UPDATE: It is working on other simulator. You can simulate it here


texts: Power supply circuit capacitor selection

texts:
I'm planing to use this circuit for my op amp test but I don't understand capacitor selection

Why C1 and C2 selected 2200 uF but C3 and C4 selected 1000 uF?
(C3 is 1000 uF picture is wrong)

I tried to use 220 uF and 100 uF and voltage levels were same.
I think C3 and C4 for stabilizing the output but what's the purpose of C1 and C2?

Also if capacitor selection only effects on output current, is there equation for it?


texts: Atmega328p: why button input is read as 0 when pressed?

texts:
I'd like to turn on the board's LED (PB5) when I press its button (PB7).

DDRB = 0xFF; // set all B-ports as output
DDRB &= ~(1<<7); // change PB7 to input
while (1)
{
    if (PINB & (1<<7))
        PORTB |= (1<<5); // when button is pressed, turn on the LED
    else
        PORTB &= ~(1<<5); // when button is not pressed, turn off the LED
}

However, PINB & (1<<7) returns 1 when I except 0, and 0 when I press the button. I could add a not operator and it'd be fine, but I'd like to know what I missunderstand. Why is the 8th bit of PINB read as 0 when I press the button?


texts:
The fan in my car dosen't turn on automatically anymore when the car gets too hot, but it will turn on when i switch on the A/C.
So what i had in mind was to place a temperature sensor in the coolant tube just where the thermostat is to measure the temperature and turn on the cars fan with an AtTiny85 and a relay.
My question here is: can i leave the cars built in cables to the fan and add some new ones from the AtTiny and the relay, cause i still want the fan to kick in when i turn on the A/C.
I'm not quite sure if it will damage the fan cause at some time the car might be hot and therefore the AtTiny will add power to it and the A/C turned on at the same time, that will result in the fan getting two voltages? But it may not damage anything since all the power and ground comes from the same place?


texts: Please does anybody know what this is? It's a small part, three legs, spacing 1/20", body dimensions cca 3x4 mm. I have no idea, Googling "231S" did not give any appropriate results. Thanks.


texts: Opto Coupler output voltage drop when connected to PLC

texts:
I have an input of pulse width 5 ms and which is fed to a Buffer IC and then the output of the buffer is FED to an opto isolator whose collector is pulled with a pull up of 7.5k resistor with an 24 V source. When no load is connected the output is fine but when connected to a load (PLC input pin) The output drops to 10V.

We increased the pull up to 15K the output is the same.

The opto used here is a 4N35

Please suggest some points to TAP on and a solution for the same.

Thank you


texts: Read data from 125kHz tag and write into 433MHz remote

texts:
At the moment, I am opening the garage door via the 125khz key tag. I purchased a 433mhz remote. Also, I have a tool to read/write data from tags and I have used it in the past to copy key tags.
I planned to use the tool for read/write data that works on multiple frequencies to read data (serial) from 125khz tag, switch the tool to 433mhz mode, and then write read data to a 433mhz remote.
Does anyone know if this is possible?
I assume that the tool does not care about operating frequency and that it stores read data to a temp memory so that I can use this data and program a remote.
Is this feasible or it's Sci-Fi?


texts: I have seen that trace impedances in PCB's are maintained 50 ohm & so on. How to measure this impedance using a simple multimeter?


texts:
I am working on a battery powered 2 layer RF design using a 32.768kHz Crystal oscillator with an Atmega328p micro controller. The crystal will run a timer in asynchronous mode as an RTC clock.

My pcb board is fairly small, and the crystal is pretty big. The easiest way for me to run traces using my current layout would be to run my VCC trace under the crystal from the battery. At this low of frequency would this cause problems in my power domain (oscillating/ noise)?

I do not have it on the board yet, but the bottom layer of the board will be a solid ground plane (for RF return path), and the top layer traces will be surrounded with a ground pour as well. (With via stitching to eliminate any impedance between layers).

Would I be safe to run this power line under the crystal and into a 47uF capacitor. Then do a star power distribution?


texts: Assume a circuit has a spare nor gate. Can any useful functions be created by connecting one of the inputs to logical one? To logical zero?


texts: How to find currents in a mesh system with only current sources?

texts:
Could someone please give me a rundown of how to find the currents in this problem? There are only current sources available and I am not sure how to find the branch currents.

There are answers given in the textbook but no information on how to get there.

Many thanks in advance


texts:
I am using the at89lp2052 chip and I have a pulse generator generating a pulse once every reset pulse for port 3.3, this is the interrupt. While the signal is low, the chip has to be in the interrupt service routine (incrementing R0). However, when I run the code, it goes to the interrupt service routine (ISR) as soon as I turn on the global interrupts. It then comes back and does the CJNE once more and then, it's in the interrupt again. And so on until the next reset.

If I have a clr EA to turn off the global interrupts after the CJNE, it does the ISR two times. If the clr is inside the ISR, it does the ISR only once (as expected). Note: I am using a GPIO window on an oscope to see what it's doing.

Also, if I turn off the whole channel on the pulse generator and even unplug the cable completely, it still does the same. So it's something that the chip is doing, or I am doing with the code.

The code bellow is supposed to basically increment R0 until the pulse is off and then return and use that to decide where to jump to, i.e. what instruction set.
Note: I have many NOP's some of the GPIO windows to differentiate between the instructions easily on the oscope.

org 0 ; Place this code starting from byte 0 in code mem
mov 0xc3, #0xFF ; Set P1M1
mov 0xc7, #0xFF ; Set P3M1
jmp main ; Jump to main (skip ISR for interrupt 1)

isr_int1:
    org 13H ; Place this code starting form byte 13H in code mem
    mov R1, #1 ; Set R1 to show that interrupt has ran (2 clock cycle)
    inc R0 ; Increment R0 (1 clock cycle)
    inc R0 ; Increment R0 (1 clock cycle)
    mov 0x90, #0x00 ; Pull GPOI window down
    mov 0x90, #0x01 ; Pull GPOI window up
    ;clr EA ; Global disable interrupts (Runs ISR 1 times)
reti ; Return from ISR

main:
    org 30H ; Place this code starting form byte 1BH in code mem
    clr P3.3 ; Clear port 3.3
    mov R0, #0 ; Reset R0
    mov R1, #0 ; Reset R1

isr_wait:
    mov IE, #10000100B ; EA = 1 (Global interrupt enable) and EX1 = 1 (Enable     ext interrupt 1)
    wait_loop: cjne R1, #1, wait_loop ; Waiting for interrupt 1
    ;clr EA ; Global disable interrupts (Runs ISR 2 times)
cmp1:
    cjne R0, #1, cmp2 ; If ISR ran 1 times,
    jmp instr1 ; Go to instruction 1
cmp2:
    cjne R0, #2, cmp3 ; If ISR ran 1 times,
    jmp instr2 ; Go to instruction 2
cmp3:
    cjne R0, #3, cmp1 ; If ISR ran 1 times,
    jmp instr3 ; Go to instruction 3

instr1: ; Instruction 1 code
    mov 0x90, #0x00 ; Pull GPOI window down
    mov A, #0 ; Instruction to execute (mov A, #data = 2 clock cycles)
    mov 0x90, #0x01 ; Pull GPOI window up
jmp end_loop

instr2: ; Instruction 2 code
    mov 0x90, #0x00 ; Pull GPOI window down
    div AB ; Instruction to execute (div AB = 4 clock cycles)
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
nop
    mov 0x90, #0x01 ; Pull GPOI window up
jmp end_loop

instr3: ; Instruction 3 code
    mov 0x90, #0x00 ; Pull GPOI window down
    add A, R0 ; Instruction to execute (add A, R0 = 1 clock cycles)
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    mov 0x90, #0x01 ; Pull GPOI window up

end_loop: jmp end_loop

end

Update: What am I missing to make the chip respond to the interrupts correctly (only when the interrupt pulse is present), and exit the ISR when the pulse is over (it should check for that every time it finishes the ISR completely)?


texts: LM317LZ LED driver circuit - wrong output current

texts: I built a minimal LED driver circuit using a LM317LZ and a 12 Ohm resistor between OUT and ADJ (identical to e.g. Understanding this LM317 LED Driver circuit). According to the datasheet this should give 100 mA output current but in fact it it is around 60 mA. Input voltage is about 40 V, the LED is a COB LEB which has aprox. 32 V forward voltage at 100 mA. The voltage drop across the resistor is 0.55 V. What am I doing wrong?


texts: Why does the electrical power of a generator that is close to the short-circuit fault location decrease?

texts:
I was reading about shunt faults in power systems in the book Fundamentals of Power System Protection by Y.G. Paithankar and S.R. Bhide and the following sentence confused me:

  "Further, in an interconnected system, there is another dimension to the effect of faults. The generators in an interconnected power system must operate in synchronism at all instants. The electrical power output from an alternator near the fault drops sharply."
  Blockquote

Why should the power of the generator decrease?

Is it because the voltage across the generator will decrease by a greater amount than the current increase? If so, why should the voltage decrease?

Here's is the how I understand it:

The rotor, which produces the back EMF, and, consequently, the current, of the said generator, will continue to rotate at the same speed, so with the current increase from the short-circuit fault the overall current of the generator should be very high and the power should drastically increase.


texts:
I have a question about the dimming of Led drivers. I have a lot of LED drivers which can use pulse dimming or 1-10V dimming. One problem I have is that I realized too late that by using pulse dimming, the drivers could be going out of sync. I do already have installed my pulse-dim buttons and I also already installed the drivers.
I would like to use 1-10V to control the dimming as the drivers will stay in sync. But now I have to find a way to convert from a button to 1-10V without losing the dimming functionality of the button. I don't want to try and design a circuit myself to fix this, but rather find a module that does this exact thing for me. Does such a module exist?
Note: I have searched a lot already myself on google, but untill now I have not been able to find the right module.


texts: True 5V CPLD other than PIC/Altera ATF150*?

texts:
Are there any True 5V CPLD's families still in manufacturing other than PIC/Atmel ATF150*?

I am talking not just "5V tolerant IO", but rather ones with 5V VCCIO, able to drive 5V loads without external pull-ups. I've heard Chinese are joining FPGA/CPLD race, maybe there is a chance?


texts: I am planning to purchase a CNC-ready mill from its manufacturer but put the controls together myself separately using various off-the-shelf components. The control system will be based on the Arduino Uno along with a daughter card known as the gShield which can drive three stepper motors. This board contains three TI DRV8818 Stepper Motor Controller IC's, one for each motor. The data sheet states "up to 2.5A per winding" for the driver IC. The stepper motors have many constraints so the number of suitable ones that are in stock are limited. I have found one that is rated at 2.0A and another one that is rated at 2.8A. My instincts tell me that I should select the 2.0A stepper so that it will not exceed the output on the driver. However, some current sources are current-limited so it would be okay to drive a load that is rated at 2.8A because the driver will not exceed the capacity of the load. My worry is that if the driver forces 2.5A into a 2.0A winding then it would threaten the winding on the stepper motor with burn out. Can anyone give me the correct reasoning for matching stepper motor to driver?


texts: Can small earth magnet’s (1/8” thick x 1/4” dia.) glued to the outside of a jigsaw with a brushless motor cause damage?

texts: I have attached 4 small earth magnets to the outside of my (brushless motor) jigsaw to keep extra blades handy. Could they damage/interfere with the motor in anyway?


texts: Is there a battery with smaller cells inside of it?

texts: I vaguely recall reading a place that a simple way to get small battery cells is to open a battery which contained 5-6 of these. I thought it was an AA battery, but I've been Googling, and have found that they don't seem to contain anything of the sort. So I'm wondering, am I just making up things, or is there a battery that suits my description?


texts: Misunderstanding from the author saying,about the current flowing path

texts:
The author show the working process of  this schematic

1.The proposed system waits until the PZT device stores the energy vibrations produce during the positive half of vibration period \$T_{VIB}\$ before engaging switches \$S_I\$ and \$S_N\$ to discharge \$C_{PZT}\$ into off-chip harvesting inductor \$L_H\$

2.The inductor current \$i_L\$ rises to reach the peak, then the switches \$M_{P1}\$ and \$S_I\$ de-energize \$L_H\$ into the battery via \$i_{BAT}^+\$

3.The system again waits for the transducer to energize \$C_{PZT}\$ (in the negative direction) through the negative half of \$T_{VIB}\$ before prompting \$S_I\$ and \$S_N\$ to discharge \$C_{PZT}\$ into \$L_H\$, after which \$M_{P2}\$ and \$S_N\$ deenergize \$L_H\$ into the battery

I sort out what the author said:

1.the PZT will produce energy first,then \$S_I\$ and \$S_N\$  be "on" to let the current flow from \$C_{PZT}\$ to \$L_H\$

2.\$M_{P1}\$ and \$S_I\$ disconnect,and let the \$i_{BAT}^+\$  flow from the \$L_H\$ to the battery

3.when the PZT produce the negative part voltage,\$S_I\$ and \$S_N\$ are "on",and the negative current flow from the \$C_{PZT}\$ to \$L_H\$(this current direction is the oppsite of 1. current direction in the \$L_H\$  ),then \$M_{P2}\$ and \$S_N\$ disconnect to let the current flow from the \$L_H\$ to the battery

Hold on a second,i have a question about the 2. and 3.,if the \$M_{P1}\$ and \$S_I\$ disconnect,why can the \$i_{BAT}^+\$  flow from the \$L_H\$ to the battery?why can \$M_{P2}\$ and \$S_N\$ disconnect to let the current flow from the \$L_H\$ to the battery?It seems that i misunderstand something from the author saying,but i don't know which part do i misunderstand,can anyone correct my mistake?


texts: Controlling BLDC motor with Raspberry Pi

texts:
I'm trying to figure out how to control the speed of a 400-watt, 3000RPM, 48V BLDC with Hall sensors with a Raspberry Pi 3.  I've been able to find information where people will us an ESC like this between their rPi and the motor but these seem to always be connected to small motors like airplane motors and not the one like what I have.  But then I've also seen controllers like this and then also little boards like this.

I would appreciate any direction someone might be able to provide.  Thanks!


texts:
I'm working on dsPIC30F2020 to read two analog channels sequentially on AN0 and AN1. But all I got is only the value from AN1, so what's wrong with my codes below? Thank you very much for the help

#define FCY 8000000UL // FCY = FOSC / 2

#include <xc.h>
#include <stdio.h>
#include <libpic30.h>
#include <p30F2020.h>
#include "config.h"

int main(void)
{
    int channel1Result;
    int channel3Result;

    /* Set up the ADC Module */

    ADCONbits.ADSIDL    = 0;        /* Operate in Idle Mode */
    ADCONbits.FORM      = 0;        /* Output in Integer Format */
    ADCONbits.EIE       = 1;        /* Enable Early Interrupt */
    ADCONbits.ORDER     = 0;        /* Even channel first */
    ADCONbits.SEQSAMP   = 1;        /* Sequential Sampling Enabled */
    ADCONbits.ADCS      = 5;        /* Clock Divider is set up for Fadc/14 */

    ADPCFG              = 0;        // all ANx analog input
    ADSTAT              = 0;        /* Clear the ADSTAT register */

    ADCPC0bits.TRGSRC0  = 1;        /* Use SW trigger */
    ADCPC0bits.IRQEN0   = 1;          /* Enable the interrupt   */
    ADCPC1bits.TRGSRC2  = 1;
    ADCPC1bits.IRQEN2   = 1;

    ADCONbits.ADON      = 1;        /* Start the ADC module */

    /* Set up the Interrupts */

    IFS0bits.ADIF       = 0;        /* Clear AD Interrupt Flag */
    IFS2bits.ADCP2IF    = 0;

    IPC2bits.ADIP       = 4;        /* Set ADC Interrupt Priority */

    IEC0bits.ADIE       = 1;        /* Enable the ADC Interrupt */
    IEC1bits.AC1IE      = 1;

    ADCPC0bits.SWTRG0   = 1;        /* Trigger the Conversion Pair 0 */
    ADCPC1bits.SWTRG2   = 1;

    int a1;
    int a2;

    // enable UART communication
    U1BRG = 12; // baudrate
    U1MODEbits.UARTEN = 1; // enable UART

    PORTA = 0xffff;
    TRISAbits.TRISA9 = 0;

    while (1)
    {
        PORTAbits.RA9 = 1;
        while(ADCPC0bits.PEND0);    /* Wait for the 2nd conversion to
                                       complete */
        channel1Result  = ADCBUF1;  /* Read the result of the second
                                       conversion   */
        while(ADCPC1bits.PEND2);
        channel3Result  = ADCBUF3;

        a1 = channel1Result;
        a2 = channel3Result;

        ADCPC0bits.SWTRG0   = 1;    /* Trigger another conversion */
        ADCPC1bits.SWTRG2   = 1;

        printf("data 1 : ");
        printf("%d", a1);
        printf("\t data 2 : ");
        printf("%d", a2);
        printf("\n");

        __delay_ms(500);
    }
}

void __attribute__ ((interrupt, no_auto_psv)) _ADCInterrupt(void)
{
    /* AD Conversion complete early interrupt handler */

    int channel0Result;
    int channel2Result;

    IFS0bits.ADIF       = 0;        /* Clear ADC Interrupt Flag */
    IFS2bits.ADCP1IF    = 0;

    channel0Result      = ADCBUF0;  /* Get the conversion result */
    channel2Result      = ADCBUF2;

    ADSTATbits.P0RDY    = 0;        /* Clear the ADSTAT bits */
    ADSTATbits.P2RDY    = 0;
}


texts:
Most textbooks use this circuit as an example of the most basic RC circuit.

The solution for V(t) for this circuit is (if capacitor is initially uncharged):

I've had an exam recently where the resistor/or capacitor was to the left of the switch. My question is will the general solution to this circuit change in either of the two cases?


texts: I've seen many conflicting answers online: For optical storage, does a pit represent a '1' bit or does a land represent a '1' bit?

texts:
I've seen many conflicting answers online so:

When reading an optical disk, which one of these is true:

A 'pit' represents 1 and a 'land' represents 0

or

A 'pit' represents 0 and a 'land' represents 1


texts: What's the simplest 110ac to 5vdc circuit that can power an ESP wifi board?

texts:
I've found this esp with relay pack:

The only thing missing for this board to work is the 5v dc power supply. Normally a 110vac-5vdc power supply will have some filtering and other things needed to charge batteries and so. I think these things can be removed from the equation. I need something that will still make the entire set (the relay shield with esp + power supply) very cheap.

I know that it's pretty easy to convert AC to DC using diodes and possibly other very very cheap components. What about converting from 110v to 5v? What is the minimum that needs to be done for the ESP to work without entering in a buggy state?

If possible, is there a tiny board available with this solution?

link for the product


texts: Multiplexer CD74HC4051, connections and parameters

texts:
I'm testing a multiplexer from Texas Instruments, below is shown the cabling I've done. But varying the select pins(9,10,11) has no effect, nothing happens. The LED always stays on.
Vcc is 5v connected to Arduino board.

What could I have done wrong?
Do I need to put in some resistors?


texts: LM317 regulator with NPN pass transistor alternatives and ripple consideration

texts:
I have built a simple LM317 regulator power supply and would like to add a pass transistor to provide more current and lower output impedance of the circuit.
Here are two alternatives, one I copied and adapted from another question here, using a PNP and NPN transistors, and another which is using only an NPN transistor (adapted from a source using LM338 and multiple 2N3055s in parallel).
The supply will be used for powering an Allo.com Katana DAC and a Raspberry Pi (two similar supplies) so the requirements are 5V at 1.2A (DAC) and 5v at 3A (Rpi with extra usb devices), with very low ripple (in microvolts) and very low output impedance.
I have already measured the supply with and without Cadj, and the ripple is so low (50uV) that I decided not to add a capacitance multiplier. The problem is that the audible DAC sound dynamics were much lower than even a cheap smartphone charger, and it was pointed out to me that the regulator has a relatively high output impedance that I should mitigate by adding a pass transistor and/or much more output capacitance.
So my question is which of the alternatives should provide better performance, and does using only a NPN transistor negatively affect the ripple?


texts: Using a Mosfet to control current through a resistive network

texts:
I am trying to measure the voltage level of a battery with a microcontroller and a bit of circuitry  (since the voltage level will be above 5V). A simple circuit like this can be constructed to measure the battery voltage with an MCU's ADC capabilities:

simulate this circuit – Schematic created using CircuitLab

However, I want the battery to be loaded by this external circuitry only when measurements are taking place. The circuitry in the schematic above will continuously load the battery with a leakage current flow from the zener diode (which is present to ensure the voltage level never exceeds 5V to safely measure with the MCU ADC).

So, I thought about using a enhancement mosfet as a switch. The design specification would be such that no load on the battery exists unless the mosfet is turned on. The only way I was able to successfully implement a mosfet was after R2 .. but that really defeated the purpose. In this way, without current flow (mosfet off), V1 appears across the zener and the device will significantly conduct current if it's > 5V (in this case it is). So that design is actually worse than not using a mosfet at all. Without the zener diode in place there is no protection from placing a high voltage (higher than 5V) at the terminals of the MCU.

simulate this circuit

I then tried to place the mosfet before R1, but experienced significant voltage drop across the device that I was not able to explain (I am not that fluent with these devices).

I could replace the zener with an integrated regulator, but they have load currents also and the voltage will be lower than 5V at times which causes non-linear output (compared to the zener which does not alter voltages under its breakdown).

Any ideas?


texts:
I like the aesthetic of clear acrylic mounting of PCBs and I want to use it for a project I'm working on. For example as seen in the Mighty Ohm Geiger Counter,

Is esd something I should worry about? The project like the Geiger counter above will be handheld for use.

Also somewhat related, is it safe to use plain old rubber foam as padding with regards to esd (where the rubber foam would be in direct contact with traces and maybe some components on the PCB)? And what about as a substitute for rubber bumpers?


texts: What effect do R5,R6,R7,R8 have on the following DSBSC Modulator?

texts:
I know that the first 741 essentially adds m(t) and c(t).The gain should be 1 so why do we have 3.9kohms resistance ? What use is it ?
The second 741 circuit is a band pass filter . I think there is a high pass filter first (R7 and C1 ) and then a low pass filter (C2 and R9) and an amplifier at last. What use are R6 and R8 ? How do they contribute to gain ?


texts:
Perhaps this question may sound silly,and am sorry if there are similar questions answered already because i couldn't find one, as per guidelines.
Mask ROM(MROM) are programmed while manufacturing,PROM can be programmed after manufacture and same follows to EPROM and EEPROM similarly  how are ROM's are programmed.
I assume ROM and MROM are two different things,latter one with program in it loaded while manufacturing.
Also if i have wrong concept in my head please make it clear.


texts:
The antenna factor equation in a 50-ohm system is expressed as:
$$AF={9.73 \over \lambda*\sqrt(Gain)}$$
Where Gain is in dB, the wavelength in meter and the calculated AF is in dB/m.
$$$$
First, How the unit of the calculated AF is in dB/m?
$$$$
Second, there is also another shape of the antenna factor formula where:
$$AF={20*log({9.73 \over \lambda*\sqrt(Gain)})}$$
Where Gain is in numeric form and the AF is in dB/m.
May I ask for some help about deriving this equation?
$$$$
In case of a negative gain (in dB), I converted it to a numeric form knowing:
$$Gain (dB)={10*log(Gain(num))}$$
$$$$
and then used the second formula. Is it ok to do so?
$$$$
Last, How it is possible to convert dB/m to 1/m.
Is it Ok to use this general formula?
$$AF(db/m)={10*logAF(1/m)}?$$
Thanks.


texts:
I would like to build an amplifier can serve as an electrometer (measuring voltage with very low input current/high input impedance) at high bandwidth, ideally up to 10MHz.  Think of it as a hybrid between an electrometer and LNA :)  Desired specs: input current as low as possible (femtoamps), noise as low as possible, bandwidth >10MHz.  This is the front end of a custom instrument in which I am trying to measure microvolt signals from a source with impedance >100MOhm at 5-10MHz.  The source is physically small, fits in a 1mm cube.

There seem to be at least two big problems with this:

The standard electrometer-grade op-amps have very low bandwidth, for example OPA129 has offset/bias current of 30fA but unity gain bandwidth of 1MHz.  (Another device, the LMP7721 looks nice with 3fA offset and 17MHz bandwidth)
I assume the source would have to be very close (essentially located between the input pins of the op-amp), but it seems even the tiny parasitic capacitance would be enough to short-circuit a lot of the signal at higher frequencies.

Any suggestions for how to approach this problem?

Update: Thank you for the helpful discussion.  I am not completely sure of the source properties, I made an order of magnitude guess from a rough physical model.  What I do know is that most simple amplifier configurations hooked up to that source show no signal, so the signal has got to be very weak.  It appears that accurately modelling the source is key for making any progress.

I am aware of thermal noise, and indeed the signal I am looking for may be quite weak compared to thermal noise.  It may be possible to see it by integrating over time (after digitizing) despite that.


texts: Adding delay to pulsed signal in matlab code with PWM block

texts:
How can I generate a pulsed (rectangular) signal such that, total period = 500ms (simulation time); clock frequency = 10kHz; pulse should occur every 20 ms. Duration of the pulse is the clock period and the pulse should shift with a phase shift of 2ms for 50 % of total simulation time and for the remaining 50% the phase shift should decrease by 2ms every pulse duration (ie. after each 20ms the pulse should shift by 1ms to the left i.e. decrease in a shift as compared to previous shift).

The desired input is a MatLab code that can be fed into the main.c function block in Simulink. The output of this main.c block would be the compare value to be fed to the PWM block in Simulink.


texts: Frequency multiply a digital signal using pure digital ciruitry (i.e. without PLL)?

texts:
Is it possible to multiply the frequency of a digital signal using digital components alone, and at the same time, preserve the duty cycle?

I could finally come across the circuit below: it doubles the frequency by exploiting the propagation delays of the components, but sacrifices the duty cycle.

I was wondering if a better solution (that preserves duty cycle) exists, but could not find any. I know this can be done using PLL, but I'm looking for a solution which uses only digital components.

Thanks for your help

EDIT:

Sorry I didn't mention this earlier, but the input signal is the fastest one in the system. So, sampling it would not be possible.

EDIT 2:

A bit into the history behind this question: During the final year of my engineering degree (way back in 2009), we had this circuit-design contest in our college and I was part of the team that organized it. We wanted to make the event rather lively and after some brainstorming, we came up with this weird idea of a "frequency multiplier using only discrete logic gates" as one of the challenges. We were well aware that pure boolean logic could never achieve something like this, but then, real-world logic gates had propagation delays; so we quickly wired up the circuit above using 74xx gates and saw that it worked. So we gave it to the contestants, with a bonus offer for any team which preserved the duty cycle of the input wave. Even though many of them came up with the above circuit, no one was able to do the bonus part. So far I've not been successful in doing it myself; Google was not so helpful either.

So I was just wondering if someone in EE could help me out in case they've already had some experience on this. Even an answer which says "this can never be done" is welcome, though I have a gut feeling that there is some solution lying around..


texts:
I have a portable diagnostics tool which communicates with an electronic appliance using which I believe is Synchronous Serial Interface (SSI).

I'm looking for a way that I can extend the range of this tool over LAN so that a the appliance can be connected to PC1, and the tool to PC2, and software running on both PCs bridge the SSI over LAN.

This is a circuit diagram showing the tool connection to the appliance board with inputs labelled SCK, CLK, RXD, TXD, VCC, GND: (I have already established that the tool can be powered directly by applying 5V between VCC and GND).


texts:
I'm trying to use the FDC1004 capacitance-to-digital and I have a few questions:

Why do we (our fingers or another part of our body) act as the other conductive plate - don't we have a very large resistance? The image below shows the finger grounded but why does it show that - isn't the resistance between us and the ground extremely high?

How does changing the finger from the picture above to a metal plate affect the capacitance reading? Since the metal plate is more conductive and has a greater effective surface area will my capacitance readings be higher?
I was thinking of putting some sort of compressible material on top of the sensor and then adding a metal plate on top of the compressible material. This way I will create a large capacitor - I would have two conducting surfaces separated by a dielectric. If I put an object on top of this setup the dielectric material will compress, causing the distance between the plates to decrease and increasing the capacitance reading. I want to use this behavior to measure the force/weight of an object but I'm concerned that if I try to measure the force of someones finger pushing down (or something else conductive) it might drastically change the results since i am introducing another 'conductive plate' into the system.

In the picture above, the blue line would be someones finger coming to push down on the force sensor - wouldn't the finger start to change the field lines and cause significant changes in capacitance before any compression starts to occur ?


texts: Resistors on decoupling capacitors in ADC Layout Guidelines

texts:
The datasheet for TI's ADS8691 ADC chip has the following diagram in its layout guidelines. I just have a few questions about the resistors in the diagram, which I don't believe are mentioned anywhere (but are presumably common knowledge to an electrical engineer).

What is the purpose of the resistors in series with the
ground-decoupling capacitors for the REFCAP and REFIO pins (4 and
6)?
What is the purpose of the series resistors immediately after
the capacitor on the analog input pins (the two directly below 5 and 6)? What about the next resistor immediately in series on the analog ground trace (why is it it not pointless)?
What is the purpose of the parallel resistors in the optional "Analog Input" section (does this have something to do with current-limiting the TVS diode?)---presumably something to do with the inductance of a big resistor?
Finally, if it isn't obvious from your explanations, what are reasonable choices for these resistances? (If input signal frequency really matters, please assume ~50Hz.)


texts: Newbie problem with transistor switching

texts:
First post, so I hope that I adhere well to all the rules.
I couldn't find any other posts that could help me, so here's my problem:
I am trying to build a simple transistor switch with a 3906 PNP transistor. The end-goal of this project is to design a circuit that illuminates one of 5 different LED's to indicate the charge of a Li-Ion battery cell.
I'm starting with the Red LED which should illuminate at ~3.3V but it illuminates at ~4.8V.
My 3906 datasheet says that the minimum base current is 50 nA, so I assembled the circuit below to generate 50 nA @ 1.6V on the base when the input reaches 3.3V. I assume the issue is that I'm biasing it badly. (I am trying to get my head around transistor theory and failing, me thinks).
Please forgive me for this terrible MS paint schematic done with a laptop mousepad.


texts:
I want to generate square wave but there are some challenges. Rise time should be less than 2ns as well as fall time (for 0V to 5V). Duty cycle is not so important it should stay high like 40 ns. I am searching for a solution I found these ones but I am not sure if they work for that much high frequency:

Using an FPGA

rf2506 signal generator

ADCMP580 Voltage Comparator. (in data sheet it says 37 ps typical output rise/fall)

Using basic inverting schmitt trigger circuit.

Using high frequency crystal oscillator with schmitt trigger.

Does anyone have an idea about these ideas? Or should I try different method?


texts: Design for a common source FET Amplifier Circuit

texts:
Here's a design question our prof gave us to study for the exam. I'm having trouble putting it together.

A common source amplifier is shown. The FET is working in saturation and has gm = 0.5mS, Kn = 0.5 mA/V^2, Vtn = 1v and lambda = 0.02V^-1. The resistance of the signal source is 2kohms. There is a maximum gain of 112, and Id = 0.24mA. The circuit has output resistance of 20.9kohm, and input resistance of 892kohms.
Determine Vds.

Alright so my thoughts when trying to come up with a solution were as follows:

1) It's given that the MOSFET is in saturation therefore:
0.24 = 0.25(Vgs - 1)^2(1+0.02Vds)
2) We know Vd = 12 - (Rd)(0.24)
3) We know Vs = 0.24(R5 + R4)

Also, this is DC analysis, so the capacitors act like open circuits; technically only the middle part of the circuit is off concern.

I don't know how to take it from here; we're not given any of the resistor values and it seems like there's simply not enough equations to cover the unknowns. I presume it's got something to do with the provided input and output impedences, but I just don't know how to apply them. Any help would be appreciated


texts: AC current measurement using shunt resistor

texts:
I need to measure AC RMS current using shunt resistor. AC current range is 0-8A RMS. Shunt resistor chosen is 100 mohm. which gives me max 8*1.414*10=1.13 Volt that i will use to feed an opamp to further amplify it to around max 3V with proper gain setting. and that will go to my micro controller ADC ( 0 to 3V only). Since in my circuit only positive supply is there so I used single supply op amp, (Negative half cycle will be chopped by opamp, i think). below is the ruff circuit.

which circuit out of below two looks ok to start.


texts: Resistor Values to switch a 100ma led with a on a 5v power supply with 2n3094a 3.5v base

texts:
I have a 100ma infrared led (1.2-1.4v), a 2n3904 transistor and an arduino-alike with a 3.5 and 5v power supplies, and 3.5v digital output.

I tested my stuff driving the LED directly (with appropriate resistor) and it was fine, but very short range, so I put in the transistor to beef up the power... But as a bit of noob to hardware have got stuck...

I used 2 100ohm resistors cos they are only .25w, and I worked out this would give the led 80ma and they'd split 0.32w.

What should the base resistor be (R3)? (and how should I have calculated it?) I tried an online simulator and put in a rheostat for some trial and error, expecting to do some reverse engineering when I got a figure) but I was getting readings of the base drawing 4amps... which didn't seem to make sense...

Help! Thanks.

[


texts: Is there a way to solve this circuit using Nodal Analysis?

texts:
Please, take a loot at this circuit:

Obviously, this is a circuit that is very easy to solve using lots of different methods. However, I'm trying to solve it using Nodal Analysis (I'm not sure if it's possible).

I tried to use node B as reference. When I do it, I notice that the voltage from C to B is known (10V). The voltage from A to B is already known (20i). So, there's no equation to find.

I would like to know if this circuit is already "solved" (voltages are known) or if I'm missing something here. I just can't find any useful equation taking B as the reference. Even if I try to find a equation using node A, I can't go forward since I can't find find the current that is passing through the dependent source.

Thanks!


texts: Building a simple switching regulator for DC12V -> DC5V

texts:
I want to build a circuit that provides USB power from a 12V battery (lipo or car battery).

I have an iPad that draws 2A from its charger: So I'd like to get up to 10W output.

What's a good choice for IC and inductor (and other components) for making this?