texts: How to drive NPN transistor based on this circuit?

texts:
I just built a fan speed controller, using the following schematic:

Now if you connect 12V from 555 and connect pin 7 to the blue CPU fan wire, it controls the speed, but whenever the PWM signal is approx 20% duty cycle, the fan runs approx 80% of full speed.

I liked the simplistic design and want to someday turn this into an LED dimmer. But I am not sure how to drive a N-channel FET or NPN transistor with the switched ground as opposed to the normal switched Vcc.  How can I accomplish this?

Thanks for reading!


texts:
I am trying to know what is the black circular component stacked in front of the switch and adjacent to the large capacitor in this circuit board.

I am not talking  about the transistor with the heat sink. I am talking about the circular black component.

This thing has 4 pins in the bottom.


texts:
just a newbie here.

I just want to ask how I can step down my 5vDC adapter to 3VDC? Cause I'm afraid that my LED lights will burn out. Thank you so much for answering.


texts:
Recently, I found this circuit on the Talking Electronics web page:

I was interested in the modified circuit below, where the feedback capacitor is replaced with short circuit and the 8R speaker with resistor of 8 ohms.

I simulated the circuit with falstad in two situations:

When the circuit was running without feedback, I added the short circuit.
The short circuit was present at the beginning of the simulation.

(link to the simulation)
Without the feedback, the circuit is an amplifier, with current amplification of about 100 * 100 = 10 000 A/A. In the first scenario, when I add the short circuit while the circuit is running, the circuit continues working as before, but the voltage on the 8 ohm resistor has lower value. Maybe the addition of the short circuit removes some of the charge in the base of the NPN bjt, so it turns a little bit off, which in turn increases it's collector voltage, so the base current of the PNP bjt has lower value, affecting the collector current of the PNP and finally this decreases the voltage on the 8 ohm resistor. In the second scenario, both transistors are cutoff. Maybe this has something to do with the parasitic capacitance of the BJTs and their turn-on time.
I am kindly asking if someone can explain me how and why the circuit behaves this way.


texts:
I would like to design a microcontroller based embedded system that is composed of the following subsustems:

1.Two sensors of 5V inputs.
2.One 12V DC motor controlled by a 12 V relay (ON/OFF).
3.One 12V Servo motor(PWM Controlled).
3.A battery charging system.
4.Load sharing system between a battery pack and the main power supply.

A simple block diagram of the system is shown below:

My concern is about the power management system composed of the Buck converter, the battery charging system and the 5V power supply.

How do I proceed to design a stable buck converter to supply a battery charger that may be another switching regulator, a 12V Relay and 12DC motor ?
What do you suggest for the 5V power supply module? Should I use a linear regulator and in that case there will be much power dissipated. Or should I use another buck converter IC ?

Any other suggestions concerning the optimasition of the system are welcome.


texts: Switching between high voltage power sources

texts:
I need to get an LED to switch on once the voltage across a capacitor goes above 40V. It must then remain on from 40V to the maximum voltage reached by the capacitor which is currently 1200V. The circuit has to be independent from any other power source so the circuits must be powered off of the capacitor.

I thought about using a comparitor but that would require an outside power source to power the chip and create a reference voltage.

I am currently working with the idea of using two dc to dc converters as I can't find one that will cover the full range. The first converter has a range of 40 to 180V and the second one has a range of 200V onwards.

I need to build a circuit to switch from one dc to dc converter to the other when the first ones maximum voltage is exceeded. I also need to switch over to another power source when in between the two converters ranges so that the led is constantly lit.

I think this can be done using a relay but I have never worked with one before and I'm not sure how to power it when the max voltage is reached and where to power it from.

If someone could shed some light on a possible solution or point me in the right direction it would be greatly appreciated. Thank you!


texts: Transfer function from signal flow graph

texts:
In the system whose signal flow graph is shown in figure. \$U_1(s)\$
  and \$U_2(s)\$ are inputs. The transfer function
  \$\frac{Y(s)}{U_1(s)}\$ is

  \$ \frac{k_1}{JLs^2 + JRs + k_1 k_2}\$
  \$ \frac{k_1}{JLs^2 - JRs - k_1 k_2}\$
  \$ \frac{k_1 - U_2(R + sL)}{JLs^2 + (JR -U_2L)s + k_1 k_2 - U_2R}\$
  \$ \frac{k_1 - U_2(R - sL)}{JLs^2 - (JR -U_2L)s - k_1 k_2 + U_2R}\$

I have a doubt that whether the input \$U_2\$ will come in the transfer function or not? I'm confused between option (1) and (3).


texts: Limiting or reducing current to charge low-capacity lithium batteries

texts:
I have a handful of lithium-ion batteries with very low capacities, the lowest being about 700mAh, which I wish to connect to a charging module to avoid having to physically take out of my device/project to recharge. I only have access to cheap Chinese TP4056 USB charging modules on eBay, which provide 1A current, which I have heard is dangerous to batteries smaller than that. The TP4056 modules also have 5 volts for both input and output, which is necessary for my application. How will I limit or reduce the current, if possible, to avoid damage or catastrophic failure of the battery? Is it possible to do so without lowering the voltage? Is it safe to charge these batteries at 1A? I have been unable to find any modules that go below 1A, and Adafruit/Sparkfun/Mouser etc are not accessible in my country.

The battery's device will be charged through USB and require 5V, which the TP4056 boards provide. It seems to be similar to those DIY 18650 USB power bank kits.


texts: Can I charge 1 cell Li-ion battery with a charger for 2 cells?

texts:
I'm designing a battery charger using  monolithic step-down battery
charger that operates over a 4.95V to 32V input
voltage range.

On the datasheet I found a typical schematic for 2 cells but using just 1 cell Li-ion battery.
Do you know if using the typical design for 2 cells I can charge my 1 cell battery? Or do I have to change anything?


texts: Controlling a 24VAC solenoid with arduino

texts:
I'm trying to come up with a design for controlling a 24VAC water valve with an arduino.

My current design :

I want to use a BT1308W TRIAC controlled by an arduino pin to activate the vale, I'm also using a smbj48ca TVS diode to suppress spike generated by the solenoid when it's de-energized. I was using a similar design using a relay and the arduino was reboting randomly when the solenoid was closed, after adding the TVS diode it's not happening but is the correct use for this diode?


texts: Can ATMEGA JTAG be disabled and enabled just with JTAG?

texts:
I am currently developing a schematic based on the ATmega32U4.
I need to be able to program the embedded chip, so with ISP or JTAG (preferably).
The problem is, I also need the analogs functions of the port F (where JTAG is), and the port B (ISP) to link with a can interface.
So far my understanding of the datasheet of the chip and of the jtagice debugger I am using goes, I should be able to load the program and then disable the JTAG pins in order for the pins to run correctly.

What I don't understand is whether I can "reenable" these pins with the JTAG interface (or ISP, same problem) in case I need to reprogram, or something is wrong and I have to debug. Is it possible? If not, what could be a work around in order to have all the functionalities needed?


texts: STM32f2xx could not work with maximum frequency

texts:
I'm using default configuration (according to UM1061, RCC section) to configure an SMT32F215RG to work with 120MHZ CPU clock.
here is my configurations:

/* PLL_VCO = (HSE_VALUE or HSI_VALUE / PLL_M) * PLL_N */
#define PLL_M 25 /* For HSE value equal to 25 MHz */
#define PLL_N 240
/* SYSCLK = PLL_VCO / PLL_P */
#define PLL_P 2
/* USB OTG FS, SDIO and RNG Clock = PLL_VCO / PLLQ */
#define PLL_Q 5
/* In this example:
PLL_VCO = 240 MHz
SYSCLK = 120 MHz
*/
/***************************************************************/
/* PLL (clocked by HSE) used as System clock(SYSCLK) source */
/***************************************************************/
__IO uint32_t StartUpCounter = 0, HSEStartUpStatus = 0;
/* Enable HSE */
RCC_HSEConfig(RCC_HSE_ON);
/* Wait till HSE is ready */
HSEStartUpStatus = RCC_WaitForHSEStartUp();
if (HSEStartUpStatus == SUCCESS)
{
/* Flash 3 wait state, prefetch buffer and cache ON */
FLASH_SetLatency(FLASH_Latency_3);
FLASH_PrefetchBufferCmd(ENABLE);
FLASH_InstructionCacheCmd(ENABLE);
FLASH_DataCacheCmd(ENABLE);
/* HCLK = SYSCLK */
RCC_HCLKConfig(RCC_SYSCLK_Div1);
/* PCLK2 = HCLK/2 */
RCC_PCLK2Config(RCC_HCLK_Div2);
/* PCLK1 = HCLK/4 */
RCC_PCLK1Config(RCC_HCLK_Div4);
/* Configure the main PLL clock to 120 MHz */
RCC_PLLConfig(RCC_PLLSource_HSE, PLL_M, PLL_N, PLL_P, PLL_Q);
/* Enable the main PLL */
RCC_PLLCmd(ENABLE);
/* Wait till the main PLL is ready */
while (RCC_GetFlagStatus(RCC_FLAG_PLLRDY) == RESET)
{}
/* Select the main PLL as system clock source */
RCC_SYSCLKConfig(RCC_SYSCLKSource_PLLCLK);

/* Wait till the main PLL is used as system clock source */
while (RCC_GetSYSCLKSource() != RCC_CFGR_SWS_PLL)
{}
}
else
{ /* If HSE fails to start-up, user can add here some code
to deal with this error */
}

for testing that, I'm using a blinking LED (in pooling mode), VDD is 3.3 volts & I use a 25 MHZ quartz.
The problem is here that the program does NOT work at all or it begins to work & stops after one or two seconds.
I used a debugger to trace it & I found that a Hard Fault occures & execution enters into HardFault_Handler infinity loop of startup_stm32fxx.s
I checked the board several times & I'm sure it has no issue, also the same program works fine when I decrease cpu clock to a lower value (by changing PLL params, e.g set PLL_P=4).
Seems all frequencies above 100MHZ causes some kind of problem. I guessed it may related to Flash access latency, but according to the datasheet with 3.3V of VDD it must works with 3 wait states & changing wait cycles did not helped me.


texts: Can I make a tesla coil with this setup?

texts: I had an old plasma globe and I ripped it apart to find a flyback transformer and some other components. I am not sure what type of circuit this is but I want to make it into a tesla coil. I wound a coil of really thin(thinner than your hair) wire around a 3/4 inch PVC pipe 700 times. I am planning to make a primary coil from standard jumper wire and will wrap it around about 30 times. Can I make a tesla coil from this? If not, what more do I need?


texts: I am doing some problems in linear and nonlinear circuit analysis, so I have a question...why is the voltage on an inductor represented as \$V=L\frac{di}{dt}\$ instead of \$V=-L\frac{di}{dt}\$, I know \$-L\frac{di}{dt}\$ is back EMF, but why is voltage written without the minus? Can someone explain?


texts: Integrating an AND gate into another logic gate

texts:
I am attempting to make a 4 bit computer with transistors. I've made a half-adder without too much trouble, but now I'm trying to incorporate the AND gate's output (the carry) into the next adder. This is the schematic I'm using for my AND gate:

