texts: Transistor - rise time for switching applications

texts:
I've been looking at basic theory of Bipolar Junction Transistor.

In switching application design, in order to have a saturated transistor it is often required to find an appropriate value of the base current. By looking at the questions answered on the subject, people tend to use a ratio Ic/Ib much smaller than the parameter hFE,min found on the specific transistor datasheet. Some answer advise not to use a very low value of the raio Ic/Ib when dealing with fast switching applications, otherwise the transistor may not reach the fully on state in time.

After a quick look at wikipedia, there seems to be a lot of models for BJT. I was looking for some equations or charts relating the rise time and fall time of a transistor for a given Ic and Vbe; so far I found "nothing" (more like a lot of confusion in my head). This would be very helpful since I'd like to control the transistor with a PWM signal coming from a microcontroller (in my case a Raspberry, where the PWM signal is characterized by a frequency and dutycycle).

EDIT:

I've kept the question kind of general to get a basic understanding of the physique behind BJT, anyway as some of you pointed out, it would be helpful if I can provide more information.

I want to drive a 12V 0.4A fan with Raspberry Pi 3 (application: thermal control). By connecting the fan directly to the 12V power supply I've measured the maximum current drawn, which is (not surprisingly) 0.4A. So I assumed Ic=0.4A. I only have three transistor types: TIP120, BC517, BC337. The latter is definitely not a good choice because of the low gain. I hated the idea of using one TIP120 to control only 0.4A so I decided to use BC517 (I'm not worryed about the heat dissipated: the fan is directly blowing air over the circuit).

Then I looked at what resistor I could use as base resistor. Long story short, I was lazy and nearby me there were only 1k resistors. Let see if I end up in saturation. Assuming Rb = 1k, from datasheet I found Vbe(on) = 1.4V, Raspberry GPIO pin output is Vpin = 3.3V, then: Ib = (Vpin - Vbe(on))/ Rb = 1.9 mA (which is well below the maximum output current of GPIO pins, so I'm good). The ratio Ic/Ib = 210; from datasheet \$h_{FE,min} = 30000\$. I would say the BC517 is saturated.

Now to the practical part: this is the circuit I'm using.

simulate this circuit – Schematic created using CircuitLab

With a ductycycle = 100%, I don't have to worry about the frequency of the PWM signal. I'm not sure If I remeber correctly, but I think I measured Vce = 0.85V. Given that, I was expecting to see a flowing current of (12V - Vce)/12V*0.4A = 0.37A. Instead, the maximum current drawn by the fan is 0.355A. There must be some other dissipative factors.

With dutycycle < 100% the frequency of PWM signal is definitely going to affect the switching performance. After setting the dutycycle = 95% and testing a few frequencies, this is what I've got (I only tested 4 frequency, then my multimeter battery dropped below the safe level so I stopped taking measures):

As you can see, the collector current decreases a lot by increasing the frequency. My guess: by increasing the frequency, the period of Ib get smaller and smaller. Eventually the rise time of the transistor may be longer than the dutycycle, hence there will not be a \$t_{on}\$  time.

This is what triggered my original question. It would be nice if there was a mathematical way to relate the transistor rise time, fall time, t-on time with Vbe and the frequency of the switching signal.


texts: Electrical Power production response to complete transition to electric vehicles

texts: Just wondering if current world wide power grid capacity could handle a complete transition to electrical vehicles. If every existing vehicle was electric would the existing power production handle it on a global level?


texts: Powering Arduino pro mini v5 with NimH batteries

texts:
I am currently working on a hand prosthetic and am developing a wearable wristband to read emg signals. The wristband contains the following:

1) Arduino Pro mini 5V ( Typical supply voltage: +5.0 V, Typical supply current: 10-25 mA)

2) Transmitter Module ( Typical supply voltage: +5.0 V, Typical supply current: 03-10 mA)

3) Myoware muscle sensor ( Typical supply voltage: +5.0 V, Typical supply current: 09-14 mA)

I am currently looking for a battery to power these components. The battery needs to be as small and as light as possible. It also needs to be rechargeable. There is no minimum operation time due to the project being a prototype, however, the longer the duration the better. I am currently looking at a Nimh Battery Pack 2/3 AAA 300mah 4.8v Receiver SQ Premium Sport

( http://www.overlander.co.uk/nimh-batter ... sport.html )

QUESTION 1) Will this battery work fine with the components mentioned above?

QUESTION 2) will it work for roughly hours as I calculated?

0.3 Ah /(25 mA+10 mA+14 mA)= 6 h

QUESTION 3) I think I need a 5V step-up voltage regulator. Is that true?

Thank you for your time :)


texts: Capacitance - Voltage characteristic diagram in a Schottky diode

texts: I 've searched the web for that diagram with no satisfactory result. Does a schottky diode has capacitance or not because of very tiny depletion (almost none) zone ?


texts: PT100 sensor for measuring liquid resin, fully submerged

texts:
Edited

Link to Pt100 sensor (That's the best i could do)

https://www.intech.co.nz/products/temperature/mrh.html

Link to ESP8266 datasheet

http://www.handsontec.com/pdf_learn/esp8266-V10.pdf

Original

First of all, I am bit of a noob in electronics so i beg your forgiveness.

So i have a question. I have a manufacturing process where we "melt" resin into liquid form and i want to keep track of the temperature (range probably about 100-200 'C ) in an IOT way (Web dashboard, MQTT).

I am thinking of using a 3 wire PT100 with a ESP8266 Nodemcu using wheatstone bridge configuration. The sensor i am thinking of using will look something like this

Questions:

The equipment on which i will be fitting this sensor will be essentially a very large vessel and most probably there will be chances of the whole probe getting submerged in the liquid resin. How this will effect my reading ? Can this create complications or even damage the probe.
I am not able to find a circuit schematics for a 3 wire Pt-100. I will be really glad if somebody could literally spoon-fed me on how to make the circuit.

Thanks !!!


texts: How can I charge just one Lithium Polymer cell?

texts:
I have a small 3.7V 100mAh Lithium polymer battery. This is just like any other Li-Pol battery, but it is smaller.

Like any rechargeable battery, I want to recharge it. From what I found online, I see this technology needs a different process to recharge than usual, but there are products that do it for me and I just need to plug cables.

Now the problems begin. I searched in online stores, like eBay and every product says 2S or more (this means 2 cells). Maybe this is good for people that have big Li-Pol battery, but not for my purposes.

So, can I just recharge my one battery with one of these? Will doing so cause problems? Or if it need 2 cells, well, I use two of then in parallel (or in series) and do it. This is not the best solution...

Can someone recommend a good charger for just one cell or the proper method for charging multiple battery cells?


texts:
A product consisting (electronically) just of a PCB with a male USB-C one one side, 5mm of traces and a female USB-C on the other end. No other components at all. To be used as consumer device.

How much FCC and CE testing would really be required, if any?


texts: How much energy does cache memory consume in a modern processor?

texts: What fraction (on average or range) of total processor energy consumption does the cache subsystem consume in modern processors (say post 2009)?


texts:
To salvage a server with a broken BIOS, I am attempting to in-situ program a chip via SPI using a Raspberry Pi 3B:

After connecting my clip and wiring it up (and measuring all the leads to ensure I have the correct pinout), I have the problem that all dumped files are different, as well as flashrom not always recognising the chip correctly. This happens at higher and lower clocks (I have tried 32-64-128-256-512 kHz, 10, 9, 8, 7 mHz).

The Flashrom Wiki has a page for common problems and solutions, where they mention using parallel capacitors or series resistors. While googling I found pages of electronics courses which explained you may sum the capacitances of parallel capacitors, but not how to connect them. I suspect there might be other ways to improve the connection as well.

How could I add or remove components in order to get consistent reads with this?


texts: Is it possible to check max storage address of a SD card via a command?

texts:
How much memory can an SD card hold?

I am not going to use a data format. I want to use it as an upgradeable internal storage. So I want to know in which range of addresses I can work. Maybe there is a command for this?

I don't know if it's relevant, but I am using it in SPI mode.


texts: Can you die when your plugged-in mobile phone falls in the bathtub?

texts:
I have questions related to the safety of using mobile devices in the bathtub. I always thought the danger in dropping it or getting water on it is mostly to the device, not to the person, but a recent accident made me doubt that.

Is it possible to die from the charging end of a high-power USB charger (which can deliver up to 20V) in the bathtub?  (The charger itself would not be in the water, nor would be the wall cable.)
Is a mobile device dropped in the bathtub dangerous (to the person, not the device ;-) )?
Are there known instances when a submerged mobile device started to burn? (After all, the battery contains Lithium which can burn under water, and Lithium battery fires cannot be extinguished with water.)


texts:
I just want to know what is difference between pass by ref and pass by val in systemverilog?

I can't find any example.also expecially, what is this? Does anyone know what is this and explain?

 interface xxx
  ...
 event yyy;
 event ggg;

 modport io_bus ( ref yyy,
                  ref ggg,
                  ....
                 );
 endinterface


texts: How do you determine which baud rate to choose, its relation with MCU clock and oversampling at RX

texts:
1) How do you determine the baud rate that you want for your application while considering the clock of the MCU?

Baud rate = number of bits / second. The most common baud rates used are:

9600 = up to 9600bps = 104uS per bit

2) So if I were to send out a data stream higher than 9600Hz, I would be better off using a baud rate higher than 9600 to avoid data corruption? I feel there's more to it than just that.

3) if we use USART with a clock, isn't data sampled at each clock pulse (rising/falling etc)? If you've got a 16MHz MCU clock, meaning you're putting out clock pulses every 62.5ns, and if you were to use a baud rate of 9600 for data, how do 104us and 62.5ns work out? Or as long as I'm using a faster clock than the TX data speed, I'm good cause MCU is capable of sending as fast as the clock?

4) What's the essence of oversampling (8,16) of the data on the RX side? if the baud rates are the same on both TX and RX, the data received is at the same speed as it's being sent. Or it has more to do with external noise that might corrupt the data? Even then, where does parity come into play then?

Follow up:

4.1) why are 3 middle out of the N samples are sampled and considered for noise detection, as shown in the image?

4.2) With oversampling, you're technically reducing the resultant baud rate since you're taking only three samples?

4.3) Does oversampling by 8 have more receiver tolerance to clock deviation cause it generates a higher speed than oversampling by 16 mechanism?


texts: Arduino with FTDI cable - USB port error

texts:
This is my first time using FTDI with Arduino.

I'm using the SparkFun EL Sequencer which uses and embedded ATMega328p. I hooked it up to my USB port using this FTDI cable. When I try to upload my code: I get the following error:

avrdude: stk500_getsync(): not in sync: resp=0x00

Debug mode:

avrdude: usbdev_open(): did not find any USB device "usb"

I've used my regular USB cable to successfully program my UNO from this machine (Win 7) before. No problem there.

With the sequencer I see the machine detecting a connection on COM 7 when I plug in the new device. I've tried pressing RESET on the Arduino prior to uploading, which I've seen in some other posts.

Am I missing something here? The description of the cable seems to imply that I don't need any other hardware.


texts:
I've designed an RF device that runs via a USB connection to a PC. It needs to be connected to an outdoor antenna to receive a telemetry signal.

On the antenna input PCB trace i've added an ESD diode rated to 15kV, as well as a gas discharge tube and a clipping diode to protect the sensitive RF input MMIC. As far as I know all these ESD protection devices work by shunting ESD pulses to ground, and they require a good ground (earth) connection to actually work.