simulate this circuit – Schematic created using CircuitLab

This isn't exactly how it looks (for one thing, mine has resistors), but this is basically it.

Using this, I know that if the LED is on, both switches are pressed. yay. But now I want to do something with that information. I'm at a loss for how to do this.

In a different gate where the output is after everything else in the gate (ie OR gate), I would just replace the LED with a wire that connects to the input of the next gate. I can't do that here because the output of the AND gate depends on the rest of the circuit.

Am I doing something wrong?

Thanks for the help.


texts:
Honestly this is almost embarrassing to ask, but I might as well suck it up and ask why (even though it's probably obvious)

Assuming I plug in that 9V battery into the +/- connections, the LED will fry, however that is a 270 Ω resistor and I've tried moving the LED to another spot on the breadboard (but still the same connection) with the LED and this resistor and it lights up fine.

I'm probably missing something fairly obvious, but this circuit right here is almost like it's ignoring the resistor? Why is that?


texts: Output impedance of current series feedback BJT amplifier?

texts:
So according to what I've read, in a common emitter BJT amplifier, an unbypassed emitter resistor acts as a current-series feedback path. The gain without feedback is:
$$A=\frac{I_o}{V_i}=\frac{-h_{fe}}{h_{ie}+R_E}$$
and the feedback factor is:
$$\beta=-R_E$$
The output impedance should then be:
$$Z_{of}=Z_o(1+A\beta)=Z_o(1+\frac{R_Eh_{fe}}{h_{ie}+R_E})$$
This is a different result compared to finding the Thevinin equivalent resistance looking back into the output which just gives the output impedance as \$R_C\$ whether or not an emitter resistor is bypassed or not.

Any insight on this seeming inconsistency would be helpful. Thanks.


texts: Can't run mosfets in one leg configuration with ACPL 337J optocoupler

texts:
I am working with a four pin MOSFET(C3M0030090K). You can find the datasheet here. The gate driver which I am using is ACPL 337J (datasheet here). The mosfets are in one leg configuration like this:

.

Schematic:-

I am getting the output at load resistance
.

However, I am also getting a similar pulse at gate of M1(The blue one is for gate and the black one is for load resistance.)

(How should I attach the schematic and library files?(via google drive or mediafire or what?))

Please suggest any edits in the circuit.


texts:
I have built an analog circuit PCB that I want to debug.
It has to get a bipolar power +-5V and an input sinus signal. The signal on the CUT (circuit under test), has buffered inputs (but a common ground on an entire PCB).

Only issue is that I don't have a dual PSU at hand (only a single output one). Thus I got an isolated +-5V DC/DC converter, et decided to try with that.

Circuit basically works, but I've noticed that signal generator influences the power rails (basically generated sinus wave gets 'induced' directly into the power rail as noise with much lower amplitude).

So I've figured something is not right how the equipment is connected together.
Namely the return path could cause this noise?

This is what I think is going on:

simulate this circuit – Schematic created using CircuitLab

The PSU and SignGen GND's are effectively connected to the mains Earth.

1) I was wondering If I could reduce/remove this artifact when I connect signal generator ground to the PSU output's 'Negative' terminal ?

2) Should I make some other connection to remove possible ground loop ?

3) How would I need to connect an oscilloscope to avoid making a second ground loop to mains earth again ?


texts: Arming A Brushless Motor Controller Connected to ESP8266

texts:
I am trying to control a brushless motor with WeMOS D1 ESP8266
The motor controller and motor specs are below:
https://www.ebay.com/itm/114619313561
A 11.1v LiPo battery powers both the controller and ESP8266 (VIN, GND, D9)
The motor controller user manual is here:

The wiring photo is here

Turning on the controller spins its fan. but the motor does not spin.
What is the arming procedure to get the beeps to get the motor started?
Have I chosen wrong hardware to work with a circuit board?
Here' some code:
#include <Servo.h>

Servo ESC1;

int pos = 0; //Sets position variable

void arm(){
  setSpeed(0); //Sets speed variable
  delay(1000);
  setSpeed(90); //Sets speed variable
  delay(1000);
  setSpeed(135); //Sets speed variable
  delay(1000);
  setSpeed(0); //Sets speed variable
  delay(1000);
}

void setSpeed(int speed){
  int angle = map(speed, 0, 100, 0, 180); //Sets servo positions to different speeds
  ESC1.write(speed); //angle
}

void setup() {
  ESC1.attach(2); //Adds ESC to certain pin.  GPIO2 is pin 9
  arm();
}

void loop() {

  int speed; //Implements speed variable

  for(speed = 0; speed <= 70; speed += 5) { //Cycles speed up to 70% power for 1 second
    setSpeed(speed); //Creates variable for speed to be used in in for loop
    delay(1000);
  }

  delay(4000); //Stays on for 4 seconds

  for(speed = 70; speed > 0; speed -= 5) { // Cycles speed down to 0% power for 1 second
      setSpeed(speed); delay(1000);
  }

  setSpeed(0); //Sets speed variable to zero no matter what
  delay(1000); //Turns off for 1 second

}


texts:
I have a circuit drawing like below image.
I need to replace a connector, but when I checked the connection is different compare to the original drawing. (New connection indicated by red color)

1) Original :-

CN25 (pin3) 5 V --> CN 10 (pin 1)
CN25 (pin1) GND --> CN 10 (pin 22)

2) New Connector :-

CN25 (pin1) GND --> CN 10 (pin 1)
CN25 (pin3) 5 V --> CN 10 (pin 22)

Is there any problem with new connection?

Appreciate in advance all the comments and answer


texts: Thread alternatives for embedded systems

texts:
I'm currently studying electrical engineering. Due to the pandemics, my classes were suspended and I'm using this time learning more about electronics and programming.
I'm currently trying to use a Pic16f628a and a generic digital display to build a digital clock with some features. The thing, is that I'd had to access a menu pressing a button in execution time, while the clock is being displayed. Normally I'd call a thread for the clock display and the main thread would be watching for inputs, but due to the simplicity of the pic controller I can't use the resource.
So, my C code (not yet implemented specifically to pic) is something like this:
void display_timer(){
  static struct current_time timer;
  static int is_time_set = 0;
  set_current_time(&timer, &is_time_set);

  while (is_time_set){
    system("clear");
    printf("########\n");
    printf("%d:%d:%d\n", timer.HOURS, timer.MINUTES, timer.SECONDS);
    printf("########\n");
    sleep(1);
    update_timer(&timer, &is_time_set);
  }
}
int main ()
{
  while (1){
    display_menu();

  }
}