But what happens if there is no ground? For example one scenario might be that someone inexperienced connects an ungrounded outside antenna (which we are assuming has built up a large ESD charge), BEFORE connecting the USB cable (meaning that the USB shield/GND is not connected).

In this case there is no ground for these ESD protection devices to shunt to. Is the MMIC probably going to be damaged in this case?


texts:
I'm trying to understand the causes of output voltage dropping as my load increases on a boost converter.
The switcher i'm using is a TPS61093 from TI. I'm troubleshooting a circuit that someone else built. It is built exactly as the reference design shows below, except Vout = 12.1V.

Vin=4V
Vout=12.1V
L1=10uH
R1=232K
R2=10K
R3, C6 open
R4 short

The issue is that on my bench:

As I increase the load past 45mA, I start seeing a drop in the voltage.
50mA -> Vout=11.11V, this drops further as I further increase the load.
I see on the input a Iin = 264mA (current input to the smps) which seems excessive given I'm pulling only 50mA. And this current increases also with increased load.

Any idea what's possibly going on?

My input drops only by 10mV when my output is out of regulation.
The enable pin is actually pulled high through a 100k
IND, WIRE-WOUND, 10uH, ±10%, 380mA, 0603, with .Rdc = 0.34Ω. The SRF is 32Mhz
As I pointed out. The designer went with the actual ref design from TI. and that design does not include C6. I'd think C6 would only improve the feedback loop stability for fast transient load or it has a different purpose.
The output capacitor is 12uF.
My power supply is not current limited.


texts:
I know a little about electronics but I don't know that much and always happy to learn.

I have an HP printer that I am using in DIY project. It as one large motor (24v from what I have read online) and one small motor (no markings and I am guessing 12v plus).

What I need to know is what is the best way to connect the motor to ac to run-off the mains.


texts: What will happen if a dependent voltage source in parallel with a dependent current source?

texts:
What will happen if a dependent voltage source in parallel with a dependent current source.

like dependent voltage source: 4Vx and current source 3Ix in parallel.


texts:
I'm using explorer 16 evaluation with PIC24FJ256GB410 Module.
And I am trying to work with the internal DAC. My code :

ANSG = 0x00 ;            // Analog function disable
TRISGbits.TRISG9    = 0; // Dac output enable
DAC1CONbits.DACREF = 3;  // setting reference to internal
DAC1CONbits.DACEN = 1;   // DAC Enable
DAC1CONbits.DACOE = 1;   // Dac Output Enable
DAC1DAT  = 0xFFFF;

Vdd = 3.3V
Vref+ input = 3.3V

At , both DACREF = 3(internal reference) and 1(VREF+) , I measure 1.2V at the output. And at DACREF = 1(AVDD) I measure 0V.
It is strange because :

DAC suppose to multiply internal 1.2V X2.
External reference also high 3.3V
AVDD - I don't know what it is because there is no such input

I appreciate your help


texts: Will a microwave induce current in a transformer placed inside of it?

texts: If a transformer, say your typical 12v wall wart. were to be placed inside a microwave and then power the microwave, will the microwaves induce current in the transformer? What will happen to the transformer?  What would happen if the transformer was also powered as well as the microwave?


texts: Small resistor value for a differentiator

texts:
I’m having a hard time understanding “pick a resistor value that is small enough so dVout/dt << dVin/dt” for a differentiator. I’m graphing 5 V DC supplied to this circuit, and even at 1M ohm and 1pF, the voltage across the capacitor reaches Vin in 10us. I don’t experiment with AC & ”high speed” yet

I get how a small resistor (R2) connected to another resistor (R1) in series, would cause a large portion of the supplied voltage to be across (R1). I’m trying to connect that to this technique and I need help.


texts: Gimbal motor periodically shaking back and forth instead of spinning

texts:
I am using the BGMC2 (http://www.rovertec.com/products-bgmc2.html) to control a gimbal motor (http://www.iflight-rc.com/ipower-motor-gbm5208h-200t-brushless-gimbal-motor-with-as5048a-encoder.html).  I am running the following code on my Raspberry pi to send the controller a PWM signal:

import os
import time
os.system("sudo pigpiod") #launch GPIO library
time.sleep(1)
import pigpio

ESC = 4
# white wire to 4 (7)
# black wire to 23 (6)

pi = pigpio.pi();
pi.set_servo_pulsewidth(ESC, 0)

max_value = 2500
min_value = 500

def control():
    print "Starting motor"
    time.sleep(1)
    speed = 1900
    while True:
        pi.set_servo_pulsewidth(ESC, speed)

def arm():
    print "Connect battery and press Enter"
    inp = raw_input()
    if inp == '':
        pi.set_servo_pulsewidth(ESC, 0)
        time.sleep(1)
        pi.set_servo_pulsewidth(ESC, max_value)
        time.sleep(1)
        pi.set_servo_pulsewidth(ESC, min_value)
        time.sleep(1)
        control()

print "Starting..."
arm()

Here is the schematic we built:

  I noticed that the controller regularly flashes the RED light labeled D2 and my gimbal motor shakes back and forth while this is happening.  I was wondering how I could go about debugging this problem to prevent the motor from shaking back and forth.


texts:
Googling for "soft latch" brings up many results, and on this site 12 out of 232 questions tagged latch contain the phrase "soft latch". However, there seem to be no references to a "hard latch" other than relating to breastfeeding and doors.

What is the difference between a latch that is soft and one that is not? What is the term to refer to the opposite of a "soft" latch?


texts: how to reduce the amplification of second order notch filter

texts:
I build a second order notch filter.it is centered at 50hz. When I
gave a sine wave signal with a sweep from 20hz to 80hz.The signal's input amplitude is 1v and the signal's output amplitude is like below.

20hz--2.2v 25hz--2.1v 30hz--2.0v 35hz--1.9v 40hz--1.8v 45hz--1.0v 48hz--550mv 49hz--430mv 50hz--320mv 52hz--550mv 60hz--600mv 70hz--1v 80hz--1.5v 100hz--2v

c2=c3=100nf c1=200nf r1=r2 r1=r2=35.3ohm r3=17.1ohm variable resistance 100k(50:50)

But i want to know why the output is 2v for 100hz and 30hz??. But my input is 1v any help on this would be greatly appreciated.


texts:
I configure my STM to receive data from SPI. The data/CLK are available on MOSI, CLK pins (checked by oscilloscope) but I received 0 value. what is my mistake?

void SPIConfiguration(void)
{
  SPI_InitTypeDef  SPI_InitStructure;
  GPIO_InitTypeDef GPIO_InitStructure;
  NVIC_InitTypeDef NVIC_InitStructure;

  RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB,ENABLE);
  RCC_APB1PeriphClockCmd(RCC_APB1Periph_SPI3,ENABLE);
  RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO,ENABLE);
  GPIO_PinRemapConfig(GPIO_Remap_SPI3,DISABLE);
  GPIO_PinRemapConfig(GPIO_Remap_SWJ_JTAGDisable,ENABLE);

  RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA,ENABLE);
  RCC_APB2PeriphClockCmd(RCC_APB2Periph_SPI1,ENABLE);
  GPIO_PinRemapConfig(GPIO_Remap_SPI1,DISABLE);

  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_5| GPIO_Pin_7;
  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;
  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
  GPIO_Init(GPIOA, &GPIO_InitStructure);

  SPI_InitStructure.SPI_Direction =SPI_Direction_1Line_Rx;
  SPI_InitStructure.SPI_Mode = SPI_Mode_Slave ;
  SPI_InitStructure.SPI_DataSize = SPI_DataSize_16b;
  SPI_InitStructure.SPI_CPOL = SPI_CPOL_High;
  SPI_InitStructure.SPI_CPHA = SPI_CPHA_1Edge;
  SPI_InitStructure.SPI_NSS = SPI_NSS_Soft;
  SPI_InitStructure.SPI_BaudRatePrescaler = SPI_BaudRatePrescaler_32;
  SPI_InitStructure.SPI_FirstBit = SPI_FirstBit_MSB;
  SPI_InitStructure.SPI_CRCPolynomial = 7;
  SPI_Init(SPI1, &SPI_InitStructure);
  SPI_Cmd(SPI1, ENABLE);
  SPI_SSOutputCmd(SPI1,DISABLE);
  SPI_I2S_ITConfig(SPI1,SPI_I2S_IT_RXNE,ENABLE);

  NVIC_PriorityGroupConfig(NVIC_PriorityGroup_3);
  NVIC_InitStructure.NVIC_IRQChannel = SPI1_IRQn;
  NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 1;
  NVIC_InitStructure.NVIC_IRQChannelSubPriority = 1;
  NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
  NVIC_Init(&NVIC_InitStructure);
}

void SPI1_IRQHandler(void)
{
    if (SPI_I2S_GetITStatus(SPI1,SPI_I2S_IT_RXNE)== SET)
    {
        SendTest=SPI_I2S_ReceiveData(SPI1);
    }

    if (SPI_I2S_GetITStatus(SPI1, SPI_I2S_IT_TXE)== SET )
    {
         SPI_I2S_ITConfig(SPI1, SPI_I2S_IT_TXE, DISABLE);
    }
}

My transmitter is another STM which its SPI frequency Bus (36/16=2Mhz) and configured in Master mode:

    SPI_InitStructure.SPI_Direction =SPI_Direction_1Line_Tx;//SPI_Direction_2Lines_FullDuplex;//
  SPI_InitStructure.SPI_Mode = SPI_Mode_Master;
  SPI_InitStructure.SPI_DataSize = SPI_DataSize_16b;
    SPI_InitStructure.SPI_CPOL = SPI_CPOL_High;
  SPI_InitStructure.SPI_CPHA = SPI_CPHA_1Edge;
  SPI_InitStructure.SPI_NSS = SPI_NSS_Soft;
  SPI_InitStructure.SPI_BaudRatePrescaler = SPI_BaudRatePrescaler_16;
  SPI_InitStructure.SPI_FirstBit = SPI_FirstBit_MSB;
  SPI_InitStructure.SPI_CRCPolynomial = 7;
  SPI_Init(SPI2, &SPI_InitStructure);
  SPI_Cmd(SPI2, ENABLE);
 SPI_SSOutputCmd(SPI2,DISABLE);

I connected CLK->CLK, MOSI->MOSI , and SendTest datatype isvolatile unsigned long SendTest;


texts: MCF5253 CAN controller transmission problem

texts:
I am using the MFC5253 controller. It has two CAN channels, CAN 1 and CAN 2. In my project, I am using both of them. Their registers are the same, except for the name (1 and 2).

I can transmit and receive data correctly from CAN1 but not from CAN 2.... How do I fix this problem?


texts: Would UART communication between this NIBP Module and ESP32 need a level shifter?

texts:
Good day!
I'm trying to send commands to this NIBP module using my ESP32's UART pins and I'd like to ask if I would need to use a level shifter for this? I'm also not familiar with using level shifter modules. If anyone can explain how to use a level shifter module for this application that would be great. Any input would be greatly appreciated! thank you.


texts: Can you use an op-amp like this to detect current?

texts:
For a model train track, I'd like a simple circuit which can detect current. In the past, I used an opto-coupler in combination with 2 diodes. A current flowing through these diodes would cause a voltage drop of 1.4 V over the opto-coupler. This was enough to steer the opto-coupler open. The 1.4 V voltage drop was a problem, because it lets trains make a noticeable jump in speed. So I am looking for a replacement.
There are other methods to detect current, but most of them are relative large circuits with too many components.
So I drew this experimental circuit. The idea is that a very small current flowing through a 0.2 Ω resistor, would create a voltage over the op-amp, causing it to drive the LED when this voltage is positive. I am aware that the voltage would be negative 50% of the time. But an Arduino can filter the signal further.

So my question is: Will this circuit work? Is the connection between the 0 V and 16 V supply needed? Or would it work without it as well?


texts: I have been given an assignment in which I have to implement a common source PMOS cascode (2 PMOS's above Vout, with upper one having the input voltage, and 2 NMOS's below Vout) using Cadence Virtuoso. Can somebody please point me in the right direction and give me some indications as to where I should start? The specs are as follows and the input frequency is 1KHz


texts: Can We send data using exisiting power outlets in homes

texts:
I am trying to build a project in which I want to transfer data through existing power outlets in a home through power lines while simultaneously using those outlets for power supply also.
My question Is it possible? and if yes where and how can I explore more about this topic.
 something like this http://www.tp-link.com/en/products/details/?model=TL-PA4020PKIT


texts:
I have a Wheatstone bridge but I don't know the values of the resistances in it.

My excitation voltage is 5 V. But instead of having 2.5 V on each output lines I get one line at 3.3 V and the other at 1.7 V

How can I do to compensate this situation and have a 2.5 V output on each line?


texts: How to compute for the capacitor to achieve a certain cut-off frequency?

texts:
This is my task : "Select new values for C1 and C3 to get a lower cutoff frequency in the circuit shown above that is less than 20 Hz."
What I did first was choose 15Hz and then computed for the value of C1 and C2 by using 1/2piRC as shown in the following image:

Did I do it correctly? :(
Thank you so much for you help!


texts: What is the purpose of the diodes on a Samsung LED TV backlight bar

texts:
Skip to the question below if you don't care about the details ;)

The bottom half of the backlight in my TV went off so I opened it up to see if I could fix it. I found four of the 7 bars of LEDs were not working and narrowed down the problem to one of the bars. There were two bad diodes on the bar(D1,D2 in image attachment below) so I tried replacing them with two that I took off a computer motherboard. All four bars that were not working before lit up but only the last five LEDs on the bar with the replaced diodes were lighting. After testing the individual LEDs it turned out that L1 was dead and the two "new" diodes I put in was also bad so current was only flowing through the two bad diodes in reverse and lighting the last 5 LEDs. I removed D2 and a bypassed L1 with a piece of wire and now all LEDs are lighting except the bad LED 1. What was also strange was that one bar was affecting 4 bars even though each bar has individual positive and negative traces and wires going to the circuit board behind the TV.

Question: What is the purpose of the diodes D1-3 in this circuit because they seem pointless to me? I just want to know if it would be safe to leave the diode section disconnected with the bypassed L1 until I can find a LED bar to buy. Also would it be safer to bypass L1 with a normal diode than with the wire?

Update:

Close up of diodes D1 and D2(L BB and T BB markings)
Can anyone identify them from those markings? I checked SMD code BB and it seems to be a Zener diode but I'm not sure.


texts: Simple Adaptive Amplifier Options for Sensor Interfaces

texts:
Related: High Resolution ADC for Noisy Sensors in Variable Conditions

I'm building an interface using resistive textile-based sensors that may have different resistance ranges depending on environmental conditions. In order to best make use of my A/D converters, I'd like to explore using an adaptive amplifier that will help compensate for the unreliable performance of the sensors.

What are my options here? Or can you point me to some references on the topic?

I can think of two general schemes that would be useful:

Auto-calibration by finding min and max values in a given analysis window (~30s-2min)
Explicit calibration using a toggle-to-train interface
... Are there alternative schemes I'm not thinking of?

Some Constraints

It should be a one-chip solution (small) if possible (like capacitive sensing chips)
It should be easy to configure and use (I'm not an engineer and I'm not getting paid)
There will probably be a microcontroller nearby

Even better would be a do-it-all chip with Wheatstone bridge / voltage divider, lowpass filter and amplifier.

More About My Particular Setup

A/D converters will either be the converters built into an Atmel chip (could be ATtiny85 or ATmega32u4) or the converters built into an XBee series 2 radio. I've never used dedicated A/D chips before – I'm not sure if there would be any benefit to doing that.
The sensor will be a piece of polymer-doped conductive lycra from Eeonyx. The resistance changes by about 1 order of magnitude at 30% stretch.
The whole thing will be mounted on the hand of a performer, so it must be small and physically robust. There's a good chance it will be wireless.
Precision is important. The interface will be used to continuously vary realtime audio effects i.e. it's not a switch.


texts:
I am using a micro-controller to switch a logic level MOSFET (the IRLR3103). The output of the MCU is 3.3V. I have a 1K resistor in series with the gate as well as a 100K pull down resistor as close to the MOSFET gate pin as possible.

For my PCB layout I am focusing on keeping the drain (output) trace as short as possible but this means the gate trace from the MCU is as much as 150mm long in some cases. The gate traces are 0.6mm wide on 2oz/ft2 copper.

Does this layout sound reasonable or should I try another layout with shorter gate traces from the MCU?

Edit: I should add that the purpose of the MOSFET is to provide switching for things like cooling fans so high-frequency switching isn't a consideration.


texts: DDR: Is the real maximum speed half of what is advertised in datasheets?

texts:
Let's take a single 8-bit 200MHz DDR chip. All datasheets state that bandwidth is "up to" 400MB/s.
Because it's dual, data is read/written on both edges so yes, theoretical, it's 400MB/s.
But you need 4 or 5 cycles to do a 4-byte burst read operation which 2 cycles are used to "really" read data (4 edges).

400MB/s would imply 2 cycles for each read.
If you optimize like crazy with CAS-latency=2, I don't see how you can do fewer than 4 cycles.
The real sustained read speed of a single DDR chip is 400MB/s * 2/4 = 200MB/s. And I even don't mention the refresh operations...
Am I misunderstanding the specifications?


texts: Can a pull-up network in complementary logic circuit have both NMOS and PMOS devices?

texts:
Consider this boolean function and its complement which will be implemented in a complementary logic circuit:

\$T = \bar{v}.\bar{w} + u.\bar{w} \$

\$\bar{T} = (v+w).(\bar{u}+w)\$

I designed the pull-up network like this:

simulate this circuit – Schematic created using CircuitLab

The implementation of the pull-up network i.e. the circuit that will connect \$T\$ to \$V_{dd}\$ has 3 PMOS and 1 NMOS. It seems to make sense: there will be a connection if \$v=0\$ and \$w=0\$ or if \$u=1\$ and \$w=0\$.

My question is: should a pull-up network be exclusively PMOS based and a pull-down network be exclusively NMOS based? If so, how can it be done for \$T\$?


texts: Spice model search with advanced sorting functionality

texts:
Does anyone know of a search engine like Mouser/Digikey where you can narrow down parts based on voltage/package type/etc., but exclude all results without PSpice models? Unless I'm doing it all wrong, the searching in OrCAD Capture basically assumes you already know what part you're looking for since there is no real sorting functionality other than by overall categories. Do any other spice implementations provide such functionality?

I've used PSpice during college for learning basic circuit design, and recently picked it back up thinking it could aid in a current design project. It seems to work great for basic circuit analysis, but for practical applications I've found myself jumping back and forth between the OrCAD model library, Mouser, DigiKey and several manufacturer websites trying to find a part that will meet my design requirements and still have a spice model available. After a few days of this, its seeming to be terribly time inefficient and might make more sense just to order parts and make prototypes. Is this just the nature of the beast or am I just missing something here?

My current workflow is something along these lines:

Sketch circuit on paper
Find parts that meet design criteria using Mouser/Digikey advanced search/sort
See if I can find the part in the OrCAD Library or Manufacturer Website.
If I find the part, great, but if not, then I go back to step 2 and select the next best part.

So far, I seem to be on an endless loop between steps 2 to 4 for even seemingly simple parts like voltage regulators.

The other possible workflow I tried but still seems terribly inefficient is:

Sketch circuit on paper
Search OrCAD Library for part of same category (e.g. positive voltage regulator) and just go down the list. Copy first part # on the list
Copy first part number in the OrCAD list in the category of
interest, and search Google/Mouser/Digikey for the datasheet. If the
part meets my design requirements, then great, but if not, then I go
back to step 2 and select the next part in the list.

This seems like an awful lot of trial and error. Can anyone point me to either a more efficient search engine as described in the first paragraph, or a guide/walkthrough for a more time efficient workflow using PSpice, or another Spice variant that doesn't result in such lost time on trail and error?


texts: Highest achievable datarate for sub-1GHz wireless

texts:
According to this datasheet, Semtech LoRa can reach 9375 kbps, while CC1125 from TI has a maximum datarate of only 200 kbps, despite both operating on the same frequency (868/915). To reach its highest datarate, LoRa must be used with it's lowest spreading factor, and CC1125 uses narrowband transmission, so the it seems to me that the difference in datarate should not be so great, and especially that it should be higher for CC1125.

What are the key factors I should look into to better understand what datarates are possible for sub-1GHz systems, and thus better evaluate the available systems (bandwidth/spreading/modulation/protocol/etc)?


texts: Quadrature encoder reading 2500pps 10000rpm

texts: I am using a Quadrature encoder 2500ppr @ 10000rpm → 416666.66 pps. When reading these pulses using a microcontroller, so far I found medium filters are used before the micro controller to remove noises. How do I design a proper medium filter for this type of encoder?


texts: How is saltwater able to conduct electric charge between two wires?

texts:
Say I put some wires in a container filled with saltwater, but the wires do not touch, and I connect these wires to a battery:

simulate this circuit – Schematic created using CircuitLab

I know that the saltwater will complete the circuit, and some current will flow. But how can this happen? Do the electrons fly off one wire and jump through the saltwater to the other wire? Aren't the electrons stuck in the wire? Why would they be able to do this when there is saltwater between the wires, but not when there is air between the wires? If the electrons can't leave one wire, travel through the saltwater, and get to the other wire (can they?), then how is there a complete circuit?


texts: Noise margin of a cascade connection of Schottky clamped transistor and a regular transistor

texts:
simulate this circuit – Schematic created using CircuitLab

This is a buffer.

So what's the \$Vil - Vol\$ ? I would have thought it's it's \$Vbe - Vces\$, but that's incorrect. Does Q1 ever go in saturation? Advice on where to start?


texts: Adapter label and electricity consumption

texts:
My surveilance cam label states 5==1A. I am not an electrician, but is it right to say that based on tha label, to compute for Power (watts) consumed by the device:

1A x 120 volts = 120 watts

For electricity consumption:

120 watts x 24 hours = 2,880 watt-hrs per day
2,880 watt-hrs per day / 1000 = 2.88 kwh per day
2.88 kwh per day x 31 days = 89.28 kwh per month
89.28 kwh per month x $.10 per kwh = $8.928 per month

Does that mean that I am spending $8.92 per month for a small camera?

Thanks


texts: Detect one out of five distinct voltage levels

texts: I got a fan on my roof which is powered via a five step manual transformer to control the speed. The transformer outputs a voltage of either 0, 90, 110, 135, 165 or 230V AC. I would like to use an Arduino to detect which level is currently selected. What would be the easiest way to accomplish this? Preferably using some non-intrusive method if possible (measure electric field somehow?).


texts: How to flush an RTOS queue and prevent further posting on a device disconnect event?

texts:
In the following code

SendMessage() is the API called by the user to send a message over USB
Task() is the thread created in init() that reads the queue and calls the low level usb function to send a message
UsbConnected() e UsbDisconnecte() are two functions called by another thread when the a USB device is connected and disconnected respectively.

I want to implement the following behaviour:
 - When the UsbDisconnet() function exits, the queue QueueA must be empty and no further messages can be post on the queue by calling SendMessage()

My best solution that uses FreeRTOS API is listed below.

There are two things that I do not like of my solution

It uses an xQueueSend() inside a Mutex.
The while loop used to clear the queue.

Does a better solution exists?

void UsbhOut(Message_t );
int UsbConnected;
SemaphoreHandle_t MutexA;
QueueHandle_t QueueA;

void init(void)
{
  MutexA = xSemaphoreCreateMutex();
  QueueA = xQueueCreate(sizeof(Message_t), 10);
  UsbConnected = 0;

  xTaskCreate(Task, "", 200, NULL, 1, NULL);
}

void UsbConnected(void)
{
  UsbConnected = 1;
}

int SendMessage(Message_t Message)
{
  xSemaporeTake(MutexA, portMAX_DELAY);

  if(!UsbConnected)
  {
    xSemaphoreGive(MutexA);
    return -1;
  }

  xQueueSend(QueueA, &Message, portMAX_DELAY);
  xSemaporeGive(MutexA);
  return 0;
}

void Task(void * pvParameters)
{
  Message_t Message;
  while(1)
  {
    xQueueReceive(QueueA, &Message, portMAX_DELAY);

    UsbhOut(Message);

  }
}

void UsbDisconneted(void)
{
  Message_t DummyMessage;

  xSemaporeTake(MutexA, portMAX_DELAY);
  UsbConnected = 0;
  xSemaporeGive(MutexA);

  while(xQueueReceive(QueueA, &DummyMessage, 0) == pdTRUE);

}


texts: I was wondering why some MOSFET transistors like This one has 8 pinout instead of 3 ?


texts: Is running 4 18650 batteries in parallel too much current for a small RC circuit with the same voltage?

texts:
I built this small RC deadbolt lock and everything works great, however, I need to fix the issue of battery life before it is finished. Originally the circuit had a 3.7V, 800 mAh battery. I would like to hook up a total of of 3.7 V, 12000 mAh or so, my question is will the circuit only draw what it needs from the batteries or will this fry the circuit?
Sorry if this is a rookie question, my knowledge of this is not too extensive.
Thanks!


texts: powering 12V 5m/16ft 5050 RGB LED Strip with 16V power adapter?

texts:
I'm new to the forum found this using google.

i have 2 (Two) 5050 RGB 12V LED Strips that are 5M/16ft. It's not as bright as i'd hoped it would be. I double powered one of them with the cheap power supplies they came with and it's a little brighter almost to what I want. Searched for the brightest RGB LED strip and i found it only comes 5050. It's not as bright as i hoped. Since i double powered it on both ends and it got brighter, would it be safe to power it with a 16V 4.5A laptop power supply since there's some power lost due to strip resistance? Or is 14V the max recommended?

Or would the safest way be dual powering them with 12V or dual 14.4V?
Would single 14.4 3A perform better than dual 12V 1-2A (that i currently have)?

I'm looking for a LED's for a store window display. I have merchandise in the window. Will 5050 do or do i need to step it up to 5630, 7020, 8020?
I was hoping 5050 would do since it's RGB and we can have a Christmas display going.
There are plenty of windows so i could do 5050 for the RGB and the brightest Warm White (not cool white which is most common for super bright)...

would it be safe to power the 5050 RGB 5M LED Strip with a 16V 4.5A laptop power supply since there's some power lost due to strip resistance? Or is 14V the max recommended?
The lights stay on from 10am to 6pm. Monday-Saturday.

Or would the safest way be dual powering them with 12V or dual 14.4V?
Would single 14.4 3A perform better than dual 12V 1-2A (that i currently have)?


texts: Suggestions on what to get my boyfriend for Christmas? (interested in PIC24, MSP430, Propeller, FPGA, ARM, etc..)

texts:
I'm at a standstill on ideas for what to get him and would really, really appreciate any recommendations you guys can provide! (Also, he frequents this site but promised to not read this.)

So far, I got him an MSP430 (LaunchPad) dev kit. I'm also getting him a box of random components from Mouser or Element14 with things that he could use. What can I get for him to go with the LaunchPad kit?

Are there any ARM development books that you guys could recommend? He constantly links me to ARM dev boards that he wants (one with an LCD, ethernet, USB, good MCU; pref ARM9, Cortex-M3). Any suggestions on what dev board I could get him?

I was also thinking of getting him a subscription to Nuts and Volts magazine. What other electronics hobbyist magazines are there?

For further information, he also was really interested in high voltage stuff (microwave transformers, spark gaps, etc.) and has recently acquired a nonfunctional (ancient) ham radio, bass amp, several broken TVs (that he has repaired/is repairing).. And he has a logic sniffer, oscilloscope, function generator.

Thanks! :)