During the sleep(), the controller would have to be able to watch for new inputs and act correspondingly.
One alternative I though was to use a state machine to store a button press, dividing the sleep function into 4 or 8 intervals, something like this:
  while (is_time_set){
    system("clear");
    printf("########\n");
    printf("%d:%d:%d\n", timer.HOURS, timer.MINUTES, timer.SECONDS);
    printf("########\n");
    for (int i = 0; i<8; i++){
    if (state_machine_input == 1){state_machine_input = 0; break;}
    sleep(1/8);
    }
    update_timer(&timer, &is_time_set);

It could be done, but I'd appreciate if I'd not have to add more complexity to the project, adding another state machine for example. What could I do in therms of software to implement this functionality?


texts: Why all voltage drop across NMOS MOSFET in ngspice

texts:
I am new to the ngspice simulation and when I run a circuit into ngspice, it drops all the voltage across a mosfet but this is not the case when I simulated the same circuit into LTspice.
Any help would be really appreciated!
The circuit used for simulation in LTspice and ngspice engine:

Output at node 3 in LTspice:

SPICE used for ngspice simulation:
MOSFET in ngspice

V1 1 0 100V
M1 1 2 3 0 nmod W=1 L=0.5
.model nmod NMOS level=49 Version=3.1
V6 2 3 DC 0V PULSE(0 10 2NS 2NS 2NS 50NS 100NS)
R1 3 0 100
.options TEMP = 25C
.options TNOM = 25C
.ic
.tran 0.1u 1u 0 0
.control
run
plot v(3)
.endc
.end

Ngspice output at node 3:


texts: How do I represent in Verilog a circuit with a resistor?

texts:
I write a piece of Verilog code:

module hBit ( dataOut, dataIn, read);
output dataOut;
input dataIn, read;
wire bitValue;

pmos( bitValue, read, bitValue);
nmos( bitValue, read, dataIn);
assign dataOut = bitValue;

endmodule;

which I think could be implemented by the circuit in the left side of the attached schematic. But a huge problem is that the signal stored in hBit deteriorates with time. So in the circuit on the right side of the schematic I added a step where the signal either remains low (for a logical zero) or it gets amplified to a high voltage (for a logical one). Note that this circuit includes a resistor in between the voltage source and ground, to avoid a short circuit when the additional transistor conducts.

My question is, how can I represent the circuit on the right with Verilog? Is there a way to represent a resistor in Verilog?

simulate this circuit – Schematic created using CircuitLab


texts: Different capacity batteries in parallel?

texts: I have two VRLA batteries, 2Ah and 7.2Ah in capacity. Both are 12v. What would happen if I connect them in parallel when they are charged to the same voltage?  can I use them to power a 10w LED?  what will be the effect on the two batteries in parallel when drawing current from them? (These are to be used with a 10W solar panel)


texts: Help with BJT Transistor analysis. The amplified waveform is more like a square wave any needs to be more sinusoidal

texts:
I have been exploring BJT transistors and implemented a common base amplifier.  I connected a signal generator to the voltage source labelled V2 in the below schematic.  The oscilloscope image shows the input above the amplified waveform.  It appears that it is in fact working, 10.8/.288 amplification.  I wish to  possibly use it to amplify a dynamic mic.  I plan to reduce the amplification and/or control it by a potentiometer.  Anyways..... my question is this

Why is the amplified signal "squareish" and not a decent replication of the input signal.  It looks more like an amplified square wave.  I created the circuit in LTSpice and simulated it.  The simulation is shown below.  I am reading materian on bjt transisters and especially common base amps,how is this fixable?  Which resistor values should i look to change Rc, Re, or Both.  Should the current level be changed through the emitter.  With no signal generator, it is 205 micro amps on the real circuit.  Do I need to adjust the voltage biase on the base.  Thanks for nay advice.

enter image description here


texts: Determining a solar panel, is this correct?

texts:
I want to power this device, which is a tplink wr703n. It is a small travel router. When I looked at the specs, it says that it uses 100mA for wifi, and 85mA to run it. This is incredibly low. Now, what I want to do, to run this device along with a webcam and a flash drive (a flashed openwrt, and flash drive is acting as the hard drive storage).

I currently have it running on a 5V / 1A usb port. The battery pack is 10,000mA (10A)
at the time of this post it has been 11 hours (edit; it just died past the mark when I start it by the minute) since I started this. It is down to <25% battery.

I am looking at solar panel / battery(ies) to power this for 24/7. If I want to know what I will need would I take 10,000 / total hours (running device with webcam streaming) to get the mA it draws per hour?

So, lets say it ran for 11 hours, so 10,000/11 = 909mA?

Seems about right. Now to get watts.

I would do w = v * a, so 5 * 909 = 4.5 watts.

Now to get how many watts for 24 hours would I do 4.5 * 24 = 108 watts? That seems high.
Well, then again the sun is only out (in my area)  would be 11 hours average.
http://aa.usno.navy.mil/cgi-bin/aa_durtablew.pl .

But maybe only 4-6 peak sun hours (if that is the correct term)

So we will say around 9 hours (just for the day not just peak) 4.5 * 9 = 40.5 watts .

If that is true, that were a pretty big solar panel for such small device.

Now this part is what I definitely help with. Battery. I was on a website looking at their 3.7V 6600mA Li-ion batteries, and made me question would I really want to run my stuff on 3.7V?

If I want to run smaller solar panel would I need a bigger battery to even it out? How would I determine adequate battery for the project?


texts: Why would a USB-C adapter have a pull-up resistor?

texts:
I'm talking about a USB type-C male to USB type-A female adapter, the ones you need to connect a USB flash drive to the latest MacBooks.

According to USB-C specification, this sort of adapter needs a 5.1 kΩ pull-down resistor on type-C plug's A5 pin (configuration channel). This is needed, because the host device won't supply power until it detects a connection on CC.

However, I have seen some such adapters boasting a 56 kΩ pull-up resistor, which would be needed for a type-C male to type-A male adapter, but as far as I know, not for the kind I'm talking about in this question. Why would they include this resistor? It was marketed as a safety feature.


texts: How to connect this 7 segment LED display to Arduino?

texts:
I have the following LED display, which I want to hook up to Arduino UNO.

According to datasheet, there is clock pin. Do I have to build external clock source for it or I can feed it from Arduino?

Any practical advice on how to connect will be appreciated.

Update:

Thanks to Oli Glaser, I've created sketch for Arduino and presenting it here, just in case someone will have same type of LED display.

const int CLOCK_PIN = 2;
const int DATA_PIN  = 3;
const int DATA_EN_PIN  = 4;

const byte numbers[16] = {
                    0b11111100,
                    0b01100000,
                    0b11011010,
                    0b11110010,
                    0b01100110,
                    0b10110110,
                    0b10111110,
                    0b11100000,
                    0b11111110,
                    0b11100110,
                    0b11101110,
                    0b00111110,
                    0b10011100,
                    0b01111010,
                    0b10011110,
                    0b10001110
};

void loadLed(byte d1, byte d2, byte d3)
{
  digitalWrite(DATA_EN_PIN, 0);

  digitalWrite(DATA_PIN, 1);
  digitalWrite(CLOCK_PIN, 1);
  delayMicroseconds(5);
  digitalWrite(CLOCK_PIN, 0);
  delayMicroseconds(5);

  for (int i=7; i >= 0; i--)
  {
    if(d1 & (1 << i))
      digitalWrite(DATA_PIN, 1);
    else
      digitalWrite(DATA_PIN, 0);
    digitalWrite(CLOCK_PIN, 1);
    delayMicroseconds(5);
    digitalWrite(CLOCK_PIN, 0);
    delayMicroseconds(5);
  }

  for (int i=7; i >= 0; i--)
  {
    if(d2 & (1 << i))
      digitalWrite(DATA_PIN, 1);
    else
      digitalWrite(DATA_PIN, 0);
    digitalWrite(CLOCK_PIN, 1);
    delayMicroseconds(5);
    digitalWrite(CLOCK_PIN, 0);
    delayMicroseconds(5);
  }

  for (int i=7; i >= 0; i--)
  {
    if(d3 & (1 << i))
      digitalWrite(DATA_PIN, 1);
    else
      digitalWrite(DATA_PIN, 0);
    digitalWrite(CLOCK_PIN, 1);
    delayMicroseconds(5);
    digitalWrite(CLOCK_PIN, 0);
    delayMicroseconds(5);
  }

  for (int i=0; i <= 10; i++)
  {
    digitalWrite(DATA_PIN, 0);
    digitalWrite(CLOCK_PIN, 1);
    delayMicroseconds(5);
    digitalWrite(CLOCK_PIN, 0);
    delayMicroseconds(5);
  }
  digitalWrite(DATA_EN_PIN, 1);
}

void setup()
{
  pinMode(CLOCK_PIN, OUTPUT);
  pinMode(DATA_PIN, OUTPUT);
  pinMode(DATA_EN_PIN, OUTPUT);
  delay(100);
  loadLed(numbers[7], numbers[8], numbers[3]);
}

void loop()
{
}

This can be optimized of course, but there is a slight problem - every fifth reset of the board will display random garbage. Tried to play with delay, set to 50 - no good. Looking for solution.


texts: Temperature sensor read out is influenced by LED

texts:
I'm trying to control some LED's (pins 2,3,4) with a temperature sensor. In the setup I do a calibration step to set the baseline temperature. When that's done, the LED at pin 5 is turned on.
Before I added the LED at pin 5, I already had some issues with the values I get from the sensor and this was fixed by the second answer of this post. I didn't have the capacitor and resistor with the same values as suggested, but it worked out fine.
After adding the LED at pin 5, I noticed that when the LED turned on, my sensor value jumped up a little.
Why does this happen and how can I fix this?
EDIT
Thanks for the answers, I tried a few of them, but they didn't work. I'm not sure if I did them correctly. I found this post and realized that the arduino board has multiple grounds. I got rid of the capacitor and the 10k resistor since they seem to do no effect. There's just a little jump after I turn on the LED at pin 5, but it's less.


texts: Does calibration involve fixing electronics or mechanical part?

texts:
My question is not 100% related to electronics design but it might be because I don't know the answer.

I'm writing a simple research on anemometer calibration. The thing is all the resources I found are explaining the procedure as measurement setup and comparing with a reference but not fixing. For the sake of clarity I posed my question with the following scenario:

  Let's say I followed the setup procedure, collected all the data and measured the anemometer's speed changes with respect to a reference and drew a regression line for the anemometer. But how will then actually fix this anemometer mechanically or electrically? The papers don't mention it. Is measurement and data acquisition enough for calibration? How will the anemometer function in a different (proper) way after these steps if there is no mechanical or electronic adjustment? Will the adjustment (fixing) be on software or electronics circuitry?

I mean: What will be the actual adjustment for an anemometer after collecting the data with respect to a reference?

I'm really confused. Any ideas?


texts:
During i study Sallen-key active low pass filter, i wondered why formula of Q is 1/(3-A). A is Voltage Gain.
So i searched from web, and i found this.

When R1=R2 and C1=C2, the Q be 1/(3-A). OK.
But, i don't know why the formula of Q's defined as a formula in the picture above.
Why the formula of Q's defined as a formula in the picture above?
I'd really appreciate it if you could derive this formula.


texts:
I'm assembling a new computer from components. It's something I've done quite a few times, but now I would like to skip the case. Except for some structural integrity and LEDs, the only technical necessity the case supplies is the power button that tells the motherboard to start.

I know I can buy generic power switches, but I have no idea which, exactly, to get, and how they should be interfaced with the motherboard. Can anyone help out?


texts: How can I use castellated vias with a breadboard?

texts:
I dabble with soldering every once in a while to the extent of soldering pins into through holes for prototyping but I have never worked with this type of packaging before.

The pads aren't really through holes per say, but i am still confused. Is there a way I could attach pins to these to work with a breadboard? Thank you for your help!


texts: can't assign PORTD a variable value on PIC18F

texts:
I'm using the following code to test some GPIO while I mess around with the PIC18F45K20 demo board. I realised something was strange when I couldn't increment a value and see it reflected on the LEDs after writing it to the port. Any idea why that is? I'm using the C18 compiler with MPLABX  IDE v3.05

Using aPICkit3 with this demo kit: http://www.microchip.com/DevelopmentTools/ProductDetails.aspx?PartNO=dm164130-4

#pragma config FOSC = INTIO67
#pragma config WDTEN = OFF, LVP = OFF

#define TIMER T0CON

#include "p18f45k20.h"

void delay();

void delay() {
   int counter = 0;
   for (counter = 0; counter<1000; counter++);
}
void main(void) {

   unsigned char d = 0;

   TRISD = 0; // all bits of portd are set 0 as output
   PORTD = 0; // deactivate all led's

   while (1) {

       d++;

       PORTD = d;

       delay();

   }
}


texts:
I would like to measure a 10k ohms linear potentiometer (position) with A/D converter using an op-amp like this :

In my case V+ will be 3,3 volts and Vout need to have maximum of 2,5 volts (which is my A/D converter reference). Can somebody could tell me which value are required for all resistors around the op-amp ?


texts: How is it possible to ever have frequency on a DC circuit?

texts:
Preface

Please read this carefully.  I put a lot of time into it and am genuinely attempting to understand. I've read numerous articles about DC and AC circuits and searched numerous places to get this answer, but I'm not sure I know the correct terms that are involved.

Also, yes I've googled "can a dc circuit ever have frequency?"  And the answers you get are that DC circuits have a frequency of 0.

Background

I'm attempting to build a circuit which examines an input frequency and converts it to MIDI.  Here's the schematic to the circuit from the official Arduino site (which is incorrect in at least one place):

Error Explained

You can see that for some reason the original designer drew the output from OpAmp2 even though it has no Input.

My Attempt To Test

Since I was attempting to test the code from that article.  I just wanted to read some values off of A0.  Just to see the thing work so I could begin to reverse engineer the obviously erroneous circuit.

I won't reproduce all of the code but here's the important part:
Note: The code is from the article where I obtained the schematic (https://www.arduino.cc/en/Tutorial/AnalogToMidi)

void setup() {
  // put your setup code here, to run once:
  Serial.begin(115200);
  pinMode(11, OUTPUT);
  // Set available bandwidth between 75Hz and 600Hz
  meter.setBandwidth(75.00, 600.00);
  // Intialize A0 at sample rate of 45kHz
  meter.begin(A0, 45000);
}

void loop() {
  float frequency = meter.getFrequency();
  Serial.prinln(frequency);
  if (frequency > 0)
  {
   // Find the index of the corresponding frequency
    int noteIndex = searchForNote(frequency);
    int note = notePitch[noteIndex];

Basically, all I cared about was reading the frequency I got back from the meter.getFrequency() method and printing it out to the serial monitor.

I whipped up the following circuit:

simulate this circuit – Schematic created using CircuitLab

(Now) Obvious Results

So I fired up the code and opened up serial monitor and started spinning the pot knob, but as you probably already know, Serial monitor only prints out -1.0 (negative 1.0).

There's No Frequency On a DC Circuit

At first, I was very confused.  Why wouldn't it ever get any different value even though the voltage input was changing?

Then, it hit me. There's no frequency on a DC circuit.

The Question

How would the code ever read frequency off of the circuit?  How could there ever be frequency on a DC circuit?  How is that possible?

I understand that I am totally ignoring the work done by the input in the original circuit (mic to op amp), but I also understand that the input will only be a series of currents and voltages which are simply amplified by the opamp anyways.

Pulses Become Frequency?

Is that the point, that they will become pulses and those pulses will have a frequency?

EDIT : Adding GetFrequency Code
You can see the source code of the ArduinoFrequencyMeter at: https://github.com/arduino-libraries/AudioFrequencyMeter/blob/master/src/AudioFrequencyMeter.cpp

Here's the source of the getFrequency() method:

float AudioFrequencyMeter::getFrequency()
{
  float frequency = -1;

  if (checkMaxAmp > amplitudeThreshold) {
    frequency = (float)(sampleRate / period);

    if ((frequency < minFrequency) || (frequency > maxFrequency)) {
      frequency = -1;
    }
  }

  return frequency;
}

It is interesting that if the checkAmp is not greater than amplitudeThreshold
then it will return -1.   So it is likely that is what is happening in the case where I'm seeing all -1.

But, because of the way the code is, you cannot differentiate that problem from the problem of the frequency falling outside of the range -- since frequency out of range also returns the same value.

I will probably alter the code at some point and have it return -1, -2, -3 for each case.


texts: Phase shifting the common mode signal from an instrumentation amplifier

texts:
I was looking at the AD620 instrumentation amplifier data sheet. I'm looking at the ECG practical application on there (circuit shown below). Pins 1 and 8 of the instrumentation amp go through a resistor circuit that allows us to use the common mode signal. The voltage at the node between R2 and R3 are fed into some sort of phase shifter/amplifier. This phase shifter is supposed to shift the common mode signal out of phase so it can be used as a feedback into the body.

My question is: How does this phase shifter work? What does each resister do, and what is the point of the capacitor? I tried simulating this in pspice, but changing the value of the capacitor didn't seem to affect the phase shift at all.

So in short, how does that phase shifter/amplifier work? What components control what exactly?

Thanks in advance!


texts: I am trying to understand how much time required in fpga time slots to fetch 128 bite value from DRAM3. I have a fpga board with 100 Mhz chip that talks with DRAM3 1600 Mhz. Thanks


texts:
I have a 20 liter electric storage water heater which has a 230V AC, 2KW electric heating element. The heating element is failing frequently primarily due to bad quality of water inducing faster corrosion of heating element. I decided to experiment with the current to increase the life of heating element. I want to limit the heating to about 80% of normal so that heating element runs at slightly cooler temperatures.

I have BTA41-600B 41Amp Triac available to me.  This triac has sufficiently high current rating for a 2KW coil.  Two options come to my mind.

Buy a electric fan speed regulator. These are available cheap and in plenty.  Open the enclosure, identify the triac in the circuit and just replace the triac with BTA41-600B.  The question is will this work?  I am an electrical Engineer and I do build small electronic circuits on my own, but I have never built a circuit involving Triac.
The other option is to build a simple circuit with a preset resistance connected to the gate.  But what should be the rating of this preset resistance?

There is one more question. Should I need to use a heat sink for this application?


texts: Adding decay (fall-off) to comparator circuit

texts:
Following this circuit:

I'm trying to create a slow decay of the peak, like so:

Op-amp output is controlling a dimmer pin of a LED driver.
I want the LED to fade out smoothly after a bang.


texts: About soldering wire for sophicated instruments

texts: What kind of soldering wire is used for soldering sophisticated instruments Like Transmission electron Microscopy (TEM) or electrochemical instruments? Is any high quality or alloy free wire required?


texts: MCP3561 Configuration registers resetting upon relay activation

texts:
I am looking for advice on how to solve a problem I'm encountering with my PCB project. The application involves reading a weight from a cluster of load cells and activating a relay that controls a solenoid valve should the weight fall below a given threshold. To that end, I am using an MCP3561 to handle the analog-to-digital conversion, a SAMD20G MCU for processing, and an Omron G5V-1 24V relay. The board is powered by mains voltage which is stepped down to 24VDC using a Mean Well IRM-10 switching power supply (PS1). The 24VDC output of PS1 is stepped down to 3.3VDC using a Recom R-78E3.3-1.0 (PS2) to power the MCU and the digital side of the ADC. An ON Semi LP2950CZ-3.3 linear regulator (PS3) provides power for the load cell excitation voltage and the analog side of the ADC. The ground planes for each power supply are tied together at the ground terminal of PS1. Schematic 1 depicts these power supplies. Schematic 2 depicts the ADC and load cell portion of the circuit. Schematic 3 shows the relay circuitry.
The problem I'm encountering occurs when the relay is triggered and a load is attached to its output. For testing purposes, I have attached a small fish tank pump to the relay output. The relay acts as a contact closure for L2 such that when the relay coil is energized, continuity is established and power flows from L1 through the pump to L2. The configuration registers of the ADC chip get reset to their default values when this occurs. This results in the ADC entering shutdown mode.
In an attempt to remedy this problem, I've included a section of code that checks the intersample interval of the ADC (time between successive data ready interrupts). Should that interval be too long, the code checks the configuration registers and reinitializes the ADC if needed. It appears to have resolved the symptoms of the problem, but I would like to correct the underlying issue before moving forward.
I should also include that the device functions properly without a load attached to the relay output. My best guess is that the inductive load of the pump motor is causing significant noise in the power supply to the ADC which is forcing a reset of the chip. I lock the registers during configuration to prevent any erroneous writes to the registers. When the error occurs, the registers always revert to their default values.
In addition to the code fix I described earlier, I've attempted a few electrical fixes as well: I replaced the ADC chip and I tried to increase the bypass capacitance of the ADC supply lines by adding an additional 10uF tantalum capacitor in parallel with the two caps already present on either supply line. Neither of these changes had any effect. I've contemplated including a snubber with the relay, but I am not certain of what R/C values to use nor how to retrofit such a change on a mostly SMD PCB.
To be exhaustive, I have also included a few screenshots of the PCB layout.
Any feedback you could provide would be very much appreciated. I am a new engineer and I'm trying to learn everything I can, so please forgive any errors I might have made either in the formatting of this question, the design of my circuit/PCB, or my troubleshooting steps.
Thank you in advance!
Schematic 1: Power Supplies

Schematic 2: ADC and Load Cells

Schematic 3: Relay Circuit

PCB 1: ADC

PCB 2: Relay


texts:
I'm using two timers of Pic18 family controller. The Timer 1 is used for RTCC and Timer 2 is used for counting minutes.

I have used a crystal for RTCC feature, and for Timer 2 I have fixed a count'x' and if count 'x' is equaled, then a minute have been surpassed.

And I would like to make a design such that when Timer 2 counts to 60 mins, do task 1.

My question is: Even though the two timers are of the same controller, will there be any lag (delay in secs) between both timers which would result in any possible delay (in sec or minute)?

Is there any delay possible, I trust there will be delay, but how much is my question. Will it integrate over time?

I would like to know more from people who have used this feature and in course of time if they have experienced any delay or so? And I would welcome any valuable suggestions too.


texts: How do you determine graded versus abrupt diode junction types?

texts:
The problem

When a diode is reverse biased with 8V, it has a junction capacitance of 15pF.
When the reverse biased is increased to 12V, the capacitance drops to 13.05pF.
Find whether it's abrupt or graded junction.

The solution

The capacitance of abrupt junction diode varies inversely with the square root of applied voltage. If it's abrupt type, then:

$$C_{12} = C_8\sqrt{\frac{8}{12}} = 15\sqrt{\frac{8}{12}} = 12.24 \; pF$$

The capacitance of graded junction diode varies inversely with the cube root of applied voltage.
If it's graded type then:

$$C_{12} = C_8\sqrt[3]{\frac{8}{12}} = 15 \sqrt[3]{\frac{8}{12}} = 13.10 \; pF $$

Therefore, the given diode is graded junction type.

Now for my puzzlement, I didn't understand what is the criterion from which they deduced that it's a graded type and not an abrupt type, can some please explain?


texts: How to Set up an Oscillator For Simple Frequency Generation

texts:
I ordered a bunch of these 8mhz crystals: http://www.amazon.com/gp/product/B005PSXEQ4/ (they sent me 13mhz instead though, no big deal...)

I just got them to experiment with.

I assumed they only need a current running through them to "vibrate" at the given frequency. Testing with the frequency part of my meter shows nothing, however.

I've searched for a simple tutorial on using these, but can find none. Perhaps I'm searching wrong terms?

And not to be unclear: I Just need a little guidance on how to set up an oscillator for simple frequency generation :D


texts: Identifying a capacitor specs from its labels supposedly "10T16" or "10T1G"

texts: Anyone have any idea what the "G" is? And a cross reference for a replacement?


texts:
I am currently building a controller for a slot car track.
These work by placing a car on a track on two rails that supply the DC motor of the car with current.
The track has an input of 20 V and has a 3 pin output for the controller. The original controller simply has a rheostat in it that regulated the voltage in the motor.
I want to build a controller that uses a MOSFET and PWM from an Atmega 328.
Here is the problem I am facing:
The polarity of the power supply to the track can change, because different track configurations mean that the car can travel in different directions.
To prevent any damage to the MOSFET I added a rectifier before the MOSFET.
The issue I am facing now is that I need to include a flyback diode across the motor but since the direction and polarity of the motor is possibly different, I don't know how to orient the flyback diode.
The additional challenge is I can only build something connected to the 3 right pins indicated on the picture.
How can I add a flyback diode to this motor which turns in either direction?


texts: Automatic voltage stabilizer with isolation transformer

texts:
How does this voltage stabilizer work?
I wish to understand the working principle of it and how does it buck and boost the voltage. I'm not much into transformer but I making a control circuit for it. so i want to know how does it stabilize the voltage.
I already have this voltage stabilizer in front of me, and it just miss the control circuit. I powered it up and tried it manually and it actually worked.


texts: How often does EMC certification have to be repeated (especially in Australia)?

texts:
I realise that this may be largely legal in nature and may be off topic, but I think that the users of this site are most likely to be able to answer accurately, so I shall ask and risk being shot down!

We have a device (which I helped to design) that we have sold globally for a long time with no issues. It was tested against the following standards in 2014:

EN 55022:2010 incorporating corrigendum October 2011
EN 55024:2010 incorporating corrigendum 2011
47CFR15.109 ICES-003 Issue 5 August 2012

However, an Australian reseller that we have just shipped an order to asked to see test reports (including some which were not relevant, which made me question their understanding of the matter). We sent them over and they have accepted them, but were not happy that the test results were over a year old. They suggested that the next shipment will require test results taken in the previous 12 months.

Has anyone else ever heard anything like this? Sounds like rubbish to me - we haven't changed the design, we haven't changed any suppliers and I don't remember physics having changed in the last 12 months - but is it another weird legal requirement? Is this particular to Australia, or is it also the case in other countries?

Secondarily, thinking about this, it strikes me that these standards may be updated in the future. Will we be required to retest every time that a standard has an update, or can we continue in perpetuity once a product has been certified provided that no additional legislation is passed which precludes the sale (I'm thinking about things like the RoHS and WEEE legislation which changed the landscape for a lot of products, but had a grace period built in).


texts:
I'm working from a while ago on a DC-UPS concept, after I've put all the things together and I'm requesting from you an advice, can I start to build it or I have serious flaws in it ?

Current comes from AC-DC transformer at 27.6V, goes into a distribution box like the one in this image
Current goes to battery-distribution box which is wired on negative terminal with a resistor (limit charging current) and a diode in order to block current flowing OUT of the battery + blocking current flow other way around (thru load distribution box) - if grid power is available and the transformer works current on this state could only flow INTO the battery and not OUT of it. Due to Schottky diode there is a voltage drop of max 0.55v - so the battery won't charge higher than (27.6v - 0.55v) = 27.05V
Current also goes to load-distribution box in order to feed the load with power

===

From battery distribution box perspective, if AC-DC transformer stops delivering current (grid is down) it will feed the load distribution box making it a fully functional UPS with zero delay.
Due to Schottky diode connected from battery distribution box to load distribution box there is a voltage drop of 1.1V - the battery won't reach a higher voltage than 27.05v so the load voltage (on battery power) will be somewhere between 25.95V (fully charged state) and 21.9V (near fully discharged)

===

From LOAD distribution box perspective, there are two voltages present > the battery (25.95V fully charged - 21.9 near depletion) AND 27.6V (if there is grid power available) so the load will be feed from AC-DC transformer at 27.6V when everything works in order OR 25.95V from battery when the grid drops out.

===

I'm not 100% positive that I've put the diodes on the right places, electrons flow from battery negative > positive / from PSU should be the same. If the battery discharges when negative electrons are attracted by positive terminal then charging is made by feeding electrons to the negative end ?

I'm willing to create an efficient circuit in order to keep a strip of LED's running all the time 24/7 - total load of the circuit is somewhere around 3Kw (yes, I know that the AC-DC transformer is too small for the job but currently I'm thinking about it upto ~ 800W)

(sorry for my bad english)


texts: Is it possible to program an Arduino in other languages?

texts: Is it possible to program an Arduino with other languages that aren't C/C++ based? What would be required to do so? I know that other IDE's are available, I'm curious about actual programming languages, like being able to code the Arduino in Python, as an example.


texts: What causes this knee in my MOSFET drain voltage drop?

texts:
FINAL UPDATE: Understand a previously mysterious power MOSFET switching waveform wiggle! @Mario uncovered the root cause here below, distinctive to so-called VDMOS devices, typical of many power MOSFETs like the IRF2805.

UPDATE: Found a clue! :)

@PeterSmith mentions an excellent resource on understanding gate charge specs in MOSFET datasheets in one of the comments below.

On page 6, at the end of the second paragraph, there's a passing reference to the idea that \$C_{GD}\$ becomes constant (stops varying as a function of \$V_{DS}\$) when \$v_{GD}\$ > 0. It doesn't mention the mechanism, but it got me thinking about what might be happening with \$v_{GD}\$ at the knee:

And son-of-a-gun, it turns out to be right where \$v_{GD}\$ rises above 0V.

So if anyone understands what that driving mechanism is, I think that would be the right answer :)

I'm making a close study of MOSFET switching characteristics as part of my study of switching converters.

I've set up a very simple circuit like so:

Which produces this MOSFET turn-on waveform on simulation:

A knee appears in the drain voltage drop about 20% into the Miller plateau.

I built the circuit up:

And the scope confirms the simulation quite well:

I believe I understand the "pre-shoot" bump (\$C_{gd}\$ charging current running "backward" through the load resistor), but am mystified as to how to account for the knee in the drain voltage drop.

Can someone more experienced with MOSFETs help me understand?


texts: I've got a linear step-up transformer (120V AC input) which has an output that under load nominally supplies 230V AC @ 100mA.  But with no load it floats to as high as 280 V. I need to switch the load in/out, but for "reasons" I need that no-load voltage to never exceed, say, 240V. Line voltage AC is sort of like a foreign country to me, where I don't get the natives' taste in hats. What's the easiest, cheapest way to do this? Seems like Zener diodes + resistor would have to be very large and probably a crazy way to do it?  I don't really want to load that output when it's not being used for its intended purpose.


texts: How to detect remaining capacity in a Lithium-ion battery?

texts:
I need my device to have multiple power sources, and connect to different power supplies depending on power availability. Each power source is a different rechargeable, Lithium-ion battery like this one. I am wondering what sensors/techniques/devices/etc. exist so I can determine "Battery #1 has 43% charge remaining, while Battery #2 is at 7%. Use Battery #1."

Clearly this is possible since all of our 'smart phones' predict with decent accuracy how much charge/capacity remains. Thoughts?


texts:
I am trying to create a glove that translates sign language into text. To do this i need touch sensors placed on the glove, however the only sensors that i can find detect a change in electromagnetic fields on both sides, meaning that if i place them on the glove they will be detecting a signal no matter what.

I have tried using multiple layers of thick electrical tape with no outcome.

when you touch the sensor it should recognise the press, however when on the glove it detects a press no matter what.

I am trying to observe the different letters signed. using flex sensors on each finger (already working fine) and touch sensors to further determine the position of the users finger. the error that i am having is putting the sensors on a glove so they do not activate when not pressed.


texts: Basic AVR flashing LED program is not working

texts:
So I have begun with projects using AVR microcontrollers. A few months ago, I got one of these to simply flash an LED but I accidentally cooked that one with a bad power supply. Now I got some new ones and I believe that I'm doing the same thing before but the LED isn't flashing!

This is my current code:

#define F_CPU 20000000UL
#include <avr/io.h>
#include <util/delay.h>

int main(void){

    DDRB |= 1<<PB0;
    while(1){
        PORTB &= -(1<<PB0);
        _delay_ms(1000);
        PORTB |= 1<<PB0;
        _delay_ms(1000);
    }
    return 0;
}

I'm able to successfully program the device but when I test it, nothing happens. The device is an ATmega168A. This is my current pin connections:

Pin 1(Reset): 5V

Pin 7(Vcc): 5V

Pin 8(GND): GND

Pin 14(B0): LED OUT

Pin 20(AVCC): 5V

Pin 22(GND): GND

Is there something obvious that I'm just missing?


texts: What are some problems with running a heating element in PWM mode?

texts:
I want to be able to control a heating element's (which runs on 230V mains) power level, and I'm thinking of running it using a solid state relay and PWM. However, I'm unsure of the implications of doing this.

Current draw - The heating element is 2000W, so ~9 amps. Will the switching this amount of current at high frequencies cause adverse effects to the rest of the power circuit in my home (light flickering, etc.)
Noise induced in the rest of the house circuit - I have read on EE.SE that SMPS cause high frequency noise in the mains circuit, and this can be avoided using a choke. Is this a valid solution to PWM'ing a heating element?

If PWM isn't a valid solution to controlling the power of a heating element, please suggest alternatives.


texts: I2C pullup resistors not working in simulation

texts:
I am trying to create a small project on PIC16F877a MCU, in which I am showing the lifetime of this project using RTC module and the temperature read from LM35 onto an LCD.

Working with PULLUP Resistor

Not working with 2k pullup resistors

The simulation of this project works fine in Proteus software, when I replace the pullup resistors for the I2C with the component "PULLUP" in the proteus library. But my ultimate goal is to implement this in hardware, so from I2C pullup resistor calculation formulas, the values calculated for this MCU is as following:

Rp(min) = (5V-0.6V)/8.5mA = 517.6 ohm

Rp(max) = 1/(0.8473)400(10^-12)*(10^3) = 2.9 Kohm

using these values from the MCU datasheet:

tr = 1000ns,
Cb = 400pF,
Iol = 8.5mA,
Vol = 0.6V,
Vcc = 5V

The I2C module is working at 100KHz.

But the issue is that I have tried various values in this range, but the time shown on the LCD remains 00:00:00. Can someone please guide me what I am doing wrong?


texts: Physical implementation of a band pass filter does not match simulations

texts:
I am building a pasive bandpass filter with the band pass between 134MHz and 139MHz. It is a third order eliptic filter, with theoretical attenuation of around 50 dB for the stop band and less than 1dB ripple in the pass band. This is the schematic:

And here is the response of the filter in a LTSpice simulation, from 50MHz to 500MHz:

Focusing on the pass band:

Everything seems to work fine enought for my requirements (I plan to use it to receive signals of small bandwidth from 137,1MHz to 137,9MHz, and S11 < -10dB there, so I should not have any problem. Besides, I thought about using a 20dB LNA to overcome the insertion loss of the filter).

After the simulations, I created the PCB in KiCAD. This is the final result:

It is just a microstrip (calculated with relative permitivity of 4,5 for FR4, with a thickness of the PCB of 1,6mm and 1oz of copper to have 50Ohm impedance) with the components attached to it. The board is 30mm x 21mm (I tried to keep it the shortest possible to avoid losses and parasitic effects). The PCB has only two layers and the bottom one is just a ground plane, connected both to the SMA connectora and to the upper groumd plane by the bias.

This is the filter bluid, where ±5% 0805 components are used:

I know that soldering can be improved, I am planning to buy better tools in the near future. However, all the connections are well soldered and the filter should work properly.

I then tested it with my homemade spectrum analyzer: a SDR with a BG7TBL noise source. The software used is callecalled Spektrum. It features a relative mode, where it records and averages the response of the noise source itself and then you can connect the filter to see its real response. This is the result, again, ploted from 50MHz to 500MHz:

Here, I see some serious problems:

The losses in the pass band are 28dB and not the simulated 5dB
The attenuation is of only 8dB, and not the simulated 50dB
As we increase in frequency, the effect of the filter dissappears

I have no clue about why this is happening. I have revised the schematics, simulated everything again, revised the PCB design, and even built 4 of these filter to ensure that it was not a soldering problem, but all of them have similar frequency responses. I have also tried different SDR software with no luck neither.

What am I doing wrong? How can I solve this problem? Any advice or improvement to the design will be appreciated.

Thank you very much in advantage.

Edit: In case the LTSpice/KiCAD files were needed, here is the github of the project:

Github


texts:
I'm programming a Spartan 3AN using ISE and I would like to implement a simple code that uses a Fifo :

When I push a button, a data is sent to the FIFO and when I push another button, the fifo is read and the data is sent to the LEDs...

Unfortunately, I've an error that occurs :

  ERROR:HDLParsers:3324 - "D:/.../TOP_MODULE.vhd" Line 129. IN mode
  Formal dout of Led_out with no default value must be associated with
  an actual value.

And I don't know how to change it... Here's my top module and Led_out component :

TOP MODULE :

library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.NUMERIC_STD.ALL;

entity TOP_MODULE is
port (
        M_CLK : IN STD_LOGIC;
        BUTTON_T15 : IN STD_LOGIC;
        BUTTON_T16 : IN STD_LOGIC;
        LEDS : OUT STD_LOGIC_VECTOR (7 downto 0)
        );
end TOP_MODULE;

architecture Behavioral of TOP_MODULE is

component Data_generator is
PORT (
        M_CLK : IN STD_LOGIC;
        BUTTON_T15 : IN STD_LOGIC;
        wr_en : OUT STD_LOGIC;
        full : IN STD_LOGIC;
        DATA : OUT STD_LOGIC_VECTOR (17 DOWNTO 0)
        );
end component;

component fifo_generator_v9_3 is
PORT (
        M_CLK : IN STD_LOGIC;
        rst : IN STD_LOGIC;
        din : IN STD_LOGIC_VECTOR(17 DOWNTO 0);
        wr_en : IN STD_LOGIC;
        rd_en : IN STD_LOGIC;
        dout : OUT STD_LOGIC_VECTOR(17 DOWNTO 0);
        full : OUT STD_LOGIC;
        empty : OUT STD_LOGIC
        );
end component;
signal RESET, WRITE_EN, READ_EN, FIFO_FULL, FIFO_EMPTY : STD_LOGIC;
signal DATA_IN, DATA_OUT : STD_LOGIC_VECTOR(17 downto 0)";

component Led_out is
PORT (
        M_CLK : IN STD_LOGIC;
        BUTTON_T16 : IN STD_LOGIC;
        rd_en : OUT STD_LOGIC;
        LEDS : out STD_LOGIC_VECTOR (7 downto 0);
        dout : IN STD_LOGIC_VECTOR(17 DOWNTO 0)
        );
end component;

begin

U100:Data_generator
port map(
            M_CLK,
            BUTTON_T15,
            WRITE_EN,
            FIFO_FULL,
            DATA_IN
            );

U101:fifo_generator_v9_3
port map (
            M_CLK,
            RESET,
            DATA_IN,
            WRITE_EN,
            READ_EN,
            DATA_OUT,
            FIFO_FULL,
            FIFO_EMPTY
            );

U102:Led_out
port map (
            M_CLK,
            BUTTON_T16,
            READ_EN,
            DATA_OUT
            );
end Behavioral;

LED_OUT COMPONENT :

library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.NUMERIC_STD.ALL;

entity Led_out is
Port (M_CLK : in  STD_LOGIC;
        BUTTON_T16 : IN STD_LOGIC;
      rd_en : out  STD_LOGIC;
        LEDS : out STD_LOGIC_VECTOR (7 downto 0);
      dout : in  STD_LOGIC_VECTOR (17 downto 0)
        );
end Led_out;

architecture Behavioral of Led_out is
signal cnt : integer range 0 to 1:=0;

begin
process (M_CLK)
begin
if rising_edge (BUTTON_T16) then
    rd_en <='1';
    cnt <=1;
    if cnt =1 then
        LEDS <=dout (17 downto 10);
    end if;
else
rd_en <='0';
end if;
end process;
end Behavioral;

My question is : Can someone explain where this error come from and how to change it?

This is my first use of FIFO in VHDL...

Thanks in advance !


texts: What's the meaning of "x" in RxD and TxD of UART?

texts:
RxD means Receive Data.

TxD means Transmit Data.

Where the "x" come from?


texts:
I have jerry rigged a PIC programmer but I need to use the PGC/PGD pins as part of the actual circuit. I'd like to be able to flash the PIC without physically swapping it between the circuit and the programmer. Will this do the job?

CTL_ON,CTL_OFF (from the programmer) will be either 0,1 or 1,0 (never 1,1). CTRL_ON,CTRL_OFF will only change when the PIC is powered down.
CTL_ON will only be 1 when RB4/PGM is high (i.e. PIC is being flashed). These rules will be handled in the programmer firmware.

Do I need resistors on the lines going into the T3 and T1 collectors? If so, can anyone explain why? I've spent a lot of time looking at web pages about this stuff, but can't quite seem to grasp the fundamentals. Pointers to any tutorials for beginners would be welcomed.

Note that this is not about isolating the power supply, that's already taken care of.

In this partial schematic, the RB7/PGD pin is just powering an LED for example, and can only be used as an output (when CTL_ON,CTL_OFF = 0,1), which is fine.

--update--

OK, so I guess I need a kind of switch which can be controlled by a separate signal from the programming device, like in the drawing below. Can anyone tell me how to implement such a thing? It needs to allow flow in both directions... Kind of like a relay, but for logic signals.

I think a bilateral switch is what I need, like this one:

http://www.ti.com/lit/ds/symlink/cd4066b.pdf

Right? Or is there a simpler way just using resistors, diodes and transistors?


texts: how to access the same RAM module from different modules?

texts:
I have a cyclone v gx starter kit. It comes with 4884 bits onchip memory.
I want to write a module for accessing the onchip memory.
So, I have generated the ram ip reference design from ip catalog like this:

module onchipmem (
    aclr,
    address,
    clken,
    clock,
    data,
    rden,
    wren,
    q);

    input     aclr;
    input   [7:0]  address;
    input     clken;
    input     clock;
    input   [15:0]  data;
    input     rden;
    input     wren;
    output  [15:0]  q;
`ifndef ALTERA_RESERVED_QIS
// synopsys translate_off
`endif
    tri0      aclr;
    tri1      clken;
    tri1      clock;
    tri1      rden;
`ifndef ALTERA_RESERVED_QIS
// synopsys translate_on
`endif
wire [15:0] sub_wire0;
wire [15:0] q = sub_wire0[15:0];

altsyncram  altsyncram_component (
          ...
          );

I can write / read data by creating an instance of this module:

onchipmem write_mem (
    .aclr(reset),
    .address(address),
    .clken(ce),
    .clock(clk),
    .data(data),
    .rden(1'b0),
    .wren(1'b1),
    .q()
    );

I want to save data by onchipmem in one module and read data from the same instance of onchipmem from another module. However, creating multiple instances of onchipmem will allocate duplicated block of RAM per instance.

In other words, a single RAM module cannot be called by multiple modules.
So how to implement a share RAM module for multiple modules to access?

I found this answer and suggested to use arbiter. He provided some sample codes of an arbiter but it is not completed.

I am new to fpga and cannot get how it works.

So I am looking for a real and completed example so that I can learn and test it in modelsim.

Please advise.


texts: DC link capacitor for induction motor drive

texts:
I am simulating FOC drive for a 5kW,400V, 50Hz 3-phase induction motor. The drive algorithm worked fine when inverter was fed from proper DC source of suitable value. However, in practice, the drive has to work as stand-alone unit so it has to rectify 3-phase AC signal, so I removed DC source and put 3 phase source followed by 3 phase diode rectifier. Without capacitor drive doesn't seems to work (and runs at 'infinite' speed somehow), maybe because diode rectifier can't pass reactive power (I learnt this from this question, however it doesn't clarifies all of my doubt, in fact there is disagreement among 2 very reputed users of the site who answered it).

I put 1000uF capacitor across DC link. (I selected value from the formula given in answer of the question linked above). Drive now works fine with allowable speed variation, however capacitor draws excessive current. I even precharged capacitor with 540V, but as soon as full load is applied, capacitor draws around 70A from supply (ref. fig. below, full load is applied at t=1 sec),while motor draws just the rated current of around 7-8A rms. The inveter current is also within rated limit (same as motor).

As can be seen this current is not continuous but is in spikes. Why is this so? Is it because capacitor is supplying reactive VARs to drive? It seems to me that this current is definitely a problem, right? If yes, then how do I solve this issue? Also, due to large capacitor current, current through my source and diode rectifier is very high as shown below.

Am I simulating something wrong? I thought capacitor current would be small as I am precharging it and then it will have to carry only small current due to voltage ripples, which are, as shown below, between few volts however they're quite frequent. I just can't figure out why capacitor current is so much and how to reduce it. If you need any more details, let me know.

Note : Inverter switching patten is decided by hysteresis band current control, this means current control of inveter is being performed.

Thanks in advance.


texts: How to fade LEDs switched by a 555 timer when supply is cut

texts:
Based on the well-known Inventable.eu article, I combined their CMOS timer PWM with adjustable duty cycle with logic that switches the supply to the timer circuit. Only when the gate conditions (AND; both signals are true) are satisfied is 12V supplied to the rest of the circuit.

The following image represents the circuit I have built:

My problem is achieving a ramp down effect when the 12V supply to the timer sub-circuit is shut off. My first attempt was an RC network at the base of Q4, but this only delayed the switch off and did not produce the desired fade out effect. For my second test, I added a 1000uF capacitor in parallel with the 560uF listed in the schematic. The resulting delay was too short.

My question: how to introduce a delay without compromising the pulse switching Q5. One possible solution is outlined here, but I am unsure how this could be adapted, and want some other options before salvaging the necessary opto isolator device.

Can you please explain in your answer how your solution interacts with the timer's PWM and the rest of the circuit, particularly the high side switching at Q2. Thank you.

Update: based on Mr. Tony Stewart's comments, it appears my design may simply be incompatible with any sort of off-ramp. While there are perhaps options involving the 555's reset in place of the high side switch, I prefer keeping it as-is, if only for the lower current consumption.


texts: Need of Baluns in  Radio Frequency Integrated Circuit?

texts: Can anyone help on this topic about balun used in in Radio Frequency Integrated Circuit (RFIC). I just wanted to know some basics about why baluns are used in RFICs. And also if there is any useful books regarding this topic.


texts:
I have a communication board, and I am designing an analog interface to it. The point is, to be able to measure 4-20mA and 0-10V analog signals. I know this is not a professional solution, but I just want to provide some data to my board.
MY board is supplied with 24VDC wich is also the supply of the 0-10V buffer amplifier. The other opamp for 4-20mA is supplied with a regulated 5V. The opamp outputs are connected to my microcontrollers ADC wich is capable of accepting 3.3V. My question is, do you think that the circuit on the picture would work properly?


texts: How does the Pre-charge and Equalizing circuit shown in the below figure work?

texts:
(from precharge circuit)

Could you please explain the operation of the above circuit regarding how the transistors Q8 and Q9 are responsible for charging the Bit Lines with VDD/2 while Q7 equalizes the voltage between them ?


texts:
I am using ESP8266 (esp-07) in a project. I was facing connectivity/range issues with my old router. So, I am planning to use a PCB antenna with esp. This is how it looks:

Here is the mechanical drawing:

I am wondering whether it will work. I have two reasons to be doubtful:

1) I don't have any knowledge about antenna design. So, I am not sure whether this antenna design is suitable for 2.4 GHz.

2) Antenna might be helpful only while transmitting. So it will work when ESP is trying to send some data to router but will not work when router is trying to send some data to ESP.

I want to know what you guys think. Should I try this out or is it totally worthless? Also, what will be more helpful - using this antenna on ESP or getting a better router itself?

EDIT:

Here is a link to the antenna:

http://www.alibaba.com/product-detail/Signalwell-2-4ghz-5-8ghz-4_60187711114.html


texts: Is using a shorter timer period less accurate than using a longer one?

texts:
I'm using a dsPIC 33FJ128GP804 and I'm trying to record data at 200 Hz as accurately as possible. My device also has a GPS and I'm noticing that my timer is drifting compared to the GPS by about 333 ms / hour. I think it should be possible to do better than that. My clock source is a 40 Mhz crystal with a tolerance of 30ppm and  stability of 50ppm and aging of 5ppm/year.

I have the Oscillator of the PIC running at 72Mhz. I can't change this, it's required to run the UARTS at 3Mbit.

During my testing to figure out why there is so much drift, I did an experiment. I'm running two timers, one at 200Hz and one at 5Hz. In the interrupt handlers, the 200Hz timer increments a long int by 1 and the 5Hz timer increments a long int by 40. The two long ints should remain the same. However, after 45 minutes, the values differ by 6. (30ms)

Why am I seeing a difference between the two values? And is there anything I can do to increase my timer accuracy other than changing the crystal? Does having a longer period increase accuracy? If so, could I use a slower timer periodically reset my faster timer. Would changing the source of my timer to the external oscillator from the instruction clock make a difference?

I do use the GPS time to correct the timing in post processing, but GPS isn't always available so I don't want to have to rely on it.


texts: Using relay contacts in series to switch DC loads

texts:
We are using relay DRM570110LT and We need to switch 3A @220VDC in the output when we have a DC load.
As the datasheet for this relay says, the rated switching current is 5 A, but I've been told this rated switching current is only for AC voltages. For DC voltages, the possible switching current is significantly lower (as per attached photo) and this relay can not be used for switching 3 A @ 220VDC in the output.
Searching on the web, I found some solutions like connecting relay contacts in series to increase the switching capacity. But;

1- How could series-connected relay contacts result in increasing the DC current switching capacity?

2- How many contacts should I connect in series to be able to switch 3 A for a DC load? Does a general rule exist?


texts:
Yesterday somone helped me out a lot desinging a level shifter from 3.3V -> 5V. (here)

At first I thought I basically understand what he did, but the more I read up the more I think my understanding of transitors is wrong.

So if I understand this correctly you have current flowing from the base -> emitter. If it is enough current it will allow current flowing from the collector -> emitter in a certain proportion (the factor being beta on the fact sheet). At some point the transistor is saturated, meaning that the current from c->e will no longer proportinally increase but has reached it's maximum.

Now I have a few questions I just didn't find too much about.

Does a saturated transistor have resistance on the C->E route?
In this schematic, why is 5V -> R2 -> Output not a working circuit in itself? Are digital inputs not grounded?
Why connect the Output to the collector and not the emitter? (emitter -> emitting something (current/signal)?)

And in terms of Voltage:

If Q1 is saturated and R2 is the only resistor in the cuircit (assuming transisors really dont have resistance) wouln't R2 cause a 5V Voltagedrop, meaning  there is no more Voltage (or less if there is stuff happening with the current at the output, I think that would be a voltage divider) at the output?
The same thing with R1: as I understand it current flows from B->E, meaning the circut is 3.3V -> R1 -> GND.  Isn't there 0V after R1?
What would the Voltage be at E in this schematic?

simulate this circuit – Schematic created using CircuitLab


texts: Suppose that a lithium-ion cell having total charge capacity Q=10Ah is discharged at a rate of 1A for 30min. What is the net change in the cell's state of charge (in percent)? Round to the nearest percent.


texts: Please help identify this exotic, probably Japanese board-to-wire connector

texts:
Found on an early 90's JVC stereo: 2 rows, 11 pins, the two rows are horizontally displaced against each other, kind of like a SUB-D connector. However, the pins are neither round, nor quadratic but bars.

The pitch is 3mm (horizontally) by 2mm (between rows)

Your help is greatly appreciated.


texts: LFO Triangle to Square wave peak distortion

texts:
I put together an LFO based off the one in the link below. I swapped out the op amps in the schematic for 741 op amps.
Everything works fine, except for the square wave. This is supposed to be the square at 1Hz.

Frequencies above 25Hz are fine, but below that the wave becomes more like shown.
Is there anything I can do to fix this problem?

Link to the schematic source.
The LFO is currently on a breadboard.


texts: Would additional low voltage DC sockets be practical on mass scale?

texts:
In RL I noticed that power supply cables with possibility to charge one mobile through USB compatible socket actually exist:

I actually started to wonder, whether for purpose of world building such idea could be move much more further. I mean both electronics and LED light has to convert electricity to low voltage DC, so the voltage would be already converted earlier.

OK, so the question is following:
Would additional low voltage DC sockets be practical on mass scale for purpose of connecting small electronics and light?
(Safety gains? More efficient conversion at socket instead of dozens of tiny converters? Only less cable clutter? Extra: Roughly which voltage would be reasonable?)

Clarification: I'm trying to make a setting, which is technically modern-like, but quite a few technologies and standards evolved in different direction. Instead of too improbable ideas like steampunk, I mostly try to use ideas that are technically feasible and reasonable enough, just in RL turned out not to be specially popular. I really doubt, that's a good question for EE because, they can can reasonably answer, that right now in RL trying to implement such standard would be not worth the effort.

It's like question concerning airships, ammo, etc... just not so cool.


texts:
simulate this circuit – Schematic created using CircuitLab

Consider the CMOS circuit shown, where the gate voltage Vg of the N-MOSFET is increased from zero while the gate voltage of P-MOSFET is kept at 3V. Assume that for both the transistors the magnitude of threshold voltage is 1V and the product of transconductance parameter and the (W/L) ratio is 1mA V-2.

Now my question is, for a small increase in Vg beyond 1V, what will be the region of opertion for both the MOSFET's? How do we calculate the drain voltage?


texts: Eagle: Alternative to Pinswap for GPIO expander

texts:
I'm working on a PCB which is basically multiple MCP23017 GPIO expanders driven from I2C. As I layout the board (in EAGLE), I frequently find places where using different IO pins would avoid vias and other routing complications.

But of course, the standard library part for this device doesn't allow pin-swapping, because that would be a functional change in the design. In my case, I'm also writing the software to drive the I2C, and in most cases, it's a simple re-ordering in code, to use a different pin - so it would be no problem for me.

(Especially since the MCP23017 allows pin-level selection of in/out mode)

Given this, is there a way to achieve pin-swap like functionality when laying out? Going back into to the schematic to adjust things manually is awkward but what I have been doing so far. I'm aware I could clone the part into a local library and edit the pins to enable pin-swap, are there any drawbacks or downsides to this?


texts: Output Voltage of a Current Mode Controlled Flyback Converter

texts:
I'm trying to use the NCP1014 (65kHz) to make a flyback converter. I'm using coilcraft's transformer B0570-BL which is specifically designed for the NCP1014, with turns ratio 1:0.06 or 16.67:1. I intend to take in narrow european mains (actually, narrow Indian mains, 230VAC ~ 310VDC) and generate 1A@12V.

Using the 'textbook' flyback controller equations, I get a duty cycle requirement using that transformer of:

dctyp = N * Vout / Vin
      = 16.67 * 12.7 / 310 = 0.68

The datasheet of the NCP1014 uses its eq.24 on page 17 for operating duty cycle,

dc = Ip * Lp / Vin * Tsw
   = (450mA * 3.4mH) / (310V * 15.38us)
   = 0.321

The two duty cycles are very different. I understand why this is - the duty cycle for the
NCP1014 is set only by the time it takes for primary current to ramp to 450mA. What
I can't work out is how the output regulation will work for this, given that the
required duty cycle is more than the cutoff.

Given the duty cycle the NCP1014 will cut off at, will the output have enough energy
to sustain a stable 12V output? How does one make sure this will work for a given output voltage (12V, in this case)

I have attempted to work though the datasheet in nearly its entirety to the best of my understanding. I have put it up here, if it will help.


texts:
I want to digitise a sweep signal. The frequency range is 1-100 Hz and the sweep time is 2 seconds. The amplitude is 4.08 Volts and an offset of 2.04 volts is added. ADC range = 0-4.04 Volts. I am currently using an SAR ADC and it is working fine. Would it be better to use a Delta-Sigma ADC? I need a fast and low power ADC. I can have a resolution up to 12-bits with the SAR and I don't think I need more than that. So the ADC resolution is not an issue.

Thank you!


texts:
I have a servo drive with 5 digital outputs. I will be connecting one of the outputs to a 24V relay to disable the drive if a fault occurs within the drive. The manual gives two schematics using sinking and sourcing.
What should I consider when choosing to sink or source? It seems to me that either way will achieve what I am trying to do.
My CNC controller output enables the servo drive using Di1 out of the 8 digital inputs (Di1 to Di8) This is wired according to the sourcing schematic attached.
I have read all the related posts but can't find anything that explains this or simplifies it enough for me to understand.
Here is a link to the manual if required.Lexium 28 manual
I am using the LXM28AU07M3X servo drives.


texts:
I am a student majoring in electronic engineering.

Nowadays, I am trying to simulate different forms of MOSFET such as Vaccum FET using Silvaco ATLAS and I need to make triangular or arch(square with half circle at one end) shaped electrode, but I can only make square regions.

I checked the manual but the only other shape I could found rather than square is quadrilateral.

I wish to know if there are only two kinds of regions(square or quadrilateral) provided in ATLAS or there are other ways that I can make triangular or arch shaped regions.

Thank you.


texts: Toggle LED on when Button is pressed PIC

texts:
I've got an olimex board with a PIC16LF76(Schematic - PIC IS a different pic):

I'm trying to toggle the LED when the button is pressed down, my C code looks like:

#include <xc.h>
#pragma config FOSC = HS        // Oscillator Selection bits (XT oscillator)
#pragma config WDTE = OFF       // Watchdog Timer Enable bit (WDT disabled)
#pragma config PWRTE = OFF       // Power-up Timer Enable bit (PWRT enabled)
#pragma config CP = OFF         // FLASH Program Memory Code Protection bit (Code protection off)
#pragma config BOREN = OFF

int main() {
    TRISA = 0x20;
    ADCON0 = 0b111;
    while(1){
        if((PORTA & 0x20)==0) {
            PORTA |= 0x01;
        } else {
            PORTA &= ~0x01;
        }
    }
}

Whats going wrong(Something similar would work for Atmel AVR)? My compiler is XC8 and I am using MPLabX. I can confirm the switch works, and so does the LED as I have tested these parts of the olimex board individually and independently without the PIC chip in the board..

EDIT:

I've tried the answers supplied still to no avail. Also the LED is on despite not setting it on.


texts: Trouble getting attiny85 to drive nRF24l01+

texts:
I'm attempting to make an nRF24l01+ send out a simple identifying code when a button is pressed. I'm trying to keep the solution as small as possible, so I want to use the attiny85 to drive it.

Her's what I have working so far:

I was able drive two nrf24l01+'s using a couple of raspberry pis, sending/receiving using node.js
I was able to flash a basic "blinky" program to my attiny85 via raspberry pi and avrdude

I'm now attempting to flash the attiny85 with this C code (I've also documented the wiring to the nRF in the linked file). But, I'm not picking anything up on the receiving nRF (which is still hooked up to the raspberry pi I used to test earlier). Here's the nodejs code for the listening side.

Any suggestions on how to debug this? This is my first attempt at programming an AVR microcontroller.


texts:
We're having problems at the moment getting our device (STM32F405ZGT6) to enter DFU mode, or rather, we can enter it, but it always takes a little over 2 minutes to appear.

We have a push button switch on the board to enter into DFU. If you let go of the switch at any point before the 2 minutes it will boot into application memory.

When it finally enters DFU mode it behaves as expected.

Interestingly, this will only work on the Mac.

Attempting the same on Windows, holding the button in while cycling power, Windows will straight away detect an 'unknown device' even after installing the drivers included in the Dfuse demo application folder. Trying to manually install the driver against this 'unknown device' then returns 'the device cannot start'.

We have also implemented a 'jump to bootloader' routine within our main application, which shuts down various things before jumping to the internal bootloader. Using this method on Windows will bring the 'unknown device connected' message in Windows. Using this method on Mac, nothing is ever detected.

How can I get the device drivers to enter DFU mode in a timely manner on our STM32F4?


texts:
How would one make use of transistor logic gates ? Take for example this transistor AND gate for example .

In all logic circuits, the output of one gate becomes the input of another . Here the output of the AND gate formed by Q1 and Q3 forms the input Q2 (which can be assumed as a NOT gate) . So , if and only if current flows through both bases Q1 and Q3 should current flow through the LED and to the base of Q2 ,thus enabling current to flow from the collector of Q2 to the emitter . This makes current flowing through "Out" essentially zero

This is how I understand AND gates  . If A AND B are 1 then output is one . BUT  If current flows through the base of Q3 (And not through the base of Q1) then that current will go through the emitter (with that 20k + 1k base emitter resistance{Measured with multimeter} resistance though) through the LED and to base of Q2 switching the transistor ON (The 20k resistance in conjunction with the voltage i'm applying at the base of the transistor (6v) is no where near the base emitter cut off current)

This is disastrous, the AND gate is not behaving like it should and is able to switch another base with current only applied at one base . How do you practically get around this ?

IMPORTANT : Ignore the first ground , it isn't supposed to be there

EDIT : The transistor i'm using is a 2N2222A not a 2N2222


texts:
I have two areas of a PCB design where I would like to 'split' an analog audio signal to go to different input/output paths without affecting the signal characteristics.

The first situation is routing the differential output of an audio DAC to multiple output stages. One is a LPF circuit for lineout and the outher is a headphone amp.

The second situation is splitting a line in signal to an ADC and headphone amp circuit (for monitoring).

Any suggestions, circuit references or design considerations would be much appreciated.


texts:
The problem statement, all variables and given/known data

Relevant equations
•Id=K*(Vsg-Vth)2
•KVL
The attempt at a solution
On part A,
Haven't had much experience with PMOS. Used large signal model, to find Rs.
Equivalent circuit:

We know that Vs=0. That means Vd=-7.5 V. If we say the voltage across Rs is Vdd-Vd, then that voltage is 22.5 V. Used 22.5V/Id and got 7500 ohms.

Used the Id equation to find Vsg to be 7.5 V

Vsg=Vs-Vg, and Vs=0, so Vg=-7.5

Now, we know there are 2 unknowns, so we need 2 equations. The first equation, we used voltage division to be
•-7.5=15*(Rg2/(Rg1+Rg2))

Then, the second equation was using the small signal model. The input resistance was the Parallel between Rg1 and Rg2:

•3M=((Rg1)-1+(Rg2)-1)-1
•We disregard the 10km because it is so small in comparison

This is where the problem lies. If we continue, then it leads to a value with negative ohms, which is not possible.

Any help is appreciated!


texts: Making LM78xx fail safe against short, open, reverese bias, flyback, etc

texts:
I want to use LM78xx for various applications. What I am concerned about is its failure modes.

1. Failure to Short
Not shorting Vcc to ground!! I mean shorting V_input to V_output.
Assume that you have a delicate and expensive piece of electronic equipment that works with 5V. You are using LM7805 to reduce voltage from 12~13VDC to 5VDC. For some reasons your LM7805 fails to short and your delicate electronic device sees the 12VDC instead of 5VDC and fries. I have seen this all around the web. How to protect against this?
2. Failure to Open
It is not as critical as the failure to short. It can happen as a result of over temperature (temporary) or permanent failure. What are the other things that can trigger this?
3. Reverse Bias & Reverse Discharge

I have seen that too big an output cap can cause reverse current going back to input. It is recommended to add reverse discharge diode protection. What else can cause this kind of reverse bias voltage?
From Various datasheets:

With the LM7805, the output capacitor should not exceed 1mf, as larger
values could damage the 7805 due to backfeeding of current when power
is switched off.
When a surge voltage exceeding maximum rating is applied to the input
terminal or when a voltage in excess of the input terminal voltage is
applied to the output terminal, the circuit may be destroyed.

4. Flyback
Does the diode on the above picture also protect against flyback current of an inductor? Or is it better to add a separate diode across the inductance load?
5. What else?
What are the other possible causes of LM78xx failure?


texts: Maximum Resonant Impedance of a piezo disc

texts:
I have a couple questions regarding piezo discs.  I have done research on resonant impedance and somewhat understand it.  What I am still confused on is whether or not the MAX resonant impedance would affect output frequency or volume? Below is a graph that I see a lot.  To note, I am not dealing with oscillator controlled piezos, but rather two terminal discs instead.

If I have two piezos with identical specs other than the max resonant impedance and a slight difference (20.2 mm vs 19.7 mm for a 0.5 mm difference between them) in diameter of the electrode, and if they are driven by exactly identical circuits, how is the output sound affected?

I have come across another term "average resonant impedance" which I am much less familiar with.  any info on this term is also helpful. Thanks!


texts:
I have to measure salinity of a brine in the range from 1500 to 3500 ppm.
Temperature of the brine is between 22 and 40 deg C. Measurement probe has to be galvanicaly isolated from the brine - no direct contact allowed. However sensor in plastic and immersing is fine.

Any thoughts?


texts: Replace a brushed motor with a Resistor (+ Diode)?

texts:
My first question at this forum was put at hold because initially was bad formulated and never get to normal in spite I had edited the question, so hope more luck now!

Once I am a noobie at electronics I only know to formulate the question in generics terms and because of this, I just can expect some generic help!

We have a Hubsan quadcopter/drone that has 4 brushed motors (BDC) and we want replace them with Brushless Motors (BLDC).

One of us that is more advanced at this conversion project has connected the 4 ESC (necessary for (BLDC motors)  to the correspondent Mosfet. The “signal wire” of our ESC is a twisted par with  white and a black wires, so the PWM Signal/White wire is connected to the Gate and the Signal/Ground to Source  of Mosfet.

With these connections the BLDC are working, so the quadcopter is flying! The problem is for that happen we must keep the brushed motors connected to the Flight Controller/Receiver (integrated) and spinning at same time as BLDC! Each BDC is connected by two wires to the correspondent  + and -  of the FC/Receiver (see picture)!

One of us has thought that a Resistor could replace the BDC but the truth is that after applying the Ohm's Law to calculate Resistor specifications and connect it to + and – where the BDC were connected, the BLDC don´t work anymore!
The question is: if the resistor alone do not replace the BDC (or we are applying incorrectly the law) can you give us some tips to further search?

Note - brushed motors draw 1V & 0.05A at idle and 6.5V & 1A at full throttle!


texts: What is a pulse width modulation for DC motors really?

texts:
I have studied the Navy related materials on pulse width modulation but I'm not clear as to what they really are or what they're supposed to indicate. From what I read, the output of PWM doesn't have a sufficient current carrying capabilities to drive a motor. It's added in a circuit to stabilize the output current.

The textbook is being vague about pulse width modulation that it's frustrating me: "Pulse width modulation is the method by which a fixed frequency and amplitude is varied in duty cycle by an analog signal." The book then describes that inputs to a PWM are a clock pulse and a DC level. I'm not clear where this clock pulse comes from.

What I need to get at before studying PWM circuits is what does a duty cycle indicate? What happens to the pulse width when the load increases? How does a DC voltage get converted into pulse width?


texts: Transistor Differential Amplifier Non-linearity

texts:
In The Art of Electronics 3rd Edition, the authors comment on how the grounded-emitter amplifier has a highly non-linear response, because the gain is related to the intrinsic emitter resistance (\$r_e\$), which varies with collector current. The addition of emitter degeneration allows this non linearity to be minimised (at the expense of gain), by ensuring that the emitter resistance is dominated by the emitter resistor, rather than \$r_e\$.

When discussing the long-tailed pair, it is said the emitter resistors are often excluded, leading to an expression for differential mode gain that depends on \$r_e\$ only, but there is no discussion on what non-linearity this would cause, and when calculating the gain the quiescent current is used to determine \$r_e\$, with no reference to the fact that \$I_c\$ will not (in general) be the same as the quiescent current.

I've tried to do some research online about this, but I haven't found any mention of any non-linearity this causes, and the graph here (fig. 12.4) shows a linear response over the active region.

Why does significant non-linearity not arise in the long-tailed pair as it does in the grounded-emitter amplifier?


texts:
I am a little bit stuck in finding the cut off frequency of high pass filter. Can someone  confirm to me that this is the formula I should use:

I have a transfer function H(p/w0), and to find it I'm trying this:
\$ 20 \cdot log(H_{(wc)}) - 20 \cdot log(H_{infitiy}) = -3 \$
But I'm not sure of it.
And by the way I only have the transfer function and w0 = 2*pi*f0.

NOTE : It is an exercise that I am working on it to prepare for my exam, I only need confirmation that the formula is correct.


texts: Charge discharge curve of a capacitor, Arduino

texts:
I'm trying to visualize the charge discharge curve of a capacitor with Arduino. This is my curcuit:

simulate this circuit – Schematic created using CircuitLab
13 is pin 13 of the Arduino and A0 is the analog pin 0 that I use to read voltages at that point.
What I do is to set 13 to HIGH/LOW with time spans of around 4.7 seconds, which is the loading time for that capacitor with the 10k resistor.
I expect that the charging should be slow, so I should get, when 13 is set to HIGH, a growing curve that doesn't really make it to the asymptotic value. When 13 is set to LOW, the discharging is going to be done though the 220 resistor, so it should be faster, and while voltage at that point decreases to 0, I should see the curve get down really fast.
Am I right or wrong in something (clearly wrong). The thing is that after getting the data through Serial and plotting it, I get just the opposite of what I expected:

So... what is going on?


texts: Step down transformer for a 1 HP Kitchenaid mixer

texts:
Hoping I can get some feedback here. I've been bought a really nice Kitchenaid mixer (110v/60hz) from the US as a gift...However, I live in South Africa where the voltage/frequency is 220-240v/50hz.

The mixer has a 1 HP DC motor, and based on my limited research this equates to 746 watts (although this site claims the output power is really 350 watts).

I'm going to purchase a step down transformer, but considering they are already hefty beasts, I'd prefer to get the smallest one possible for the job. I've read one should allow for roughly a 20% buffer for appliances with motors, so I'm thinking that a 1000w 220v-110v transformer should be good enough.

Is anyone able to confirm if this should be safe or are there other things I should consider? Thanks.


texts: Arduino Uno with 12V pump: transistor or optocoupler+12V relay?

texts:
I'm not a real expert in electronics but I'm going to start a new project that has completely captured me.

I need to drive a 12V pump with my Arduino Uno. The pump is "Dp0102" (12V, 0.7A). To power up the pump I wish to use an external switching power supply (12V - 88W) connected to a 12V relay and an optocoupler (maybe 4n35).

I was inspired by a project found on the web (Link), regarding driving a 12V fan. I would like to know whether it possible to modify and and use this circuit to drive a pump? Note that the fan's power consumption is about 1.2-1.7W but for the pump it is 8.4W. Should I use a transistor (instead of the optocoupler + 12V relay)? Can you help me choosing the right one?


texts: Stability of an unstable system using nonlinear element. Is it possible or not?

texts:
Say there is an system with open-loop transfer function $$G(s)=\frac{1}{s-1}$$
The system is definitely unstable.

If I put an any nonlinear system in cascade with \$G(s)\$ & from the output, a negative unity feedback. Is it possible to make the system close-loop transfer function is stable? It is assumed that the higher order harmonics are filtered in the close loop path.