texts: Can I power a 100w amplifier with a 33w PSU?

texts:
I purchased a small 2 channel amplifier for a DIY audio project (Amazon link). I'm hoping I can connect it to a power supply I already have to drive a pair of small speakers.

PSU: 19V 1.75A DC (33w?)
Amp: 5-24V 2x 50w (100w)
Speakers: 2x 40w 8Ω (80w)

I would guess that the PSU would limit the 100w amp output to 33w, providing 16w to each 40w speaker. Would I need to attenuate the amp to 33% to support the supplied power?


texts:
I wonder if it possible - If I were to use a 8PDT switch, to switch the 8 wires of a USB3 cable between 2 output ports from 1 input, would this be sufficient? Or are there issues I may run in to that I don't understand
Many thanks


texts: There are plenty of free SPICE and Verilog simulators out there such as LTSPICE or TINA or even WinSPICE. There are also several Verilog simulators as well. However, I am looking for free VerilogA simulators. Does anyone know one?


texts:
I am trying to create a PCB that has ATmega16 using proteus.
I need to connect a power switch that cut the supply or power to the whole circuit, but the ATmega16's VCC pin hidden and directly connected to VCC power rail and the same is for GND.
I tried adding an new power rail and connecting it to VCC via a switch, but it throws an error saying "no power supply specified for net ", I can specify VCC as supply for rail I created but this return me to square 1 where the controller's VCC is still directly connected to power.


texts: How to use PC parallel port as a power supply for any device (similar to charging Mobile Phones). Actually I have to powrer my circuit based on parallel port. Which pin of parallel port can supply  at least 5 volts without cause any change(sending signals) to the pc.


texts: How to identify what exact model of STM32

texts: I have a consumer device that I know uses a STM32 microcontroller that I'd like to hack a bit.  Is there a reliable way to communicate with the chip and determine its exact model, so I can locate the correct datasheet?  Nothing is printed on the chip itself.


texts: How to calculate the Induced Voltage Given Spinning Conducting Loop? Intro to Electromagnetics problem

texts:
I'm having trouble figuring out a different variation of this problem. On my homework, I'm asked to find the induced EMF for the following B field:
$$\vec{B}=50\vec{a_y}$$

I was able to figure out the problem with the B field being:
$$\vec{B}=50\vec{a_x}$$

I want to know how does my equations change if the B field is in the \$\vec{a_y}\$ direction. I'm confused shouldn't it be the same due to symmetry :) The back of my book says I'm right for $$\vec{B}=50\vec{a_x}$$ but not for
$$\vec{B}=50\vec{a_y}$$

The following is my solution to the problem if $$\vec{B}=50\vec{a_x}$$

Question:

The loop shown in Figure 9.7 is inside a uniform magnetic field \$\vec{B}=50\vec{a_x}\$ mWB/\$m^2\$.
If side DC of the loop cuts the flux lines at the frequency 50Hz and the loop lies in the yz plane.

Find the following:

a)The induced EMF at \$t=1\$ms

Figure 9.7

Let's use the general form of Faraday's Law.

$$V_{emf} = -\frac{d}{dt} \int_S \!\vec{B}\cdot\vec{dS}$$

1) We can simplify the integral as
$$\int_S \!\vec{B}\cdot\vec{dS}=B\cos{(\phi)}zy$$
where z and y is simply the length and width of the square conducting loop.

2) Now we have the following expression to evaluate:
$$V_{emf} = -\frac{d}{dt} B\cos{(\phi)}zy$$

3) We can find \$\phi\$ by noting \$\omega=2\pi f\$ so \$\phi = \omega t\$

So...
$$V_{emf} = -\frac{d}{dt} B\cos{(\omega t)}zy$$

4) Now evaluate the derivative:
$$V_{emf} = -Bzy \frac{d}{dt}\cos{(\omega t)}$$
$$V_{emf} = Bzy\omega\sin{(\omega t)}$$

5) Finally plug in the known numbers to find the \$V_{emf}\$. at \$t=1ms\$

$$z=3*10^{-2}$$ $$y=4*10^{-2}$$
$$f=50Hz --> \omega = 2\pi f = 100\pi$$
$$t=1ms$$ $$B=(50*10^{-3})$$

$$V_{emf} = 100\pi(50*10^{-3})(3*10^{-2})(4*10^{-2})\sin{(100\pi (1*10^{-3}))}$$

Therefore:
$$V_{emf} = 5.825mV$$


texts: Use transistor to connect terminating resistor for differential signal?

texts: Is it okay to use a transistor to connect a terminating resistor between the A and B lines of a differential signal? I'm not sure because I know that at the source/emitter of an NPN transistor must be at ground potential for the base/gate to turn the device on. My instinct says no but please help. If this won't work is there of something other than a relay that would work to do this with a GPIO pin of a processor?


texts: Effect of changing current sense resistor value in amplifier circuit

texts:
I am trying to implement a current output amplifier circuit shown below. Current is measured across sense resistor Rs to adjust input voltage Vin.

Gain: G = -Iout/Vin = R2/(GainIA1 × R1 × RS)
The gain of this circuit is set at 1 with

R2 = 1 kΩ
R1 = 100 kΩ
RS = 0.01 Ω
RL is the load.

It has an instrumentation amplifier IA1 on the feedback path for less noise and better resolution. The gain of IA1 is also 1.
If I decide to increase resistance of Rs and decrease resistance of R1 while keeping the gain at 1, how would changing sense resistor value affect my system performance?


texts: Electromechanical Relay for VAC switching

texts:
I'm looking at PID devices for coffee machines. There's a tendency to use SSRs (for the regular reasons) but at the current levels (12 amps 120VAC) required these tend to be large (60mm longest dimension).

Even with my own SSRs using opto-isolators and triacs I still need a large heat sink area - especially inside a coffee machine which gets warm and won't dissipate the heat.

I'm looking at controlling 4 AC items in the coffee machine (2 boilers, pump, solenoid) and trying to stuff 4 SSRs into that space will be a challenge.

So here are my questions:

Am I right in concluding that 4 x EMRs can fit into a smaller space given the largish current?
Also if I go the EMR path, how can I extend the life of the relays?
Is it possible to use a zero crossover to switch the relay? Or is the switching delay too slow?
What other traps should I watch out for?


texts: Shaping negative pulses to positive ones

texts:
I have built a scintillation detector. The detector outputs 0,1 ms 50-200 mV negative pulses from a photomultiplier (DC). The pulse shape is shown in the picture below.

To detect the pulses I need to change their properties (still DC however). Their new shape has to be pretty much identical, but more than 500 mV positive voltage (their duration can be 0,1 ms to 0,5 ms, but preferably 0,3 ms to 0,4 ms). The shape is, again, illustrated in the picture above.

Does anyone with more experience than me have a small form-factor schematic that will work? If I need to, I have a 5 V rail that I can power something with.

Thanks!

Update: The op amp that I chose (TLE2081) has sufficient properties. However, I can't get my schematic to work. See the picture for my schematic.

The output I am getting is my Vcc+, which is odd. I am not getting the pulses that I was looking for. I think I did something wrong, does anybody have any ideas?

Thanks!


texts: How to read signal from Crankshaft Postition Sensor in motorcycle

texts:
I am trying to build digital tachometer for my motorcycle Yamaha FZS600 Fazer 2002. I have a problem with reading signal from CPS sensor. It is hall effect sensor, I suppose. I found the plug of it. It has two wires. One is GND so the other must be the signal. I have no oscilloscope to probe it so I connected it to the soundcard oscilloscope through the voltage divider and op-amp as can be seen in below schematic.

simulate this circuit – Schematic created using CircuitLab

I adjusted the R1 and R2 values with a 10k potentiometer and got signal presented in picture 1. It looks nice (it looks like it would be no problem reading it with a uC).

In the next step I connected the same circuit to a analog pin of an Arduino and uploaded simple program to constantly read voltage on that pin and transmit it through serial. The result can be seen in picture 2. That doesn't look like the waveform from picture 2 at all. First of all the signal read by a soundcard is inverted but it is reasonable. The signal read by an Arduino is meaningless. The question is what is the proper circuit to read a signal from such sensor.

The LM358 is single-supplied from 12 V with a 1uF capacitor to GND. Adjusted values are:
R1 = 9.27 kOhm
R2 = 1.79 kOhm

With no voltage divider or with smaller R1 it seems that my circuit disturbs motorcycle's ECU reading of CPS and the engine runs unevenly or stops.

@Andy aka, you were right about aliasing problem. According to your advice I succesfully sampled the CPS signal with Arduino at a higher rate. The required modification was to change a prescaler of ADC clock. I've done this according to this tutorial http://www.microsmart.co.za/technical/2014/03/01/advanced-arduino-adc/ and here it is what I've got

Nevertheless question about proper circuit for reading CPS signal and filtering out noise still remains. When I turn the knob of potentiometer voltage divider such that R2 becomes greater and R1 smaller the waveform is getting more noisy. Furthermore I am wondering what level voltage that CPS signal can have. Arduino indicates it's 5 V  but how can I know it isn't greater?


texts: I just have a little Question, if I drive a reset pin to low (reset active) of an Atmel AVR for a long time (1 week for example, in fact it'll be really variable depending on the use) can it cause default to the controller within  a year or two ?


texts:
I am currently facing some problems with STM32F4, the process "hangs" and I am not able to understand at what point it "locked". When this happened, I collected the following values for the following variables (I created the variable stepError to "translate" the CFSR variable):

void prvGetRegistersFromStack (uint32_t * pulFaultStackAddress)
{
volatile uint32_t CFSRValue = SCB-> CFSR;
volatile uint32_t HFSRValue = SCB-> HFSR;
char stepError [1024] = "";
if ((HFSRValue & (1 << 30)) = 0) {
CFSRValue >> = 16;
if ((CFSRValue & (1 << 9)) = 0) strcpy (stepError, "Divide by zero");
if ((CFSRValue & (1 << 8))! = 0) strcpy (stepError, "Unaligned access");
if ((CFSRValue & (1 << 3)) = 0) strcpy (stepError, "No UsageFault coprocessor");
if ((CFSRValue & (1 << 2)) = 0) strcpy (stepError, "Invalid PC load UsageFault");
if ((CFSRValue & (1 << 1))! = 0) strcpy (stepError, "Invalid state");
if ((CFSRValue & (1 << 0))! = 0) strcpy (stepError, "Undefined instruction");
}

/ * These are volatile to try and prevent the compiler / linker optimizing them
away the variables never actually get used. If the debugger will not show the
values of the variables, make them global my moving their declaration outside
of this function. * /
volatile uint32_t r0;
volatile uint32_t r1;
volatile uint32_t r2;
volatile uint32_t r3;
volatile uint32_t r12;
volatile uint32_t lr; / * Link register. * /
volatile uint32_t pc; / * Program counter. * /
volatile uint32_t psr; / * Program status register. * /

r0 = pulFaultStackAddress [0];
r1 = pulFaultStackAddress [1];
r2 = pulFaultStackAddress [2];
r3 = pulFaultStackAddress [3];

r12 = pulFaultStackAddress [4];
lr = pulFaultStackAddress [5]; // Bit (2 or 3) = 0 determines MSP (Main Stack Pointer); 1 = PSP (Process Stack Pointer)
pc = pulFaultStackAddress [6]; // Variable that contains the address where the error occurred. To check where it was, search the Disassembly on the screen Debug the address
psr = pulFaultStackAddress [7];

/ * When the following line is hit, the variables contain the register values. * /

// Joseph Yiu:
/ *
1) Look at LR value when the core enter hardfault, if bit 2 is 0, then read the value of MSP. Otherwise, read the value of PSP.
2) Based on the MSP / PSP value, you should be able to locate the start of stack frame, stacked PC is in address SP + 24.
3) Generate a disassembled listing of the program you run, and try to locate the stack PC address in the disassembled program list.
* /

GPIO_WriteLed (0,1);
for (int i = 0; i <= 10; i ++)
{
PWM_Change_DutyCycle (i, 0);
}
for (;;);
}

  HFSRValue 1073741824 CFSRValue 0 StepError 0x2001fbb0 ""

  r0 0 r1 0 r2 0 r3 11

  r12 536890019 lr 134334773 pc 0x0801bab0  psr 3221225472

But I can not know from these values where the error occurred, whether it was caused by usb, serial, encoder or ADC converter and etc.
How to implement void HardFault_Handler (void) so I can recognize where the error occurs?


texts: Modelling a "single-phase permanent split-capacitor motor" in LTspice

texts:
I'm planning to use an AC fan in an LTspice simulation.
The AC fan is made up of a single-phase permanent split-capacitor (PSC) motor.

Here is the actual fan: http://uk.rs-online.com/web/p/axial-fans/2781543/

And here is how I'm planning to model the approximate fan motor in LTspice:

Since there is no info about the inductance of auxiliary winding, primary winding and capacitance of the capacitor of this fan; I tried to find realistic examples for these values in the web before simulation. I couldn't find any.

My questions are:

1-) Can I simulate this motor by using the equivalent circuit I draw above.

2-) Any suggestions on auxiliary winding, primary winding and capacitor values of a typical fan of this kind? I couldn't find any values of these given.

note: AC mains 230VAC 50Hz


texts: MCU interface to detect a wide input voltage

texts:
I am designing a new circuit, where I need to detect presence of voltage on an external network. Note that I am using the same network (Using LDO) to power up my circuit, so the ground is common. I want to keep it cheap, so cannot afford opto-coupler. The range of voltage to detect is somewhere from 5V to 40V. How can I achieve this using a BJT or MOSFET? Transistor is the only part, that always confuses me :( Can I do something simple like driving the base of the BJT with the external voltage and then sense the collector for low signal? We'll pull up the collector with a resistance. I need some suggestions on this please.

I need to detect LOGIC HI-LOW and not measure the external voltage (using ADC).  I need couple of such inputs.. So need to use GPIO :( My ADC is doing something else and there I am using voltage divider.

Note: My MCU operates at 4V and manual says the GPIO works with 3V

simulate this circuit – Schematic created using CircuitLab

Will something like this work and safe to use?


texts: How to measure inductance (and more) of DIY LF (125kHz) RFID antennas

texts:
When winding my own coil two factors seem most important, inductance and serial resistance of my antenna.

However measuring inductance doesn't seem that easy. Ideally I need an LCR-meter that is able to measure inductance at 125kHz for best accuracy. However looking around LCR-meters seem to stop around 1kHz.

How will my measurement accuracy suffer if the LCR meter only measures at 1kHz?

My current model has a variance of ~0.2mH just switching between 100Hz and 1kHz mesaurement frequency, however it is a rather cheap model (PeakTech 2175).

When looking for a new measurement device I might as well at look something a bit more fancy. I can imagine that coil capacitance might be interesting if not too relevant. Anyway, any suggestions on what to look for?


texts:
I saw in some movies that indoor light intensity is controlled with human presence and distance from the sensor (the lower the distance, the higher is the light intensity).

I am very interested to know if I have a correct assumptions for how all of that controlling works.

Are they using PIR sensors or some other type of sensors to measure the distance and presence of human in room? Are there any ready-made solution similar to this?

I want to make that controlling circuit and connect it to home AC network, is it easy to that, or it's not easy as I think?


texts: Is there any software that would graph x, y, and z values as fields / time written to a sd card by a microcontroller with an accelerometer? Or would I be better off writing my own.


texts:
I would like to be able to charge my laptop via a USB-PD power source as seen in this article.
I need to find out if my laptop input, which is rated at 19V 3.42A can handle the 20V provided by the usb c board. Is there any way to find out without having a chance of frying my laptop?


texts: Linear actuator is not working with BTS7960

texts:
I am trying to run a linear actuator with a BTS7960 motor driver and an Arduino UNO.
The code seems fine, wiring seems fine but after uploading the code, the linear actuator does not start.
I am using two push buttons to extend and retract the actuator.
The code is shown below:
byte mspeed=0;
int RPWM = 5;
int LPWM = 6;

void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(2, INPUT_PULLUP);
pinMode(4, INPUT_PULLUP);
pinMode(13, OUTPUT);

pinMode(RPWM,OUTPUT);
pinMode(LPWM,OUTPUT);
}

void loop() {
// put your main code here, to run repeatedly:
if( digitalRead(2) == LOW & digitalRead(4) == HIGH ){
mspeed = 255;
analogWrite(RPWM,0);
analogWrite(LPWM, mspeed);
digitalWrite(13,HIGH);
}
else if( digitalRead(2) == HIGH & digitalRead(4) == LOW ){
mspeed = 255;
analogWrite(RPWM,mspeed);
analogWrite(LPWM, 0);
digitalWrite(13,LOW);
}
else{
analogWrite(RPWM,0);
analogWrite(LPWM, 0);
}

}


texts: Arduino MIDI interface - Serial was not declared in this scope

texts:
I'm very new to arduino, I've been trying to follow this tutorial to get the arduino to interface with the Whammy pedal using a MIDI cable. I've managed to sort out the cable, solder it, and identify which cable is which. However on uploading the test sketch on the tutorial i.e.:
void setup() {
 Serial3.begin(31250);

 for (uint8_t i=1; i++) {
 delay(50);
 Serial3.write((uint8_t)0xC0); //TYPE: program change
 Serial3.write((uint8_t)i);
 }
}

void loop() {
}

I get the following compile errors:
sketch_jun19a.ino: In function 'void setup()':
sketch_jun19a:2: error: 'Serial3' was not declared in this scope
sketch_jun19a:4: error: expected `;' before ')' token

What's going wrong?
I should add I'm using an Uno.


texts: How to decide maximum input current required in linear charging method?

texts:
I am using MCP73213 IC for my charging application. I would like to use the maximum capacity of the IC for charging. i.e., 1 ampere charge current during constant current charge cycle.And input voltage is 9 volts. What the maximum input current required for this application. I want to use 9 volt adapter as input. Please help me in this regard.

Reference schematic is seen from the datasheet linked below.
http://ww1.microchip.com/downloads/en/DeviceDoc/20002190C.pdf

Thankyou.


texts: Can 900MHz and 2.45GHz Antennas be differentiated by shape?

texts:
edit: In view of the helpful comments below, I just wanted to show an example of a cheap plastic antenna that does have an inductor inside. In this case, the antenna is shorter and the wavelength longer than the 900 MHz antenna discussed in my question, so the inductor is strictly for loading the short vertical to get it to resonate down at 433MHz. Take home message: not all cheap plastic antennas are just a piece of (straight) wire, some are coiled!

above: annotated screenshot from this video.

On most 2.45GHz WiFi routers the the black vertical antenna is thick at the base (10-12mm) and narrows (4-6mm) near the top. I've been poking around various catalogs and sites and it seems to me that the lower frequency 900 MHz antennas are simply cylindrical in shape with a uniform diameter of about 10-12mm.
Of course what matters is the electrical resonant frequency (center and width) of the antenna, but the shape reveals differences in things like inductive loading schemes for example, and so can reflect differences wavelength with respect to the physical length.
I noticed on the PyCom website they show antennas for the LoPy (LoRa) and SiPy (SigFox) boards as having the tapered shape (that I normally see on 2.45GHz antennas), while the antenna sold separately  even though they operate in roughy the same frequency range. They also sell the antenna separately and it is labeled for both.

above: LoPY module from here. Two identical coaxial antenna connectors for external (software-switchable) WiFi antenna, and LoRa antenna are in the top corners.
Since the LoPy has TWO coaxial antenna connectors (top right and top left in image above), one for an optional external 2.45GHz WiFi and one for 800 - 900 MHz LoRa, it is conceivable that one could have both kins of antennas laying around at the same time.
Can the two types (usually) be distinguished by appearance? I left my grid-dip meter at home.

Antenna Kit for use with the LoPy LoRa, WiFi and BLE board or the SiPy Sigfox, WiFi and BLE board.
Includes:

External antenna.
RF Cable Assemblies RP-SMA (Female) JK-IPEX MHF U.FL 1.13 100MM
RP-SMA (Male) Tilt Swivel 1/2 Wave Whip antenna

NOTE: Using the LoRa/Sigfox radio without the external antenna can lead to damage of the device and is therefore not recommended.

LoPy Twin Pack
The bundle includes:

2 LoPy modules
1 Expansion Board
2 LoRa Antenna kits


texts: How to get 32u4 arduino to ignore DTR for USB Serial?

texts:
32u4 based "USB Serial Ports" refuse to send data to the PC unless DTR on the PC software side is set to high.  If the PC software does not set DTR to true (high?), then Serial.print() on Arduino goes into a black hole, and the software never gets the responses from the Arduino.

I need to get a third party software package to work with my Arduino Pro Micro based device.  This software sets DTR to false, which works fine with many other devices.  Aruino receives data from the PC just fine, it's only the arduino responses that are lost.

End result...the software can send commands to my device, but because the PC software does not set DTR to true (high?), my Serial.print() responses are not received...the 32u4 essentially blocks the responses because DTR is low...even though serial data is going TO the arduino.

PIC microcontrollers, and Arduino UNO's etc., don't require DTR to be set high on the PC side for USB serial to work, FTDI chips seem to ignore DTR, so this third party software works fine with most other devices.

Modifying my hardware is not an option.  How can I, in software/firmware, hack this device to ignore DTR so this third party PC software can see serial data from the device?


texts: Max voltage for Arduino ATmega328 VCC pin (not raw!)

texts:
I am thinking about getting both the Pro Mini 3.3V and the 5V boards.

Example (but I may end up going generic, not sure yet)
3.3v: https://www.sparkfun.com/products/11114
5v: https://www.sparkfun.com/products/11113

Any way, I understand I can supply up to 12V of unregulated power through the RAW pins on both boards. But I need a very energy efficient set up since I'll be using batteries and I did some research that the voltage regulator wastes some power. Therefore, I'd like to send power direct to the VCC pin. What is the min/max voltage I can send through VCC for these two models? Is it exactly 3.3 and 5 respectively, no tolerance or margin? or is there some?

thanks!


texts: How to derive the resonant frequency from the RLC circuit?

texts:
Just like the title, i have an AC circuit (RLC) RL in series and they are in parallel with C.
How do I derive the resonant frequency from that circuit? It says to derive from first principles. I got the resonant frequency for XL=XC but it is not same as the resonant frequency below... Any help on deriving that resonant frequency?

Here's the circuit.

And here's the resonant frequency which supposed to be the answer.


texts:
I'm developing an embedded systems project (I'm quite new to the area) and I have determined that I want to use the CC430F5137, my problem is: How can I develop for it?

From cross-compilation, to driver software, to: USB -> JTAG, JTAG -> Programmer and programmer to the MCU itself. Are these the normal steps in the process?

Can a CC430F5137 be programmed with a generic MSP430 programmer? I realize this is more than one question, but mainly I would like to know how I can develop for TI's CC430F5137 MCU.


texts:
I am a bit new in designing circuits. I am trying to make an interface to shutdown all the signals coming from an Ethernet cable. The design would look something like this:

Can this be done using mosfets? if so, would it cause packet drop? Any suggestions on how i could do this?

Thank you for your time :)


texts: Advice for Grounding and Shield Placement

texts:
I am working on a board design which includes an ADC and a DAC. The board attaches to the headers of the Mojo V3 Spartan 6 FPGA Dev Board. The ADC has to pick up a quiet signal at the same time as the DAC is emitting a signal. My goal is to reduce coupling between the ADC signal path and the DAC signal path as best as I reasonably can, and also to isolate the ADC / signal conditioner from noise generated by the FPGA.

The ADC and DAC are running at 200MSPS, with clock and data connections ported through the dev board header. I will be getting rid of the header later by putting the FPGA and ADC/DAC on a single board, so for now am ignoring problems with coupling between header pins.

I am following the recommendations of the answer on this thread on grounding. I have read the references provided by this answer, and other references (see below) on grounding, and am trying to implement them.

Ott - Partitioning and Layout of Mixed Signal PCB
Ott - Ch. 3, Grounding
Zumbahlen - Staying Well Grounded
E2V App Note - Mixed Signal PCBs
Clayton Paul - Electromagnetic Compatibility (Comprehensive Kick-Ass EMI/EMC Book)

My plan is to make a 4 layer board, with stack-up:

Signal (with ground pour around signal lines)
Ground (sourced by header pins from FPGA board)
5V (sourced by header pin from FPGA board)
Ground

I am planning to take advantage of ground plane and power plane partitioning between the DAC and ADC. I would also like to add a RF shield can (something like this), and this is where I am having trouble deciding what I should do.

Option 1 is to leave the ADC / DAC outside of the RF shield can. See diagram below.

Advantages: Digital lines that connect ADC to FPGA do not penetrate the RF shield. Clock line also does not penetrate the RF shield. RF shield aperture is small, since it only has to allow a signal trace, a power trace, and a reference voltage trace.

Disadvantages: ADC chip is exposed to radiated coupling from FPGA / DAC / external sources. Analog signal trace itself is exposed when leaving the RF shield.

Option 2 is to include the ADC / DAC inside of the RF shield can. See diagram below.

Advantages: ADC chip is shielded from radiated sources, possibly coming from external sources or the DAC / FPGA.

Disadvantages: Shield aperture is larger since it has to accommodate 8-14 signal lines, a clock line, and a power line from the regulator. Also, digital lines penetrate the shield aperture, and since they are switching at up to 200MHz, noise may couple to the amps.

Which is the better option? If you have other advice on improving this design from an EMI/EMC standpoint, that would be appreciated.

Thanks in advance!


texts:
I am trying to design a user interface that consists of several knobs which can turn (duh), be momentarily depressed (clicked), and can be backlit, based on whether they have been clicked or not.

I was thinking of finding some sort of 'clickable' potentiometer and mounting an LED next to it, underneath a semi-transparent shield of some sort.

However, I have had no luck finding these 'clickable' potentiomenters and I also thought it might be somewhat difficult to configure the LED properly as I described.

Does any sort of potentiometer exists? Is there a different route altogether that I should be taking to get the knob, click, and backlit functionality that I want?


texts:
I'm using a STM32 Cortex M0+ controller which does not have FPU. I'm reading 50/60Hz sine wave and I would like to calculate the RMS using the DSP library: keil.com/pack/doc/CMSIS/DSP/html/group__RMS.html. Looking into this library, there are three functions to compute the RMS:
void arm_rms_f32 (const float32_t *pSrc, uint32_t blockSize, float32_t *pResult)
    Root Mean Square of the elements of a floating-point vector.

void arm_rms_q15 (const q15_t *pSrc, uint32_t blockSize, q15_t *pResult)
    Root Mean Square of the elements of a Q15 vector.

void arm_rms_q31 (const q31_t *pSrc, uint32_t blockSize, q31_t *pResult)
    Root Mean Square of the elements of a Q31 vector.

As the micro doesn't have FPU, is it more convenient to avoid floating calculation and use Q15 or Q31 format? If so, do I need to convert the data from the ADC to Q15/Q31 format, right?
In the other hand, my AC signal has DC bias equal to Vcc/2 or 1.65V. Converting this to digital, it is equal to 2048. But when I sampling, this value actually varies from 2044 to 2052 (my noise floor I guess)  I have seen several methods to deal with this offset:

Subtract a fixed value of 2048 from each ADC reading. This is no so good as I said above this value may vary slightly. Also, if I want to detect zero cross it may cause errors to choose exactly 2048 as reference.
Sample the DC bias and average it
Leave it and get the DC value as RMS result when there's no input signal
Use a more sophisticated software high pass filter
Use the formula below

I would appreciate some recommendation about this.


texts:
Considering the number of people here who work closely with always on FPGAs, ASICs etc, and how materials react to heat, etc. Are there any known health issues when dealing with
hot electronics emitting any material that is unhealthy to breathe or be around?


texts: What is a good way for the mcu to determine which hardware version it is running on?

texts:
I'm working on a new product design and there will probably be small or large hardware changes/fixes over the life of the product. For future firmware updates in the field I need a way to determine the hardware revision. What is a good strategy?

I'm currently pulling two spare pins up/down with external resistors and checking the pattern. This only allows for 4 hardware revisions, but that might be enough for practical purposes. It might become a problem if I need one or both of those pins in a future hardware revision.

I guess a more economical way might be to have a resistor divider connected to an ADC pin. Each hardware revision could have different value resistors. Unfortunately I don't have any spare ADCs in my current design.

I guess another way could be to encode the hardware version number in an EEPROM or the mcu flash during production? (We don't have that facility at the moment.)

I guess I'm looking for suggestions for a flexible and robust method.

[EDIT]

Re. suggestion from @trav1s: I don't have an address bus per se but I have an 24LCxx EEPROM on the I2C bus. The low 3 bits of the Slave Address is hardwired. I guess I could change the address bits and search for the EEPROM during startup.


texts:
We are using two Arduino UNOs as a master/slave for this I2C protocol. We used the first Arduino (slave) as a sensor that will input dummy data (in this case, temperature data). The Arduino (master) should be able to output what the slave has input, but every time we run it, the output is always 255 instead of the temperature data.
We don't know what is wrong with the code, but we want to read the real data. Can anyone help us?
Here is the code we use for the Master:
// Include Arduino Wire library for I2C
#include <Wire.h>

// Define Temp Slave I2C Address
#define TEMP_ADDRESS 9

void setup() {
Wire.begin(); // Initialize I2C communications as Master

Serial.begin(9600); // Setup serial monitor
Serial.println(">>>MASTER IS READY<<<");
Serial.println('\n');
}

void loop() { //Temperature
delay(50);

Wire.requestFrom(TEMP_ADDRESS, 12);
Serial.print("TEMP ADDRESS: ");
Serial.println(TEMP_ADDRESS);
Serial.println("Receive data from TEMP Slave");

byte MasterReceivedTemp = Wire.read();

Serial.print("Temperature = ");
Serial.println(MasterReceivedTemp);

Serial.println('\n');
}


texts: Noobish question. I'm trying to make a dc variable voltage power supply. I will include the schematic which I am trying to build. In the schematic there are two 1000 uf capacitors which I believe are used to smooth out the peaks of the dc voltage before hitting the regulator, but I am confused because in the schematic it shows them being grounded. Wouldn't the capacitor drain without going through the circuit then? Thank you for reading, hopefully I can figure out why.


texts: My question is for microcontrollers in general.  Can SPI be implemented with any 3 different I/O pins granted one is a clock signal?  Is there anything special with certain pins that a datasheet specifies as a master-in, slave-out or slave-select?  Anything special referring to anything unique about the hardware at that pin as opposed to a general I/O pin.


texts: While reading the concept of CLOCK DOMAIN CROSSING I came across the 2 flip-flop synchronizer. If my first flop goes into metastable state, then how will it detect the correct value of data when it will come out of the metastable state? If my input is '1' and after coming out of metastable state my flip flop detects it as '0' then won't it create a problem in circuit as it is propagating false output through the whole circuit?


texts: Switching a stereo audio signal without distortion

texts: I need to switch a stereo signal in a lossless, non-distorted manner. Simply put, I need to control ON/OFF for each channel. Should I use MOSFETs or optocouplers? I believe the signal ranges from -2.5V to 2.5V ... standard 3.5mm output. Cluebats at the ready :)


texts:
I understand logic gates and their truth tables. However, when it comes to the circuits of the gates, I have trouble understanding them. Could someone please explain how a gate such as the following can be compared to the NAND logic gate?

(original image source Basic Logic Gates and Buffers)


texts: How is it possible to safely disconnect/turn off an inductor that has current through it without causing a huge backward voltage? Even dropping from a circuit with low current, it the current will still be going from finite to 0, in a very small space of time (how would you calculate this time?), causing a big voltage spike. How can inductors possibly be safe if disconnecting them is so dangerous?


texts: How to measure the current drawn by the radio and the headlights from car battery easily?

texts: I wonder how much current is drawn from car battery when the headlights and the radio are fully open. Is there a way to measure the resistance of the radio or the headlights without unscrewing or unscrewing few screws? Or any other methods? Something like plugging to a varying resistive load into cigarette lighter to determine the resistance? Or connecting a capacitor to determine the charging time (rc network, the all resistive loads connected to car battery are r; and capacitor plugged into cigarette lighter is c) to find resistance connected to battery? Any suggestions are welcome.


texts: Finding the voltage of a circuit composed of a series and parallel?

texts:
I was watching a youtube tutorial to understand calculations using ohm's law and I thought I had it down when I ran into this problem:

I was asked to find the voltage at points A and B. I was also asked to find the current that runs through both resistors in the parallel section of the circuit:

So I did the following to find those answers:

I first wanted to find the voltage drop in the series section of the problem so I used ohm's law:

$$V=IR=(6A)(5Ω) = 30V $$

So my first answer was correct, point A had a voltage of 30V. Now I thought I could use this voltage to solve for the parallel part of the problem, but before that I thought:

  Ok, so 30V going into the parallel circuit, great! so that means that since there is no voltage drop in parallel point B must be 30V as well!

Then I continued with my analysis. I wanted to find the current at the 3Ω resistor, so I used:

$$I = V/R = 30V/3Ω = 10A$$

Using that same analysis I got the current going through the 6Ω as well, which was 5A. It made no sense to me, because I would be saying that there is a current of 15Ω, greater than the initial current. Why is my analysis incorrect? Why do I get incorrect current values for the parallel circuit using Ohms's law?

This is the video's solution to the problem:


texts: AC Induction Motor Slip and Torque control Vs V/f control

texts:
I am trying to understand this github code for speed control of AC Induction Motor. It calculates slip value to adjust the speed of motor. I wonder if its the same thing that is called constant V/f speed control? Is it just difference in the terminology, V and f being electrical while slip and torque being mechanical?

Here is the code for quick look.

    // Globals for data that is either persistent or used for debuging
int i1, i2, i3;    // Phase currents
int total_current; // Total instantaneous current
int angle;         // The angle of the stator voltage
int voltage;       // The magnitude of the stator voltage
int encoder_position_previous; // The previous encoder value

// Analog to digital converter DMA data
uint16_t adc_data[4]; // [i1, i2, i3, throttle]

// Motor parameters
#define MOTOR_POLES 4
#define ENCODER_RESOLUTION 2400
#define MAGNETIZING_CURRENT 3000
#define MAX_TORQUE_CURRENT 7000
#define GAIN 2

// This runs at the PWM frequency: 9765.625Hz
// It runs 0.000048s after it's triggered (approx half the PWM period)
// This means data is collected during the first half of each
// pwm cycle ready for calculations in the second half.
void DMA1_Channel1_IRQHandler(void) {
  // Fetch the phase currents
  i1 = adc_data[0] - 32840; // Offset to 0A
  i2 = adc_data[1] - 32840; // Offset to 0A
  i3 = adc_data[2] - 32840; // Offset to 0A
  // Calculate the total current (FPU operation)
  total_current = sqrtf((float)i1*(float)i1 + (float)i2*(float)i2 + (float)i3*(float)i3);

  // Calculate encoder ticks change since the last iteration
  uint32_t encoder_position_current = TIM2->CNT; // Atomic as possible
  int encoder_position_change = encoder_position_current - encoder_position_previous; // Nasty casting to signed here
  encoder_position_previous = encoder_position_current;

  // Determine slip from the throttle
  // By happy coincidence this gives +/- 32768 (+/- 5Hz)
  int slip = adc_data[3] - 32768;
  // Increment the angle by the requested slip
  angle += slip;
  // Increment the angle by the encoder measurement
  angle += encoder_position_change * 67108864 / ENCODER_RESOLUTION * MOTOR_POLES / 2;

  // Calculate the target current.
  // This starts at MAGNETIZING_CURRENT and increases wih slip
  // up to a maximum of MAGNETIZING_CURRENT + MAX_TORQUE_CURRENT.
  // We use floating point operations here to avoid overflows
  if(slip >= 0) {
    target_current = (float)MAGNETIZING_CURRENT + (float)MAX_TORQUE_CURRENT * (float)slip / 32768.0f;
  } else {
    target_current = (float)MAGNETIZING_CURRENT - (float)MAX_TORQUE_CURRENT * (float)slip / 32768.0f;
  }

  // Apply current error to voltage output
  if(total_current < target_current && voltage < 4000) voltage += GAIN;
  if(total_current > target_current && voltage > 0)    voltage -= GAIN;

  // Update PWM outputs from SVM style lookup table
  TIM1->CCR3 = (voltage * table1[angle >> 13]) >> 15;
  TIM1->CCR2 = (voltage * table2[angle >> 13]) >> 15;
  TIM1->CCR1 = (voltage * table3[angle >> 13]) >> 15;

  // Clear interrupt
  DMA1->IFCR = 0xFFFFFFFF;
}

void TIM1_UP_TIM16_IRQHandler(void) {
  // Start ADC conversions each time PWM restarts
  // This runs at 80000000/8192 = 9765.625Hz
  ADC1->CR |= ADC_CR_ADSTART;
  TIM1->SR = ~TIM_SR_UIF;
}


texts: Deriving the S-parameters, different Matched Loads possible?

texts:
I guess this is more of a conceptual question but for the problem below Im having trouble getting started on how to derive the S parameters for the network.

I noticed that the network at 28.025 GHz is resonant, so the shunt capacitor and inductor are open, leaving the equivalent circuit at that frequency to be just the resistors
To derive the s parameters I understand that I have to terminate a port with a matched load, at either 1 or 2 to so that the Reflection Coefficient  = 0
Now here is a my confusion, it seems to me that going from port 1 to 2 the characteristic impedance of the circuit (Z_0) would be different than going from port 2 to port 1 leading to different matched loads.
I think that they are different because if you inject a signal into port 1 and short port 2 to ground you encounter an impedance of:

But if you inject a signal starting at port 2 you get:

I believe there's a high chance of doing those resistance calculations wrong, but Im just not sure where to start or if im headed in the right path.
Which boils down my question to
Is it true that the Characteristic Impedance of this network changes depending on where you inject the signal, leading to different matching loads? If not how do you calculate the system impedance this network in particular?
My professor in class has always shown examples and given us homework of simple two port networks that look symmetrical from either port where the system impedance is the same whether looking into port one or port 2 matched loads will be equal so im pretty confused right now.


texts: Small step down transformer fuse, primary or secondary?

texts:
For a small 24V 1A transformer where should I place the fuse? Secondary 1A fuse or primary 100mA fuse (or above accounting for inrush current)? Mains is 230V. Also, the smallest fuse available in the market seems to be 200mA.

Also, how about a 30V 6A transformer? I guess for a 12V 500mA transformer the answer is obvious, as I have no access to 50mA fuses for the primary. But how useful is a primary side fuse? It's not like the transformer will short out on its own, and it's not like the utility voltage will go up to extremely high levels for any length of time. So I am really placing the fuse to protect the transformer from a shorted load placed on the secondary (including shorted bridge rectifier), right?

Added: Thanks for all the replies. These transformers are for one off projects. They are all EI core. So a primary side fuse with 150% rating at 230V would be:

transformer    required fuse    actual fuse
24V 1A         156mA            200mA
30V 6A         1.17A            2A
12V 500mA      26mA             200mA

Is that correct? The minimum fuse I can get is 200mA. And above 1A is usually in 1A steps. I might not be able to get a 1.5A fuse. Also, I have no idea if these are slow blow fuses. The cartridge fuses seem to be tinned copper in a glass tube. I could potentially test the fusing current and time for the fuses just to be sure (fuses are cheap).

How much current might a transformer draw at startup? I found somewhere (lost the link) that it may be a lot more (like upto 35A for a 5A transformer, so it is a bad idea to repeatedly switch on and off a transformer e.g. with a contactor).

The small 12V transformer is possibly inductance limited. I was unable to draw more than 650mA from it at the rated voltage (12VAC). Is this how a class 2 transformer should behave? Or should 500mA have been the short circuit current?

If I understand correctly, a primary fuse will protect the transformer from shorts in the winding. Shorts in the winding can arise due to overheating. Overheating can occur due to high current draw in the primary, or inadequate cooling. There are 2 reasons for high current draw in the primary: 1. repetitive inrush current due to repetitive switching on and off the primary side, and 2. high current draw on the secondary side. If I operate the transformer only with a manual toggle switch (not a doorbell), and if I have a suitable fuse on the secondary, then I have none of those problems. That leaves only inadequate cooling which can destroy the transformer winding. Is my thinking correct?

Is it correct that the main reason to place a fuse on the primary is that a fuse on the secondary is no more necessary to protect the transformer? A shorted secondary will draw enough current to blow the primary side fuse. But this will not happen for a class 2 transformer. So a class 2 transformer might still burn up because it was operating for an extended time at slightly over maximum rating, if it lacked a secondary fuse.

[Sorry for so many questions. I am definitely confused about this. My gut says to just go with 2 fuses and avoid headache... but on some sites they even say 2 secondary fuses!]

added
Thanks again for all the replies and clarifications. I found in my hands yesterday a brand new 30V 6A transformer. As soon as I plugged it in (no secondary load), the fuse on the primary side blew. It was rated 5A. Thinking it may be an old fuse, I replaced it with a new one. It blew again. The transformer as well as the mains wire to it was already warm. So I guess that answers my own question. Now for the hassle of returning the transformer...


texts: What kind of components are needed to build a simple digital camera? One that processes a JPEG image and can transfer over one of USB (in mass-storage mode), Bluetooth or WiFi. When could I get them? Is there an open source camera?


texts:
Hello im completely new at this subject, so this might be a "newbie" question, but i need some help with finding some components, if they exist.

I would just like to know the names of the components and know if im using them right.

Component 1:

As you might see, i want to reverse the motor spin direction with the component "S2".

Questions:

Name?
How to use it? (Using the switch)
Can it be done with a remote controled circut?

Component 2:

This might be a less obvious drawing, but my goal here is that i have 1 energy source, and the remote reciever has to recieve a lower voltage (I forgot to draw the resistor) than the component on the other half of the circut (LED).
Which also is the why the component LED is not connected in a serial connection.

In the real project the LED could be anything, but i drew it to clear it up.
So I want to be able to turn switch S1 ON / OFF with a remote control. The voltage running through S2 is lower than the one in S1, and i therfor want them to not get in contact.

Questions:

Name?
How to use it? (Using the switch)

Currently i do not know, which battery, motor or reciever im going to use.

I hope i made myself clear,

Thanks in advance. :)


texts:
I wrote a few lines in VHDL and I declared pins into a lpf file for my Lattice MarchX03 board. But now I want to flash the board and honestly the documentation is very unclear.

So I got Diamond Software which from what I understand is juste a IDE that let you programm/compile VHDL.

The VHDL simulator that came with that is Active-HDL software?

Finaly, the bitstream generator is a software called Synplify Pro?

So if I get it right, I need to synthetize my VHDL design with Synplify Pro than use Diamond software to programm the Board?


texts: Is it correct that if I would like to control 4 AC appliance/lighting power points, then the AC-Live wire is put through the relay, and a common AC-Neutral is used ?


texts: Can an accelerometer function at a constant velocity?

texts:
I am designing an anti-theft device that works as such: an accelerometer detects if the device is experiencing a percent change in acceleration greater than a to-be-determined value. If so, Bluetooth will engage and check if the device is increasing in distance from the user. If so, the anti-theft system will trigger. If a thief were to move away at a constant velocity, would the accelerometer fail to detect a change in acceleration (or any acceleration at all, for that matter) and as such would the device fail? If so, is there any way to get past that limitation?
As clarification, this is a small anti-theft device meant for use with laptops.


texts: How does negative feedback reduce noise?

texts:
It is a well established fact that negative feedback improves a lot of parameters related to amplification.

Effect of negative feedback on some of the factors such as gain, input and output impedances etc. can be found by mathematically solving some practical circuits, but I could not find a suitable explanation for the noise reduction caused by the negative feedback.

Can anyone give me an intuitive (or mathematical) idea as to how the negative feedback helps in reducing noise?

Edit: Excerpt from Boylested's book on Electronic Devices


texts: Graphical method for obtaining waveshape of current

texts:
I was doing exercises of the book Electrical Engineering Fundamentals by Vincent Del Toro. Then I saw this question.

The voltage waveform shown in fig is applied separately to a pure capacitor of 1 F and to a pure inductor of pure of 1 H. Carefully sketch the current waveshape for each circuit element over the specified time interval. Hint : A graphical approach may be found easier than an analytical one.

The problem I have is that I am able to solve it only by the analytical approach, then I plot the graph. I can't think how a direct graphical approach can be applied. I will be grateful for your help.


texts:
Is it possible in SPICE to create a MOSFET with user defined values of V_T(Threshold Voltage)?

This question cropped up because I was taking a course on Analog Design with videos & problem sets(without answers) available online.I got stuck in the problem sets and have no way to verify my answer and thought process.So I thought instead of shamelessly posting the question  here, simulation of the circuit would solve the problem and increase my intuition & understanding.

But I discovered that only specific models from various Companies are available.

The only parameter I want to change is V_T?Is there any way to 'create' such a component and simulate it???


texts: Can I use electrolytic capacitor in a schmidt trigger oscillator

texts:
I want to build this cricket chirping circuit that I found on Happy Lab.

The values are specified as follows

R1: 100 k
R2: 39 k
R3: 290 k
C1: 100 nf
C2: 10 µf
C3: 10 µf
C4: 100 µF
D1,D2: 1N4148
IC: 74HC14 (6x inverter with Schmitt trigger)

I have sourced all the parts except am having trouble getting 10uF ceramic capacitors for C2 and C3 in time for my deadline. Happy Lab application notes say

  Since the use of polarized capacitors for C2 and C3 is kind of
  unskilled (it works most the times especially when using higher
  voltage capacitors ie. 63 volts) it is better to use non-polarized
  capacitors. 10µF non-polarized ones are expensive and or bigger. So
  much smaller capacitors can be used when increasing the value of the
  corresponding resistor at the same time.

I don't follow this. Does this mean I can use 16V 10uF electrolytics (which I do have) for C2 and C3? I am aware electrolytics can explode with reverse polarity which obviously would be bad.

If I can use the electrolytics, which side of C1 is +ve? The trigger output or diode facing side? My analogue circuitry is very rusty.

I plan to drive this circuit not with a solar panel but 2 x AA's in series (3V).


texts: Geometric spreading of an impulse antenna

texts:
I am new to radar and curious about the geometric spreading in free space. I set up an air-coupled antenna about a half meter above the ground, with a large PEC on the ground. Then I adjusted the height of the antenna and recorded the corresponding reflected amplitude. I expected the reflected amplitude should be proportional to 1/r because there is only free space loss. However, I got 1/r^0.2 for one antenna (1Ghz, I am not sure about the type of it) and 1/r^0.5 for another one (a 2Ghz horn antenna). Am I understanding the geometric spreading wrong? Or the wave is not always spherical spreading for the different antennas? Any help will be really appreciated.

Two antennas are both ground penetrating radar. The set-up is shown as follows (PEC should be on the ground, which is missing in this photo):


texts: Turn on LED when an electrode or contact is submerged in saltwater

texts:
this is my first post here, thanks in advance for any help you can render. I am working on a project that turns on one 5mm white LED running on a 3.7v lipo battery when it comes in contact with saltwater. I want to mount this on my dock pole so when the tide comes up I can look out my window at night and know its high tide. I want it to be as small as a package as possible. I have a Suunto mosquito dive watch that has some sort of water contact in it that turns on automatically when I go diving. This is the same kind of approach I am looking for.

I have searched the internet for days looking for mini water contactor, micro water contacts, submersible underwater nano switches, etc. to no avail. What is the best way to make this happen. I don't want to have to use a micro controller. If I could somehow modify a mini led flashlight by adding a water contact that would be suffice.

So the question is what parts I could use to get it done and where to get them.


texts: Advantages of 32-bit 48-96 Mhz microprocessors (such as in Arduino Due)

texts:
It seems Arduino Due ( 32-bit, 84 Mhz, ARM-Cortex-M3-based SAM3X8E ) was released today.

In addition, clearly there is a myriad of processors in this category ( 32-bit / 48-96 Mhz / ARM ) as well as corresponding prototyping boards:

NXP LPC1768 / mBed
STM32 / Discovery
PIC32 / ChipKit
PIC32 / Parallax Propeller
LM4F120 / TI Launchpad
etc.

I am trying to understand the appeal of these "in-between" microprocessors, which to me appear to lie in between the low-end AVR/MSP430/etc. (pros: inexpensive, low-power, small-footprint) and the high-end ARM7/etc (pro: capable of far greater instructions per second).

In what situations or ways are 32-bit / 48-96 Mhz / ARM-based microprocessors a suitable choice? More specifically, I am wondering in what applications or in which parameters they would make for a superior choice during design, over both the low-end 8-bit microcontrollers or the the very high-end ARM7 processors.


texts:
I want to send data from PC to microcontroller via USB and vice versa with Communication Class.
I have used USB to Serial applications like Putty or RealTerm but they work only for COM Port and not for simple USB.

I found a similar question it explains but doesn't answers the problem.

Here is a python module which does similar but isn't installing on my Windows 10 x64 (tried many methods)

If you know some similar application or module please let me know about it.


texts: Increase output power of simple class AB audio amplifier

texts:
How could one increase the output power from a class AB amplifier circuit like this one? I wish to increase the output power to around 2W.

The above picture is simulated with a 200mV amplitude, 5kHz sine wave input which is amplified to 4V amplitude through op-amp U1A.

Also, how does the size of the resistors R7 and R8 impact the amount of current the transistors Q1 and Q2 can push/pull?


texts:
simulate this circuit – Schematic created using CircuitLab
I don't understand how the circuit works .I know it is a Colpitts oscillator but the part where I get confused is that in the video on youtube it says we can set Ve = 1/2VCC however I don't understand how this can happen since we don't have a base resistor and the emitter resistor will try to draw as much  current as the emitter current but this isn't possible because the voltage drop on the emitter resistor cant be more than VCC . I am not sure if this circuit can work based on that I wrote earlier.Can somebody explain it to me please?


texts: How to match a power amplifier and a loudspeaker array?

texts:
I am trying to use a power amplifier that is available to me to actuate an array of loudspeakers. The array has a total number of 30 loudspeakers (ways of connection can vary).

And I would like to know how I should connect the loudspeaker array to the amplifier to make sure there's enough power for the array and also not overload the array. Below are some parameters of the amplifier and the loudspeaker. Do you think serial connection in this case will be fine?

If possible, would you please show the chain of thought to reach the conclusion? So will help me when I want to change the no. of loudspeakers in the future.

Power amplifier:

Power output capacity: 75 VA into a 3 ohm resistive load
Input impedance: 15 kohm
Output impedance: 0.04 ohm: [10Hz-5kHz], 0.08 ohm: [5kHz-20kHz]
Max output current: 5A or 1.8A rms according to selected value
Max output voltage: 15 V RMS

Loudspeaker

Input power: 2W (rated), 3W (max)
impedance: 8 ohm

Array

The array will be composed of the loudspeaker above with a total number of 30.