texts: How can software give an accurate estimation of remaining usage time for a worn battery?

texts:
I understand that the system can read the current voltage and determine battery remaining percentage from that. Say, if a Li-ion battery in a mobile phone is at 4.3V, it's likely the battery is full. This method is quite reliable even if the battery is worn-down, i.e. when it cannot generate as much power (Watts) as it could when it was brand new, but its voltage will remain mostly the same.

My question is, while voltage can be used to determine remaining percentage, how does the system give an accurate "estimated usage time" for a worn battery? Assume there's a device running at a precisely fixed power (e.g. 1.0W), and it's able to run for 6 hours on a half-charged (50%) new battery. When the same battery is half-worn out and also at 50% charge, the system can correctly estimate that the device can run for 3 hours. Consequently, the system is able to determine by how much the battery is worn out. How is that achieved?


texts: Reduce output noise power while keeping input bandwidth constant

texts:
Assume our signal source has a white background noise. The output of this source is connected to our system.  We know that increasing the input bandwidth of the system leads to more noise flowing into the system and hence higher noise power.

Is there any way to somehow decouple the input bandwidth of the system and the noise power fed into the system, so that the power of the noise would be independent of the input bandwidth of the system seen by the source?


texts: Power loss shutdown occurring with Pico UPS

texts:
I'm currently suffering from issues where my raspberry pi appears to lose power over time and shut down (I'm using a pico UPS to handle file safe Shutdown). From the symptoms i'm seeing it appears like there's still power to the system (e.g. the red LED is still on when I come back to the raspberry pi after it loses power).
I haven't tried shorting pin 5 and 6 together after power loss to see if it can actually boots, but pulling the power out and plugging back in boots the pi as normal.

I need my system to stay up without human intervention however.

A quick look at the logs looks like the file safe shutdown is being generated by the UPS, however I've not been able to determine what's causing the power loss.

My project involves a simple header for a raspberry pi that converts UART to RS232 and multiplexes to one of eight RJ45 ports.

Each port uses the eight pins for the following:

pin 1: RS232 tx
pin 2: 3.3 V or GND sourced from rpi for binary addressing pins on 1-wire thermocouple
pin 3: 3.3 V sourced from device on the other side of the RJ45 to give 'connection sensing'
pin 4: 3.3 V or GND sourced from rpi for binary addressing pins on 1-wire thermocouple
pin 5: connected GNDs from rpi and end device
pin 6: 3.3 V or GND sourced from rpi for binary addressing pins on 1-wire thermocouple
pin 7: 1-wire thermocouple data bus
pin 8: RS232 rx

Could the power loss i'm seeing be caused by something i'm doing in my circuit? Or is there a well known issue with pico ups' that causes this behaviour (I've searched a lot but been unable to find anything).

Is there perhaps a way for me to ensure the system is always on? E.g. if it detects that it has shutoff, to keep trying to turn back on until it boots.

Thanks


texts:
I have 3x 18650s wired in a series, connected to the BMS seen here. The two outputs of the BMS are wired to a MOSFET that drops the voltage from 12 to 5, in order to power an Arduino Trinket Pro.

During prototyping I was using your basic DC jack to connect to the Arduino and charge the battery pack. However with the 3D printed part I have this all in I am using a different battery contact to connect the battery pack and Arduino.

Now I am needing to find a different way to charge the battery pack, preferably through a micro USB or USB C charging port, like you see on portable power packs.

I've picked up the TP4056, seen here, and the USB C version. My question is can I / would it be a good idea to splice off of the BMS outputs, and insert a diode into the connection between the battery contact that connects to the Arduino and a diode into where the TP4056 runs.

The first time I had tried it with a standard micro USB port, no diodes, which heated up very quickly.

Or, would I be better off just running the TP4056 straight to the positive and negative terminals on the pack itself, bypassing the USB.


texts: 24 V AC circuit for a hydronic space heating system

texts:
I just purchased a home with a gas fired boiler space heating system that is split into 3 main zones (3 circ pumps).  I am having difficulty getting heat to parts of the house and I want to first make sure there are no wiring errors.
The thermostats are Honeywell TL8100 series, the transformers are Honeywell AT20B1056 and the zone valves are Honeywell 4 wire (2 yellow and 2 red) V8043.  When there is a call for heat at the thermostat, power is sent to open the valve (yellow wires).  This in turn closes an end switch on the valve (red wires) and power is sent to the relay to energize the coil to switch on both the pump (110 V) and the boiler (24 V AC signal).
In one zone, I have the transformer's red wire going directly to the thermostat and in another zone I have another transformer with a black wire going to its thermostat.
Does this really matter?  Is polarity an issue here?


texts: How to accurately model a load when designing a circuit?

texts:
Imagine you have to design an intermediate stage of an existing circuit because it requires a new functionality. How do you model the rest of the circuit that yours will feed into?

For instance, if you need to create a protection circuit between the power supply and the rest of the circuit which draws 10mA @ 10V, how do you model the rest of the circuit? Do you just throw in a 1k resistor?

What if your load circuit has inductance and capacitance, how do you model that in your analysis?


texts: Electric frequency conversion from very low frequencies

texts:
I have designs for diy home generator that at the scale I’m currently building will output a very small amount of power at a very low frequency, varying between <1 and ~2 hertz using 2 pole magnets.

I’m going to want to convert that into a usable frequency, so a huge jump to 50 or 60hz.

Is there anything affordable out there which will allow me to do that, or are there designs anywhere that someone can share for affordable DIY.

To simplify things for anyone answering, the RPM for my design is fixed at no more than one hundred.


texts:
I'm trying to simplify an existing circuit that measures mains voltage.  I have a 0-3.3V ADC and 5V and 3.3V DC power supplies (the negative sides of which are unavoidably tied together).  The part I'm trying to simplify is the voltage scaling and offsetting.  The current design uses a transformer, with one side of the secondary tied to 1.65V (generated with a voltage divider and a voltage follower).

So far what I've come up with is this:

simulate this circuit – Schematic created using CircuitLab

This avoids the large, heavy and expensive transformers used in the current design.  Using 0.1% and 15ppm/degC resistors, I think this should give me reasonably good accuracy and temperature performance.  The op-amp in the diagram is a generic one; I'm actually using LM2902N.  This requires 1.5V head room on the positive rail, hence the use of the 5V supply.

There will be nine of these alongside each other, as I'm actually measuring three three-phase supplies.  They all have a common neutral.

I'm happy that the circuit gives me the gain and offset I want.  My question is whether there's anything that should be done to reduce cross-talk between
the nine measurements and anything I should add to improve noise rejection.

Also, could someone please confirm for me that the input impedance of this circuit is:

$$ Z = ( R1 // R2 ) // (C1 + R3 // R3) $$

and that I should select C2 for an appropriate roll-off frequency on this basis?


texts: Can we use the sawstop concept for metallic doors as well for home? If not how can we protect from door finger injuries?

texts: Is it possible to apply the Sawstop concept where the system induces small current and monitors changes when human finger is inserted? If not what are the nest ways [for metallic doors that closes automatically like elevator]


texts: The above sketch is for  an actual battery charger. At three locations the designer has run a direct line from one transistor collector to a transistor base with no other biasing, how do you evaluate what happens in these direct lines?


texts: How can I get a C program to execute Python code that sends commands to an Arduino?

texts:
I followed these instructions successfully, so I was able to get the Raspberry Pi to send "HELLO\n" to my Arduino Mega 2560 over USB and print to Serial console.

I have installed Open CV successfully on my Raspberry Pi using these steps and successfully tested camshiftdemo.c with my web camera on the pi.

Now I would like to execute camshiftdemo on the pi and get it to send "TURN LEFT\n" or "TURN RIGHT\n" strings to a 4-wheel rover. The rover is attached to my Arduino Mega 2560.

So basically, Raspberry Pi runs camshiftdemo.c, tracks an random object of user's choosing.  Then camshiftdemo draws an ellipse around the chosen object as it is moving.  If the object drifts to the left side of the web camera, the Raspberry Pi sends "TURN LEFT\n" to the arduino, causing the wheels of rover to turn left. If the object drifts to the right side of the web camera, the Raspberry Pi sends "TURN RIGHT\n" to the arduino, causing the wheels of the rover to turn right.

The camshiftdemo code is written in C and the first link above shows how to use Python to send simple ASCII commands to an arduino over USB.  How do I combine camshiftdemo.c and Python to work together? Specifically, how can I modify "camshiftdemo.c" to execute python code from the C program?

Would greatly appreciatea all / any advise.


texts: What would be the results of two bridge rectifiers in series?

texts:
What would be the side-effects of placing two bridge rectifiers in series?

The question stems from reading how some devices are manufactured with a bridge at the input to make reverse polarity mistakes impossible for consumers/users with, for example, battery powered devices; coupled onto that is the naïve curiosity I have of whether two rectifiers and filter caps in series after an AC/DC transformer would equate to a smoother DC signal (I somehow doubt that).
  Attached is a schematic of what I'm referring to, the image seems to have come out a tad blurry in places but can be seen.  It's only a fun question, but a genuine one nonetheless.


texts:
I am using a pelter module to cool a chamber, I also use the same module to heat the chamber just by reversing the voltage to to.(separately tested and working). This lead me to look for a H-bridge IC to do the same. But I really couldn't find something which supports up to 5 Amps(peltier peaks to 4A) easily. Hence I decided to make a circuit for the same.

I would be using a micro controller at 3.3v to control this, so I want to ask you guys if its okay to use a circuit like this to drive it? or am i missing something?

Thanks in advance


texts: How does this signal chopping circuit work?

texts:
There is a project online that was posted a few years ago that I want to explore. Unfortunately the progress was never updated so I will have to design it myself from the information that was given.
Unfortunately I can't for the life of me figure out how it was done.

The project stated here http://tubelab.com/articles/ideas/solid-state-opt/

My understanding of it is that it splices the signal amplitude at a constant frequency outside of the audio band through the transformer and then unsplices it at the other end.

It looks like an H bridge which would make sense in theory but I don't see how the mosfets won't just project their vgs voltage and signal onto the load completely negating whatever signal is present.
I also don't see why the top mosfets are p channel wired in reverse.
The more I think about the topology the more I don't understand.
Can someone explain this to me?

Here is a pic of my spice file:


texts: Stick-Slip Piezo Linear Stage Driver - Prevent the Load from Changing Driver Output?

texts:
I am currently trying to develop a circuit that generates ramp waveforms to control the motion of a piezo linear stage.
Specifically, two waveforms need to be possible to output: a slow ~250us upward ramp with a near-instant downward drop and; a slow ~250us downward ramp with a near-instant upward climb. It does not much matter when each change occurs, the point is that the slower ramp permits the piezo to 'stick' via friction and the faster ramp causes mechanical 'slipping' once per period. As with most piezo stages, this ramp waveform should have a reasonably large peak-to-peak, with 24V being the largest available voltage.
An important requirement for the solution is that the frequency of this ramp can change, since I want to control the speed of the actuator.
Feel free to ask for more images than provided for clarification, they should be easy for me to obtain from the given circuit. So far, I have focussed on outputting the waveform with a slow rising edge, so all included images will be relevant to this. I am assuming that all of this may be extrapolated to the other waveform, as well.
My problem is that when I connect the linear piezo stage to the output of my circuit, the waveform distorts to such a point that the piezo does not move.
The circuit that I have breadboarded is:

PWM can vary in frequency, which controls the speed of the linear piezo stage.
I have captured waveforms of the functionality at each node before and after the load is connected. Notably, if the unity-gain buffer is excluded, the voltage across the capacitor does not depend on the loading of the circuit while all other nodes become a constant or near-constant high or low voltage. With the buffer, the Deboo integrator circuit is unaffected but the output of the buffer is the same as if the buffer were excluded.
Below, channel 2 measures the input to the buffer, which matches the intended output, in purple. Channel 1, in contrast, shows the output of the buffer (Vout) when the load is connected.

I was able to measure the load's (the piezo stage's) capacitance of ~70nF using a DMM, but not the impedance. Following that, I mimicked the load with ~70nF of 'pure' capacitance, and obtained a similar waveform.
My question: How can I output a clean waveform to the piezo so that it actually moves?
The first idea that comes to mind is to add components to the output such that when the linear stage is connected, we have a bandpass filter. This would limit the frequencies at which the stage could operate though, so although I am open to further exploration of this option, alternate solutions are encouraged.
Currently attempted opamp: Texas Instruments TL051CP
Piezo linear stage: Newport AG-LS25
Further clarification: A piezo linear stage uses a piezoelectric material cycling through deformations to mechanically push and pull a linearly-moving material, relative to the surface that the piezo is anchored on.


texts: dd copy emmc for backup and use on other devices - gets input/output error

texts:
I am trying to backup my system that is running on emmc memory on my embedded device. The problem is that I keep getting input/output errors when trying. I have tried at 4M, 1M, and 64K, but still getting them. is this normal?

dd if=/dev/nbd1 conv=sync,noerror bs=64K |
   gzip -c  >
      /mnt/usbdrive/backup_image.img.gz


texts: Removing delay in UART communication layer

texts:
I'm writing to a UART Device. So I'm doing the following:

I'm transmitting the message as follows:

    HAL_UART_Transmit_IT(&huart5, data, size);
    uint8_t d;
    HAL_UART_Receive_IT(&huart5, &d, 1);
    push_single(&_readBuffer, d); // push to ring buffer

Then I'm reeving the data and pushing it to ringbuffer

void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart)
{
    if (huart == &huart5)
    {
        if (!isFull(&_readBuffer))
        {
            uint8_t data;
            HAL_UART_Receive_IT(&huart5, &data, 1);
            if(data !='\000')
            {
                push_single(&_readBuffer, data);
            }
        }
    }
}

in main i have to wait for data to be arrived and check if it's ok or not. I want to remove that delay:

char sendATcommand(const char *ATcommand, const char *expected_answer, unsigned int timeout)
{

  char x = 0, answer = 0;
  char response[200];
  unsigned long previous;

  memset(response, '\0', 200); // Initialize the string

  safe_flushReceiveBuffers();

  safe_write(ATcommand, strlen(ATcommand));
  HAL_Delay(timeout); // delay until message arrive
  previous = HAL_GetTick();
  ;

  // this loop waits for the answer
  do
  {
    uint8_t byte_avil = safe_bytesAvailable();
    if (byte_avil != 0)
    {
      // if there are data in the UART input buffer, reads it and checks for the asnwer
      response[x] = safe_read_single();
      x++;
      // check if the desired answer  is in the response of the module
      if (strstr(response, expected_answer) != NULL)
      {
        printf("\n");
        answer = 1;
      }
    }
  }
  // Waits for the asnwer with time out
  while ((answer == 0) && ((HAL_GetTick() - previous) < timeout));

  return answer;
}

2nd problem:

I'm also receiving some garbage characters from the UART + correct message. I don't know from where those characters come from.


texts: Suggestions for my fifo arbitration / path merge design

texts:
I am currently working on a design which requires me to design a module that combines 2 input streams of data & output it into a single output stream. To elaborate more, i can describe it with an example :
 CLK Ip dword0  Ip dword1   Output
  0       a        b          -
  1       c        d          a
  2       e        f          b
  3       g        h          c
  4   --- more data -         d
  5   --- ditto -----         e

So basically the output preserves the order of the inputs (input0 of the same clk followed by input1 & then move to the ip0 of the next clk). I know we need to stall the input stream at some point because the output rate is getting halved.
My idea so far: I was thinking of having the arbiter after the FIFO (so basically store the 2 input dwords into the FIFO, then keep popping the FIFO, store the rddata with dword0 & dword1 in a temp register & in a state-machine assign the dword 0 to output first & then in the next state assign the dword 1 to output. At this point assert the read en / pop the FIFO.
So, do you guys have any suggestions to improve the performance or do you see any issues with the plan so far ?
------ Added requirement ------
There's a 50% probability that some clk cycles, the input data stream is invalid. i.e. the valid could be set high for clk cycles 0,1 & invalid set to cycle 2 (so that input stream on clk 2 can be ignored). Hence, I added a FIFO so that I can go for the max number of cycles without stalling the input.


texts: System design for python driven autonomous vehicle (boat)

texts:
I've very recently started a project (with a few friends) where I will be building an autonomous boat. From a high level, it will be solar powered with a relatively simple motor driven propeller, and some on board sensors and such. It will be GPS guided in that navigational coordinates will be uploaded to the boat and it will then "go there" (I'll leave path-finding out of it).

My background is computer science and I'm more or less just "getting into" the hardware aspect of things. My primary question is regarding design/layout of the control system for the boat itself.

At first pass my intent is to have a main on-board computer (Raspberry Pi perhaps), which talks to several on board micro-controllers (maybe Arduinos). The micro-controllers would report sensor data back to the main computer, which would make decisions and issue instructions to the controllers to drive physical operations (e.g. stop motor, turn camera, activate self destruct).

Is this general paradigm reasonable? or is it fundamentally flawed in some way that I haven't thought of yet?

If anyone would like more information just let me know, I didn't want to rant too much. Thanks in advance!


texts: Short circuit current through multi-winding transformer

texts:
I have a (radial) system with several multi-winding transformers, for instance one 24 MVA 7-winding transformer from 11 kV to 1.92 kV.

I want to calculate what the short circuit current will be on the primary side, if a 3-phase or a line-line fault occur below one of the secondary windings?

For a two-winding transformer, this is quite straight forward.

However, I don't know what values to use in the multi-winding case. The capacity of each of the 6 secondary windings are 4 MVA. My intuition tells me the secondary winding will be the limiting factor.

Assuming the short circuit capacity is 100 MVA, and the transformer impedance is 10%, what will the short circuit current be?

There will be no contribution from the other secondary windings.

I would think the capacity of the secondary winding (4 MVA) is dimensioning, and therefore calculate it this way: (3 phase fault)

\$ Ik'' = 100MVA \cdot\$ \$   4MVA  / 0.1 \over \sqrt3 \cdot (100MVA + 4MVA / 0.1)\cdot 11 kV\$ = \$ 1.5 kA \$

But it could also be the primary (24 MVA):

\$ Ik'' = 100MVA \cdot\$ \$   24MVA  / 0.1 \over \sqrt3 \cdot (100MVA + 24MVA / 0.1)\cdot 11 kV\$ = \$ 3.7 kA \$

But then again: It might be something completely different, since a 7-winding transformer is quite different from a 2-winding. Any views on this? Any literature maybe?

Not of any relevance: Vector group: Yd11y0d11.20d0.20d11.40d0.40


texts:
I just bought a 120mm deep cool fan with a rating of 12v, 0.07A (70 mA)= 0.84watts

Currently I only have a 12v 2.5A (2500mA) DC adapter.

I'm a complete noob in electricals...so the question is-

Can i use that adapter to power my fan?..is the power too high and will it burn the circuitry inside the fan...or is it ok to use that adapter.
Should I buy another adapter that matches the ratings of the Fan?

Thanks in advance.


texts: Power consumption of a recirculating diode in a LED driver

texts: I have a LED driver design that is supposed to put out 10A at 5.2V and uses the LM3409HV driver chip from TI. I've been going through the design and I'm confused about how the power consumption of the recirculating diode is calculated. The datasheet calculates it as 750mV * the current through the diode (page 26, section 9.2.1.2.7). I'm assuming this is the diode's forward voltage. However, shouldn't this be Vin * the current through it?


texts: Transfer function and weird assumption in circuit

texts:
I am new to the concept of transfer function and I have a question that might be somewhat stupid. Given the circuit depicted in the image, we are asked to find the transfer function.
According to the solution, we assume that there is no current coming from the loop which is defined by the capacitor and Vout. Why is that assumption correct? I mean, if we connect an external circuit between the Vout pins, there must be a current flowing there, so the calculated trasfer function fails to describe the Vout-Vin relationship correctly.


texts: Can a level shifting circuit shift voltage the other way around?

texts:
I'm working on a project where I use an FPGA and connect it to multiple servos (called AX-12), which are connected in a daisy chain. Each servos has a unique ID so them being connected in a daisy chain is not a problem.
The FPGA transmits commands to the servos and after that the servos respond by transmitting their own packets (called a status packet, according to the datasheet). I want to focus on the respond part in this question.

The "CM-5" you see in the picture is replaced by the FPGA in my project.

According to the datasheet (which you can find here):

  To operate the Dynamixel actuators, the main controller must support
  TTL level half duplex UART.

For the main controller' I'm using a DE2 evaluation board by Altera (later to be replaced by the DE0-Nano). This board's outputs for '1' is 3.3V.
While 3.3V works for TTL, I found out that the servos respond better when they receive 5V.

To do this, I use this level shifting circuit:

So for the transmission part, all is well. The FPGA outputs the '1' as 3.3V and the servos receive it as 5V, which is good.

My question is about the voltage when I receive the packets from the servos. I assume (haven't checked) that the servos transmit the status packet bits in 5V.
Does the level shifting circuit get the 5V and shift it back to 3.3V? And the 0V to, obviously, 0V? If so, how does it work?

If you look in the datasheet, you will see that the manufacturer says you should use a buffer with a pull-up resistor to 5V. I have tried using that buffer and it did no go so well. So what I'm also asking is, will that level shifting circuit use as a buffer?

Thank you!


texts:
I have 500 watt wind turbine which gives watt around 100-500 depending upon weather condition.

I use it for led lighting. total led wattage is around 500 watt.

so most of the time not all of the led are turned on. how do i add external power source which can complement wind power ? ( i.e. circuit should prefer to use wind power whenever available, else use grid power. )

thanks.

edit:

https://electronics.stackexchange.com/a/51756/1312 explain it further. also read comment. can capacitor help in combining multiple power source ?


texts:
On the internet there is unbelievable amount of contradicting information. The textbooks don't explain it in depth enough, so I have to ask here.

I have an induction heating system which has a coil trough which there is applied an AC voltage which frequency I can regulate and I use cooking pots as load.

I'm interested in power consumption of different cooking pots. I'm most interested in why aluminium pots can't be heated at the same frequencies as pots with higher permeability.

One reason could be the hysteresis losses, but many papers say that hysteresis losses only contribute up to 10 % of total power losses inside the pot. So if this is true, this couldn't be the reason.

They then say that the losses increase if the resistance of the pot increases. But that doesn't make sense because then plastic pots would have the highest losses because of high resistance. My thinking is that if the pot has a low resistance, then the currents will be higher which will increase the losses. If a pot has high resistance, less current will flow and the losses will be lower. But this is not what we observe.

So what is the reason for this? Low resistance materials induce poor losses and high resistance materials induce poor loses. If resistance is not what determines the losses, then what is?

EDIT for mkeith: I am more interested in how the eddy currents are induced inside the material and how it leads to losses, than an actual product.

But to answer your question, induction cookers can only heat aluminium pots at high frequencies (around 100 kHz), while steel can be heated equally well at 18 kHz and lower (they use 18 kHz+ to avoid noise in the audible range).

Now Inductance with steel pots is indeed a lot higher, and so is resistance felt by the coil. Now what happens if we put on an aluminium pot? The resistance and inductance decrease. This effects resonant frequency of the resonant LC circuit. The resonant frequency increases. Also because of decrease in resistance, the current increases (if we increase the frequency to match the new resonant frequency). This would mean that because we have a low resistance, the current drawn would be very big and because of so low resistance the heating would still be smaller. Big current increases the negative losses because of internal resistance of the coil and the switching elements can only take a limited amount of current.

This explains why we can't heat aluminium at low frequencies. We increase the frequency to increase the resistance of aluminium pots because of increased skin effect which allows us to have lower current running through the switching elements for the same amount of heating power.

Now I understand this, but the real question I'm interested in is the following. If we have a current source that maintains 10 A at a fixed frequency. And in one case we have an aluminium pot causing 0.3 ohms increase in resistance over primary and in the other a steel pot which adds 5 ohms of resistance over primary. In both cases the internal resistance of primary is neglectable.

We see that aluminium pot is taking 30 W of power while steel pot is taking 500 W. But how does this make sense from the following perspective?

The current is the same in both cases, so the electromotive force created in both pots is the same. Because the pots have different electrical resistances, the eddy currents inside of them should be different as well.
The losses are calculated by current flowing inside the pots squared times the pots resistance.

Because resistance of aluminium is lower, the currents inside them is larger, which means more losses should be created in the aluminium pot. But the actual result is just the opposite. This is the main part of my confusion.


texts: How do I calculate the capacitance in this circuit?

texts:
I can't find any source online to how I can calculate the capacitance in this circuit, the previous questions seem solvable, but any help would be appreciated thank you!!

Here’s a formula I found, but I’m not sure it’s applicable in this case.
formula


texts: Capacitor discharge and 1/2 terminal voltage sources

texts:
I understand that this is really basics of electronics, but I would really appreciate if somebody clearly explained following question.

So here is a small set of questions related to similar topic:

What's the difference between 1 and 2 terminal source? As far as I understood one wire is the max-potential(+) and the second is low-potential(-). But what is the low-potential? Is it usually 0?
I tried to simulate a simple circuit with capacitor charge/discharge function. In one case I tried to use 2 terminal source, assuming that low-potential ~ virual ground. The capacitor did not discharge. In the second case I used 1 terminal source and ground - capacitor successfully discharged. Why the capacitor did not discharge in the first case?
Is 0V the same as ground?

I have added 2 images below here illustrating the problem.


texts: Process function to NAND and use only negative conjunction functions

texts:
I have a system built only NAND implementing this function.

I have to process this function using only De Morgan's law and finally get only negation conjuction functions.

I did it but I'm not sure is it good. Could you help me?

++++ UPDATE:
I did this gate also in CEDAR, is it correct?


texts:
I apologize if my question seems ordinary and silly. Unfortunately, I have not good electronic knowledge. but the question is as follow:
assume we have a power source like solar panels that produce power P. in other hand we have two batteries namely B1 and B2 with terminal voltages V1 and V2 correspondingly. What is the charging current of B1 or B2 if I decide assign power P to each of them. Are they obtained by $$I_1 = P/V_1$$ and $$I_2 = P/V_2$$
If s, then can we conclude that $$Q_1 = I_1*T$$ is more or less than $$Q_2 = I_2*T$$ In other words can we conclude that in one scenario we obtain more charge than the other one???


texts: Is it safe to use Vcc from processor side or use another supply

texts:
I have a Toradex Carrier Board. It has few GPIO pins. I need to use them as inputs. In our application we will give 12v input but as the pins can only take 3.3v so I have to design a simple board which will contain optocoupler for isolation and will pass on 3.3v. Circuit will be like below:

Now I am confused with the pin number 3 & 4. I need 3.3v so what I have decided is to use the 3.3v of the processor. So is it safe to use the 3.3v from processor or should I use a regulator to convert 12v to 3.3v and feed that 3.3v to pin 4.


texts: Full bridge rectifier with an RF filter front end

texts:
I'm designing a trigger circuit that only responds to a certain frequency. Essentially the plan is to have many of these circuits all buffered and running in parallel such that I can play a mixed tone into the front end and activate as many or as few threads as I want. I have simulated one such thread in LTSpice IV as shown below but try as I might the circuit either only half rectifies or doesn't filter. The example below is kinda confusing. It shows the proper frequency response (but shifted down by a few hundred dB), however this is apparently not reflected in transient analysis.

Filter response at that same node:

And as a corollary to this, how would I go about smoothing this signal with a capacitor without ruining the frequency response? Putting the filter ahead of the rectifier causes singular matrix errors at runtime.

Thanks


texts:
I am getting quote for solar power. Two quotes say I need approximate a 6400 kW system.
One said I needed 5760 kW system. When I asked why the difference, this was the reply.
"The 5760 is not what the system is going to produce... that's DC size of the system. The micro inverters convert the energy to AC or alternating current that is what the system will produce 6394 kW. It's towards the bottom of the proposal"
Is this true? What I have read seems to indicate the opposite if anything.


texts:
I would like to power my Attiny13a MCU with a transformerless capacitive power supply. The MCU itself needs only a few milli amps and it will drive 2 LEDs at 15mA each through it's digital pins. So I guess total power consumption might be less than 50mA at 5V.

I have come up with this circuit but I have a few concerns.

Would this circuit work fine with my MCU?
Sometimes there is a power outage and my home inverter starts supplying square wave ac - will this damage this circuit?
Should I use a 65V smoothing capacitor instead of the 25V one?
Would those 1/4w resistors do their job or should I get 1/2w ones?
Do I really need the resistor before the zener diode? if so is 100R correct?
I saw another circuit which has an additional resistor. Is that really needed?

As for safety concern the project will be enclosed in a plastic box placed in the ceiling where no one can reach and I will also add a warning label.

Thanks in advance.


texts: Can LTSpice waveforms be exported for further processing?

texts:
The following LTSpice temporal domain output is taken from https://electronics.stackexchange.com/a/55256/56469. Thanks @Oli.
Is it possible to acquire the underlying data that generated V(noise+sig) as a table/file of data points for further processing? Some sort of export function perchance?


texts: How to make a negative flank to a negative pulse from normal state not connected?

texts:
I have a reset signal which should be triggered by a falling flank from 5V to 0 volt.
This flank should generate a low pulse (5V -> 0V -> 5V). This can be done by just adding a capacitor and a pull-up. However since I also use the RESET pin for debug wire I can not have a capacitor. So what I need:

Input: falling flank from 5V to 0 volt
Output: not conected -> 0V -> not conected

Outside this circuit I will have a 20k pull-up to the RESET pin. The important part is that there may be no low pass filtering by caps on the reset pin since that will afect the debug wire.

How do a low cost circuit look for this?


texts: How is voltage always able to increase, if electrons move at the speed of light?

texts:
If current is the rate of flow of electrons past a point. Let's say a wire is full of electrons, and of course they pretty much are already going the speed of light, minus friction. What would increasing the voltage do?

You can't go faster than the speed of light, and you can't increase the rate of electrons because no more fit in the tube. I am just curious what this would look like. I feel like I am missing a key concept.


texts: Can i use only one charging module for my wireless earbuds?

texts:
I have lost my charging case for my earbuds some time ago, and now I have a 3D printer, I want to make a new one. I am fairly new to electronics, so my question is would this design work for the case?

All i know about the earbuds is from the FCC documentation: https://fccid.io/2AFTUYL001
Note that there are two cases in the documents, I had the smaller one without the lid.
I found that the buds use an internal 541112 battery that is 3.7v and they of course have a small pcb.
Check out the pics on this link: https://fccid.io/2AFTUYL001/Internal-Photos/Int-Photos-4080213
What i really don't know is if the buds themselves have an internal battery managment or if the case itself managed their overcharge/overdischarge.
Is it fine to use one charging module(TP4056-1A-MUPR) that's hooked up to a battery and the two sets of charging pins?


texts:
I 'm trying to figure out the way IC encoder ΤΧ-2, encodes signals. The procedure, if I am correct, is:

Receives input data (DC signals).
Generates digital pulses, via an internal oscillator.

a. in case of RF transmission, frequency is at: 128 KHz

b. in case of IR transmission, frequency is at: 114 KHz / 76 KHz
Encodes the signals, via a bit format (page 6).

Parts I can't figure out are:

According to bit format (page 6), there are two frequencies. In case of RF transmission, which is/are the frequency/ies of the encoded signal?
In case of IR transmission when oscillator generates 114 KHz or 76 KHz? It has to do with electronic components around oscillator?


texts: Help on writing test bench for up counter in verilog

texts:
preamble: I think I have enough understanding of logic circuits and enough experience in programming from other languages(C, python, etc.)

However, I am very new at Verilog and also have never used VHDL or any other HDL.

I want to design an 8 bit up counter which will count up when CLK pulse hits(rising edge).

My understanding on the design and simulation of such a circuit in Verilog is as follows,

First I should design a module which will be my box with inputs and outputs to do the desired job. Then I somehow have to simulate it using a testbench module(I am not sure about this).

So, I designed a module.

Here is my code:

module up_counter(

count,
clk,

);

input clk;
output [7:0] count;
reg [7:0] count;

always @(posedge clk) begin

  count = count + 1;

end

endmodule

module up_counter_tb;

  reg clk;

  wire [7:0] count;
// I really don't understand why making this a wire instead of a reg, but I saw as wire everywhere.

  up_counter uut(

  .clk (clk),
  .count (count)

  );

  initial begin
    clk = 0;
  end

  always begin
    #10 clk = ~clk;
  end

endmodule

The code above compiles fine, and I run the simulation in Modelsim by,

vsim up_counter_tb

Simulation comes, I pass clk and count to waveform displayer, I run the simulation, clk seems fine, it roams between 1 and 0 nicely. However, I cannot observe any change in count. Its value is alway xxxxxxxx.

To me, my code seems correct. I assume, I am using a data type or a flow mechanic very specific to Verilog(or a HDL) in a wrong way.

Any help on pointing the mistake here would be appreciated.

Thanks.


texts:
I am stumped on how this circuit works. I am quite new to electronics but I know the basics of capacitors, transistors, ohm's law .etc, but I have no clue why when the switch(S1) is switched on the LED(D1) goes out for a short while then lights back up again.

I have made this circuit myself with a breadboard and when I increase the size of the capacitor the LED takes longer to come back on, which makes me wonder why the capacitors aren't filling when the switch (S1) isn't set to on.

I appreciate any help with this, but could you please keep in mind when you answer this that I am still very new to this. Thanks


texts: Why doesn't all current flow to ground but instead splits into 2 paths (as shown in the schematic)?

texts:
I've learnt that "current will flow through the path of least resistance," but in this case, current is split between to 2 paths. Why don't all the current sources flow to ground?

if I applied KCL at node a it will be:

-4 - 2 + I_g + I_r = 0
-> I_g + I_r = 6
So why I_g = 4 and I_r = 2 in this case?


texts:
I just made my first attempt at making a Bluetooth Stereo PCB, and it was okay. This is a Class D Audio Amplifier, with the main IC being the TPA3122D2. O was planning on powering it through USB C, with a Op Amp Circuit that would disable the speaker if it received an input voltage of under 12V. But I had to settle for a 12V wall adapter since the USB C 12V input was creating issues with how the speaker operates. The one big issue is that there is a low frequency static sound on the speakers that is present, even when there is music is playing (hard to hear, but it's there). This isn't related to the Bluetooth module since it's still present without it. What are ways that I can improve my design in order to eliminate this?
Schematic

Top Layer

Inner Layer 1

Inner Layer 2

Bottom Layer


texts: How to calculate Gate Delays in normal Adders and Carry Look Ahead Adders

texts:
In my textbook the gate delays for the n-bit ripple adder is given as \$ 2n \$ for \$c_n\$ bits and \$ 2n-1 \$ for \$ s_n-1 \$ for the circuit as shown below:

But, for a 4-bit Carry Look Ahead Adder have 3 gate delays for all carry bits and 4 gate delays for all sum bits, while it is stated as 7 and 8 in case of ripple adders. How, was this calculated? The image of 4 bit carry look ahead adder is shown below:

Note: I represented carry bit as \$c_i\$ and sum bit as \$ s_i \$


texts: Unsure of PWM frequency for HobbyWing Platinum-60A Brushless ESC

texts:
I want to program this ESC HobbyWing Platinum-60A Brushless ESC (Manual)

I want to first try it using Arduino's Servo Library and then using STM32F4.
From its manual:

It says that it requires PWM of 12KHz or 8 KHz. Are these the correct values? I'm unsure because most tutorial on how to program an ESC uses 50Hz-400Hz.


texts:
I'm trying to build a battery backup system for a door lock. I'm using the LTC4353 voltage monitor and switch that switches between the battery and a regulated DC supply depending on the AC mains availability.

Now I also need to charge the Li-Po pack and I was hoping someone could suggest me a suitable IC for this? The battery backup is 4, 18650 batteries in series (with a total voltage of 14.8 volts and current of about 2200mAh). I did a bit of research and found so many that I'm totally confused. The main criteria for the charger are,

Should be able to stop charging after they are fully charged
Should be capable of a trickle charge
Low cost and low part count
High charge efficiency


texts:
I am trying to understand SMD components. Came accross ICs and seems like quite hard to hunderstand. Is there any general rule? Could someone help me to identify the ICs in the pics. One is marked as
"1H1H 788 A5DS" and the second is "DZAA XVFH". I searched those names, but couldn't find anything.


texts: Very low frequency Passive High Pass filter. Capacitor type

texts: I want to design a passive high pass filter to remove a voltage offset with a cut-off frequency of 0.1Hz. A simple RC filter would include the values of R = 159k and C = 10uF. I want to avoid using a very big resistor, and this leaves me with the provlem of a large capacitor. I want to avoid an electrolytic one, and this leaves me with the option of using the large Film capacitors that occupy a lot of space on my PCB. The question now is: What about the Tantalum capacitors? or the Niobium oxide ones? The signal is actually from a heartbeat sensor that measures the transparency of the blood at the fingertip. I want to have the voltage offset removed. Other ideas are also welcome. Below you can see the signal from the heartbeat sensor


texts:
I would like to ask how much is the maximum efficiency of a High-Frequency Transformer (In my application  P=10 kW, f=25kHz ), considering the winding resistance, the core losses as well as the magnetizing inductance.

I saw a research about a 1 MW High-Frequency Transformer working at 50 kHz with maximum efficiency 99.6% and I was wondering if this efficiency is realistic.

Based on your experience is it possible to have 99.6% efficiency in my application? If not how much is the maximum efficiency that I can expect?

P.S. I know that there are a lot of factors that affect the performance of the transformer, for example, the material of the core, but at this point, I just need to know theoretically the maximum efficiency that I can succeed.


texts: How to test the quality of a current source design

texts:
I have designed a temperature independent and voltage supply independent current source based on the beta-multiplier circuit. So far I have only simulated with temperature change and transient analysis.

My question is: what should I take in consideration to rate how "well" my design works? And how do I conduct these analysis? So far I have only have simulate with temperature change and transient analysis.


texts:
I'm using an EEPROM chip from microchip, it's doc gives the read/write timing as below:

I'm a little confused. From FIGURE 1-2, I think it will read data in at the rising edge of SCK. But from FIGURE 1-3, it only gives a "holding" time (t13) from the falling edge, and the minimum value of \$t_{10}\$ is 50ns, the maximum value of \$t_{13}\$ is 50ns, so it's not safe for master to read data in at rising edge. So I think the the master should better read the data in at the falling edge!! Then this will in conflict with the read timing.


texts: What connector do Somfy Li-Ion electric blind chargers use?

texts:
I would like to make an extension cable for my Somfy Electric Blinds (with integrated Li-Ion battery). The connectors on the blind and charger are pictured below, with a logo I don't recognise on the charger plug. What connectors are these?
Pitch is 2.54mm.


texts: NFC communication - CR95HF over 15693 and 14443-A

texts:
CR95HF datasheet: https://www.st.com/resource/en/datasheet/cr95hf.pdf
Demo board: https://docs.rs-online.com/562c/0900766b811c6bc2.pdf
C/C++ library and guide for demo board: https://www.st.com/resource/en/application_note/dm00134778-cr95hf-c-library-for-linux-user-stmicroelectronics.pdf
Currently writing a python API for the CR95HF - using a demo nfc reader and tag, but have had trouble understanding NFC and the datasheet very well. CR95HF has a C++ library and guide for a Linux user, although I found the read_block and write_block function to not work. More or less worked out how to read and write to the CR95HF via SendReceive commands working backwards from the provided STM demo software, and implemented rudimentary tag hunting. I am uncertain of what the ARC_B register is, what to use idle and initiate functions for etc. At the moment I can select a protocol, read and write basic decimal values (because I am still wrapping my head around NDEF format) and tag hunt. If someone could please point me to resources to better understanding NFC that would be great!
Secondly, the demo package using the CR95HF says it supports ISO15693 and ISO18000-3 mode, but the CR95HF supports 14443-A as well. When using the demo software it can tag hunt and find the 14443-A tag, but not read or write to it... Has this got something to do with the antennae or compatibility of the board?


texts:
I would like to understand how to calculate the ripple voltage of an LDO.

Suppose I don't have an electrolytic capacitor.
I have a 3.3V output loaded with 50mA max with a ceramic output capacitor of 10uF. How to find the LDO output ripple voltage?
If I have an electrolytic capacitor, I will multiply the ESR of the electrolytic capacitor with my maximum load current. Is that correct?


texts: Why would an IC have a minimum power supply rise time?

texts: The InvenSense MPU-9250 datasheet specifies not only a maximum VDD rise time (100 ms), but also a minimum rise time (0.1 ms). It seems like the more common concern in power supplies is reducing the rise time. Why wouldn't a faster rise time be better? What kinds of problems would the minimum limit be trying to prevent?


texts:
I am interfacing LPC1768 SPI bus and SST25VF016B SPI Serial Flash. Flash is 50Mhz, and these are the values I copied from SPI Flash Datasheet. page 24.

FCLK (Serial Clock Frequency)  50 MHz

TSCKH (Serial Clock High Time)  9 ns

TSCKL (Serial Clock Low Time)  9 ns

TSCKR (Serial Clock Rise Time (Slew Rate))  0.1 V/ns

TSCKF (Serial Clock Fall Time (Slew Rate))  0.1  V/ns

There is also figure 26 on page 28 in the same data sheet, shows AC Test input rise/fall times are less than 5ns.

Why Clock Slew rate is so low(0.1 V/ns)? Doesn't it make clock rise and fall times very long?


texts:
I moved my Arduino-logic-level-5V-to-12V-LED strip circuit off project board and onto Veroboard and I'm very proud to say everything worked first time:

(I'm not at all proud of the soldering job, so you don't get to see that.)

So this is the point where you all tell me I can replace the whole shebang with a $0.65 IC. The LED strips pull a few hundred mA per channel and I want to drive them off the Arduino's PWM pins. I've found the ULN2803A, but that's 8 Darlington Pair array in a DIP18 package, I want a 3 or 4 Darlington Pair array in a DIP8 or thereabouts. This question might actually contain the answer I'm looking for, but I don't know enough to even work that out.

Secondary question: how do you even know things like the ULN2803A exist? I happened upon it randomly and from there I worked out that "transistor array" was the search term I wanted. But aside from simply hanging around here, how does one answer the question, "What IC can I buy that will replace this portion of this circuit?"


texts: Controlling a 555 squarewave oscillator synthesizer with CV sequencer

texts:
Something of a novice here (I have experience building signal processors/guitar effects from scratch but little else) and I've been meddling with the circuit below.

It works, although I only have the one capacitor wired in between pins 1 and 2. What I would really like to do now is run use this with a CV/Gate sequencer - specifically, the Korg SQ-1 which I own.

Korg SQ-1: http://www.korg.com/us/products/dj/sq_1/

I'm not sure where to start with this. The sequencer has two cables coming out - one for CV and one for GATE (duty cycle). I'm guessing as this is generating the control voltage, I'll be disconnecting the circuit's +9v from the part of the circuit whcih determines the pitch, without powering the circuit down, but am unsure if I even need to do this, or if the control voltage from the korg is enough to power the circuit. I'm also totally stuck as where the gate input would go.

I'm guessing that I'll need to wire two sockets in somewhere but I just don't know where. Can anyone help? I'm not fussed about it playing the exact right pitch (you can change the scale of cv-to-pitch on the sequencer) as there is a pot you can adjust, and I can figure out which capacitor I need afterwards.

Thanks in advance!


texts: So I build a binary clock with led's as outputs. And now it has been suggest to me, that I should make it bigger and use lightbulbs instead of led's. At first I thought I would just use relays, but then I remember they have a limited number of times they can switch.  Is there any other element I could use (transistor,...) that would work the same and what would be adjoining circuit.


texts: Scanning/photocopying vs. photographing the material

texts:
Why do scanners and photocopies scan the material?

Couldn't they just have a digital camera + light behind the glass?

A lens with fixed focus would suffice, since the sheet of paper would always be at the same distance.

There would be no moving parts. Wouldn't than reduce costs? Would such a device be more robust?

I fail to see whether the quality of the produced image would be worse.


texts: MOSFET started to smoke when switching a 12V bulb - how can I troubleshoot the cause?

texts:
This is the case: 12V bench power supply (current limited to 3A) wired to a 30W LED bulb (H7 bulb for vehicles), controlled by an Arduino via the gate of the 2SK1363.
The signal from the Arduino was sent to the gate by a pushbutton, it was a simple sequence of flashing the LED on and off quickly, 20 times in a 2 seconds or so. Also, the default initial state of the LED was controlled by the code as well, with digitalWrite high or low.  This would put the bulb in a "solid state", on or off, and then the pushbutton would initiate fast flashing for 2 seconds.
I used INPUT_PULLUP on the pushbutton pin and everything worked fine but the MOSFET got very hot, and after running the pushbutton flashing on the LED for couple of times in a row, it started to smoke.
I'm a newbie and the only rating I asked for when buying this mosfet was "N-type" and "gate threshold 5V" because of the Arduino.
I later discovered that my particular MOSFET has an Rds rating of 1.4 ohm. When working with my 2.5A bulb it rounds up to 9W, but on the spec sheet I see that "Maximum Power Dissipation" (Pd) is 90 W.
Can someone enlighten me and point me in the correct direction for me to learn proper way of working with MOSFETs? Why did my MOSFET smoke? How can I pick a proper one for my application? What things should I consider?


texts: I have almost finished my PCB design and preparing to make Gerber files. I have some doubts related to Gerber Setup Options of Altium Designer 16.1.My first quesiton about Files->Fabrication Ouputs->Gerber Files->Drill Drawings menu. I have selected both "Plot all used drill pairs" options. Is it an important selection? The second question is in Advanced menu. I have selected both "Keep leading and trailing zeros" and "Reference to absolute origin" selections. I have read the Altium's online document related to these topics however i could not understand completely. I am sharing the images what i mentioned. My board has two layers, both smd and thorugh hole components, and 60mm x 100mm sizes. For the other Gerber Setup options, i have clicked"mm","4:3", "Embedded Apertures (RS274X)" also. Thank you so much.


texts:
I found this illustration from the SparkFun website on how a capacitor charges and discharges, but I have some difficulties with it (and capacitors in general):

What initially causes the capacitor to accumulate a charge difference?  I would expect the current to see this as an open circuit, given that no current flows through the dielectric to ground, and therefore there would be no initial flow.
When we discuss a build-up of positive charge on one of the plates, we are saying the valence electrons have been repelled by the negative charge of the the other plate.  Maybe this is a chicken/egg situation, but shouldn't the electrons on the negative side of the plate be repelled by the same force (even more since it's closer) as the positive side, inhibiting the charge buildup from occuring in the first place?
In the picture below, won't the discharge reverse the direction of current?  That is, it's going to flow from the negatively charged plate, across the LED, resistor, gate, and then to the positively charged plate?
When the capacitor discharges, the current seems to want to flow to redistribute/equalize charge across the circuit. This is different than just flowing to ground (or the positive terminal on the battery), as I am used to seeing.  If when the gate closed to allow discharge there was also a path to the positive terminal on the battery, would this change anything?


texts: Current distribution for parallel zeners

texts:
Suppose you've got two 5V1 zeners in parallel. Due to slight differences between the two parts (tolerance on zener voltage), one of them will conduct more current.

simulate this circuit – Schematic created using CircuitLab

The one consuming most current will heat up more. This will probably affect its properties. What kind of equilibrium will be reached? Will the current distribute evenly between them?

I couldn't estimate myself what equilibrium would be reached because...

I got confused by the temperature coefficients. Some zeners tend towards negative, other towards positive temperature coefficients.
Negative temperature coefficients would be the worst-case scenario: the zener voltage would drop when the part heats up, drawing even more current. Nevertheless, while drawing more current the voltage over the diode will increase a little because the zener I-V-Curve is not ideal. This would push some current to the other zener(s) mounted in parallel. But would that be enough to overcome the detrimental effects of a negative temperature coefficient?


texts: What is the difference between an I/MM, E/MM and H/MM package?

texts:
I'm looking into the PIC18F25K80 as a new microcontroller for my company, but ran into an issue with supplier quantities. The PIC18F25K80-I/MM-ND that I originally selected seems to be very hard to find. On both Digikey and Mouser, quantities are limited and lead times are long. But I noticed that Mouser has a large quantity of the PIC18F25K80-E/MM-ND.

When I do a comparison of these 3 microcontrollers, I get almost no difference, and maybe none at all. Mouser says the H/MM has slightly more RAM, while Digikey says the H/MM has a narrower voltage range.

Here is the comparison link on Digikey's site.

What is the actual difference between these 3? They are all 28QFN, are all based on the 18F25K80 chip, but have different pricing and different availability.

And which one is the "main" chip? I'm trying to replace the PIC18F2580 in a large number of our products, but am worried about availability on the 18F25K80 and just want to get a standard 28QFN IC.


texts: Can't find the correct voltage and current source

texts:
I'm trying to self-study this problem but I got stuck.

What I tried to do:

The equivalent resistor R1 for the 12 and 4 ohm resistors is 3 (12x4/12+4).
The equivalent resistor R2 for the 4 and 12 ohm resistors is 3 (4x12/4+12).

R1 and R2 would be in series now and their equivalent resistor would be 6 Ohms (3+3).

The Is would be 10A (I'm not really sure). Vs would be then 6 x 10 = 60 V. I couldn't figure out why my Is calculation is wrong and why the correct answer is 20A.


texts:
I'm trying to wrap my head round Skin Depth, we've derived the wave equation from Maxwell's equations, using the conditions that it's a "good conductor" ρ = 0, σ >> ωε and therefore you get that the current density decreases exponentially from its value at the surface.

I'm happy that it pops out the maths however it's an intuitive sense I'm after, given that we've used Maxwell's equations I've sure it'll have something to do with self inductance and I think I've sort of got something with current "strands" being induced in the opposite direction (lenz's law) etc, and then thinking about the force between two strands of current flowing in the opposite direction (they'll repel) but then I've got current flowing two different ways on the surface of my wire and now I'm confused.

Any help would be greatly appreciated, I've looked round quite a lot but if anyone has an explanation or can link me one that isn't a mathematic proof that'd be super


texts: Characterizing a magnetic levitiation system

texts:
I've been banging my head on this project for a while and need some guidance. It is a magnetic levitation device that is used in control theory class. I've never taken the class so have been trying to learn it through online courses and books. I think I get some of the basics but not enough to figure this out.

The way the system is supposed to work is that an electromagnet pulses its output to keep an object (permanent-magnet in my case) levitated.

Brief description of the system:
There is an electromagnet that is being controlled by a PWM signal from an Arduino. The Arduino knows, or is supposed to know, what duty cycle to provide based on the the current through the electromagnet and the hall effect sensor.

As the object gets closer to the hall sensor the value of the hall sensor increases. The whammy here is that as the current, which is controlled by the PWM, through the electromagnet changes the hall sensor reacts to this as well. To get rid of this effect, we measure the current through the electromagnet convert it to a "hall value" and subtract it out to normalize the hall sensor reading. This in effect gives a pure reading of the object's distance relative to the hall sensor.

Schematic

Now my issues is how to characterize and tune the system.

One of the techniques to characterize the system is to provide an impulse or a step and measure the response of the system. I tried using a step response, which is essentially providing power to the electromagnet. Now the question is how do I measure the response. If I give full power to the electromagnet the permanent magnet shoots up and gets stuck. I have an overshoot situation. If I provide less power nothing really happens. I am stuck in a binary situation: the permanent magnet either doesn't move or shoots up and gets stuck.

How can I characterize this system with this limitation?

I've also tried just using a PID controller and doing some guessing for tuning it, but kept getting to that same issues.

Thanks,


texts:
Im working on a non safety project and as part of the Initialization tests I wanted to check the internal memory of LPC1778 for proper functionality before beginning the application.

I dont intend to test all the addresses as its not feasible for the application.
Im planning on implementing this 3 in 1(ALU,RAM and ROM) test the following way:

1.Store an array of 32 numbers in ROM(const array) whose member values are powers of 2. Example-> 1,2,4,8...upto 2 power 32(since LPC1778 has a 32 bit data bus)

2.Read these values from ROM(const array) and write them into an array of size 32 located in RAM(non-const array allocated on stack by calling a function that declares such an array locally).

3.Compare each value in the local array to a value calculated by the ALU(left shifting bit by bit).

Is this sufficient to test or must I also check for short of address bus(if they are shorted and i try to write to an invalid location wont the exception handler be triggered?)
Also, must i also check for other operations by the ALU like addition,subtraction,NOT,XOR etc..
I also have the Code Checksum stored in a external flash that will be compared against by calculating it in the code during runtime.
(Checksum calculated in code==Checksum read from flash)

Any suggestions. Please help.

Im using Keil IDE.


texts:
I was working with the Arduino IDE. I tried to find out from where a MCU can be locked so that nobody can make a clone from it.
I found many answers describing something about lock bit.
I realized that this lock bit can somehow stop users from cloning the chip.
My first question is with which IDE or programmer I can change the lock bit?
Second question : Can it be edited with a hex editor? If it is possible, what is the position/which number of bit should be changed?
Third question: Is there any way to encrypt the code?


texts: Output Voltage Minimum Limit of LM358 as Error Amplifer

texts:
I am using one side of the LM358 as an error amplifier with a gain of 1, biased according to this MIT lesson for differential amplifiers.

The results below show me tuning the reference signal to see if I get the desired output error. My error = SENSE + OFFSET - REF. It appears to saturate at an output voltage (the error signal) of 500mV.

Why is this? I've checked the datasheet I have for the LM358 but cannot seem to make sense of the operating limitations, since this shows the output voltage conditions with a load attached (I am operating with no load):

What am I missing? Where on the datasheet can I find information about the minimum output voltage?

My supply is +5V to GND, so I expected the output to reach zero and stay there when my calculated error reached the negative zone.


texts: How to make a cw transmitter with a crystal oscillator (A0645147)?

texts: I am trying to make a very basic cw transmitter, so far i got a 5V crystal  oscillator: A0645147. Whenever I apply voltage to it i can pick up the signal on   my handheld however i am not hearing the beep that is associated with the cw   morse code. Can anyone suggest what i am doing wrong ?


texts:
My bike light uses two CR2032 batteries, which I replaced with CR2025 and some padding. It stopped giving light, so I removed the batteries and measured voltage. One battery gave 2.8 V, and another -1 V. I checked with new batteries that the polarity was right and confirm that the battery had negative voltage. I replaced with a new CR2025 and the previous positive battery and the light worked again.

The light was working before, so the "negative" battery had to be around 1.5V, and I did not notice it being backward inside the light when I removed it.

How can a battery reverse its voltage like this?


texts: ULN2803 not working properly in Proteous?

texts:
I'm trying to test ULN2803 with Led MATRIX.
But with different Logic it is giving no change on the output and making the LED lit up.
Why is this so


texts: State of mutli-cycle processor during execution of instruction

texts: I was reading something about single-cycle and multi-cycle processors and I have (it seems to be) banal question: how does multi-cycle (that doesn't have pararell pipeline) processor save its state so next instruction isn't executed until currently executed one isn't done? Is it blocking start of first phase somehow?


texts: Is there a passive component able to stabilize current (as zeners can do with voltage)?

texts:
So I need a component which will have a flat сurrent–voltage characteristic (constant current in a wide voltage range).

Initially I was intended to ask a general question: what kind of the device can do this function. However some of commentators wished more details so I'm putting them into the question:

For the moment I need that the device can be supplied with voltage as low as 1V (I wish it could be even lower) and drive current in scale of tens of microAmsp. The precision of the current should be something within 10% in range of voltage between 1 and 10V and in typical industrial temperature range.


texts: How Exactly Does a Push-pull Pair Cancel Even Harmonics?

texts:
I've been studying cassette tape circuits recently and the same bias oscillator circuit keeps cropping up time and again.
This one from a copy of Practical Electronics (circa 1960):

...and this one from an Aiwa cassette player circuit from the 80's:

As far as I can make out, it's favoured because it has low harmonic distortion and this, it seems, is down to it's push-pull configuration.

It's often said that a push-pull pair cancels even harmonics, but I'm interested to know exactly how this happens.  I considered it's because of its symmetrical configuration and the non-linearity of one active device cancels the other, but in the simple push-pull case aren't one the devices off.  So, how does the cancelling happen?


texts: Will this structure emit EM waves when excited by out-of-plane time varying magnetic field?

texts: Say I create a structure from copper that looks like the figure shown below. It's an open circle whose ends terminate in protruding wires of length x. If I excite this with an out-of plane time varying magnetic field B (say B0*cosft), will the protruding wires emit EM waves? If yes, will the emitted radiation have a frequency of f? And will x affect the power of the emitted radiation? Any brief explanation will be helpful..


texts: Issues in developing on OSK5912 (OMAP Processor)

texts:
I want to develop applications using OSK5912 - an OMAP DSP Kit. The problem is that the TI no longer provides development tools for the same as it is quite an old kit.

For developing apps on Linux, it uses Montavista Linux Pro ver 3.1, and I am not able to install it as Montavista has removed support for ver 3.1. Any idea how I can solve this problem?

Thanks.


texts: Persistent circular buffer with CC3220SF

texts:
I'd like to share with you some thoughts about a project to see if there are better solutions than mine...

I'm designing a board based upon CC3220SF, that requires an external flash (16 Mbit) where it stores system's and user's files.

My application MUST have a persistent circular buffer of 512/1024 kbytes. This is because the board acquires some sensors periodically and send them to the cloud. But if the connection is not available it MUST save the data for later uploading.

Some ideas:

use the internal RAM: reducing a bit the requirements about the buffer size, the space is enough but it seems it isn't reliable across resets (please note my system is battery powered: if the battery dies it's acceptable to loose the last records - if any)
use the external flash: there is plenty of space, but it seems there it's not possible to "overwrite" a file changing only the bytes involved: any write operation leads to a complete rewrite of the whole file. This limits the expected life of about 100,000 records. No way.
add an external S/F/D/NV-RAM: after some searches I found DRAMs are very cheap but require a parallel bus. The other types are quite expensive for that capacity.
ok, the last idea that comes to my mind is to add a second flash memory. Now I can write to it directly (without any file-system) but I have to select one that not requires a full page write.

Some other information:

the expected life of the battery should allow to acquire more than 130,000 records
of course after replacing the battery the board must be still functional...
due to the expected environment, it is very likely that the board might acquire hundreds of records every day WITHOUT an available connection. Then it will upload them at once during the night.

Any suggestions would be appreciated.


texts: Measuring Noise Contribution of Amplifier in Antenna Amplifier System

texts:
I have a very simple setup that looks like the following:

It is simply an antenna connected in series to an amplifier. The output of this setup goes to a spectrum analyzer where I measure some power (in some bandwidth). I am trying to figure out the contribution of the amplifier itself to the total noise I measure, and I think I am working myself down a rabbit hole.
My attempt right now, looks as follows:

In it, I am modeling both the antenna and the amplifier by some (frequency dependent) impedance. I am interested in the total power across the amplifier (P\$_{amp}\$). This seems like a current divider in which case I have that the proportion of the total noise (P\$_{noise}\$) is given by:
\$\frac{P_{amp}}{P_{noise}}\$ = \$\frac{Z_{antenna}}{Z_{amp} + Z_{antenna}}\$.
Intuitively, at least, this makes sense in the limit of there being no antenna (large Z\$_{antenna}\$).
I then go one step further and say that the antenna is not a perfect radiator. It has some reflection loss \$\Gamma\$. Using this, the total power dropped across the amplifier is:
\$P_{amp}=\frac{Z_{antenna}}{Z_{amp} + Z_{antenna}}P_{noise} + \left(1 - \frac{Z_{antenna}}{Z_{amp} + Z_{antenna}}\right)\Gamma P_{noise}\$
Simplifying
\$P_{amp} = \left(\frac{Z_{antenna} + \Gamma Z_{amp}}{Z_{amp} + Z_{antenna}}\right)P_{noise}\$
From this, I have a few questions:

Is my equivalent circuit bogus? I have in my head that the antenna should be in parallel with  the amplifier, but this well may be wrong.

Given the equivalent circuit, have I forgotten to account for something in the succeeding analysis?

Are there any resources that you could refer me to (or maybe some keywords) to investigate further (e.g. for drawing the equivalent circuit or understanding amplifier noise in a system like this)? I know this is pretty basic, but I've been unsuccessful finding much.

Thanks.


texts: How Does One Go On Charging Ni-Cd Battery's

texts:
Its a simple question but I can't seem to find any info on it. I have two Ni-Cd batteries (listed bellow) so i want to know how to charge them? And how to know if they are completely dead or are still alive. Each battery has 3 cells with the same type of package style as shown in the images.

Rating 3.6V 300mAh - Reading Voltage = 0.3V
Rating 3.6V 600mAh - Reading Voltage = 0V


texts: Will plastic influence a magnetic field?

texts:
First of all sorry for my English.
If, for example I will "create" magnet by passing current through a coil.
And than I will "wrap" this piece with plastic or some other material, will the "magnet power" (not really power..) And by "magnet lower" I mean the magnetic field will be influenced and will have "problem going throug" the plastic or other material piece?

Thanks!


texts: LED Fault in PCB - Some strings of LEDs intermittently dim

texts:
I have a university project that involves working with surface mount LEDs.

For some reason, some of the rows of LEDs, when lit up, are dimmer than they should be. This problem is only intermittent however, and sometimes when the boards are switched off and then back on, they light up fine. This is the issue I need to resolve.

The circuit is 24V constant voltage, made up of several parallel strings of LEDs. Each LED string has 4 resistors and 2 transistors to control current flow.

The PCB they are mounted on has been scored, so that the circuit can be broken into smaller sections if need be. My first thought was that when the boards are snapped along the score line, the copper tracks are damaged, but the LEDs are only dysfunctional on an intermittent basis.

Sometimes, when the LEDs are dimmed, pressing down on the board causes them to light up properly.

I know its a lot of information but if anyone has any idea as to what the problem is, it would be very much appreciated.


texts:
I find I need a comparator, because I have a problem with an optical sensor triggering multiple interrupts, like this question:

https://arduino.stackexchange.com/questions/13287/interrupt-fires-multiple-times

However, as the market for electronics have changed, there is no shop just around the corner, only over 100km away, and I'm impatient; I'm looking in my drawers, and found 2 types of opamps: a XR082 and a MC34002

These have a voltage input of +/- 15V. Would they work as a comparator if I only feed them the Arduino voltage of 3.3V, only positive, no negative, i.e. only a tenth of the maximum voltage?

I didn't think this ought to give any problems, and that the ESP8266 would have a hysteresis in the input, but appearently this is not the case
Or my cheap pocket scope can't handle this.

This is measured directly on the input pin of the ESP8266

I'm using this circuit (Never mind if the diode is drawn the wrong way); using the internal pullup in the ESP8266.


texts: I am interested in learning VHDL and Verilog. I was wondering if there is any free IDE for those?


texts:
I'm testing some CD40106BE from Texas Instrument, CMOS Hex Schmitt Trigger (Datasheet Here).

Vdd = 5V (Pin14)
Vss = GND  (Pin7)
Vin = 5V

I measured a Vout = 3.8V on every IC I tested, with a Led on each output, is that normal?
Watching Fig.9 I should have Vout=5V, isn't it?


texts: Is it always OK to directly connect grounds of different voltage sources?

texts:
In my specific case, I have an arduino and a servo motor.

Arduino is powered from PC via USB (5V).
Servo is powered from a separate AC-DC adapter because it needs more current.

In order to control the servo from Arduino, they must have common 0V, so grounds have to be connected. That part is clear.

My question is should I worry about current going through this ground-to-ground connection? In other words, can I consider those two voltage sources to be completely decoupled or is there a situation in which a voltage will be maintained between them by some external source?

Would it be a good idea or an extremely bad idea to place a resistor between the two grounds?


texts: Confusion with a simple assembly code for AVR

texts:
Im using ATmega328P with Atmel Studio.
I have a problem understanding the register manipulation in this code:

#include <avr/io.h>

int main(void)
{
    DDRB =  0b00000111;
    PORTB = 0b00000111;

    while (1)
    {
        PORTB = 0b00000000;
        PORTB = 0b00000111;
    }
}

And here is its assembly:

     5: {
     6:     DDRB =  0b00000111;
00000040 87.e0                LDI R24,0x07      Load immediate
00000041 84.b9                OUT 0x04,R24      Out to I/O location
     7:     PORTB = 0b00000111;
00000042 85.b9                OUT 0x05,R24      Out to I/O location
    12:         PORTB = 0b00000000;
00000043 15.b8                OUT 0x05,R1       Out to I/O location
00000044 fd.cf                RJMP PC-0x0002        Relative jump

And here is the view of I/O registers for PORTB for the last execution:

My question is:

If we go step by step, here 00000111 is moved to R24 cpu register and it is moved DDRB register which is at the address 0x04:

        DDRB =  0b00000111;
00000040 87.e0                LDI R24,0x07      Load immediate
00000041 84.b9                OUT 0x04,R24      Out to I/O location

Here the same bit pattern at R24 is applied to the register PORTB

     PORTB = 0b00000111;
00000042 85.b9                OUT 0x05,R24      Out to I/O location

But what is happeing in the last two lines here:

00000043 15.b8                OUT 0x05,R1       Out to I/O location
00000044 fd.cf                RJMP PC-0x0002        Relative jump

First of all what is R1 which is not declared? And my code has nothing to do with PINB register but how come the PINB's PINB0, PINB1 and PINB2 becomes 1 here? Last two lines are:


texts:
I've recently been attending a solar-engineering module at university, however, I'm not on an engineering course so this module is completely new to me.
This was shown on a lecture slide, however, the lecturer did not go into depth behind the characteristics of this circuit. Could someone with experience provide an evaluation of this image?

I've recently also started LTspice and cannot find a load like the one in the image, how would this be found or must it be created?


texts: Voltage regulator or reference for a Wheatstone bridge excitation voltage?

texts:
I will have a circuit which will be amplifying a Wheatstone-bridge(strain gage) signals by an instrumentation amplifier.
I read that the noise of a Wheatstone-bridge(strain gage) has very much to do with its excitation voltage.

So the question is I was planning to use a voltage regulator for the whole circuit.
But should I use a voltage reference for stability and less noise instead for the section which is used for the excitation voltage of the bridge? If I use voltage reference for the whole circuit I'm afraid current might be an issue. So anyone has experience with this?


texts: How do I measure a negative voltage with a ADC?

texts:
I am working with a PIC micro-controller with inbuilt 10bit ADC and want to measure a voltage in the range of -1 to -3Volts.
I thought of using an op-amp in the inverting mode to make voltage positive and then feed it to the adc of the microcontroller however here I would have to power the opamp with a negative power supply, right?.
I don't want to use a negative power supply at the moment and was wondering whether it was possible to achieve this configuration?
Can you'll help out?


texts: Two-port network: find fundamental parameters

texts:
What is the easiest method to find the ABCD parameters?

I tried replacing the middle part of the circuit (R2,L,C) with an equivalent impedance and then finding U2 depending on U1, but it is very time-consuming. Is there a better way?

Maybe considering this circuit as a cascade connection of three two-port networks (R1 ; L,R2,C ; R3)?


texts: Total resistance across a capacitor in series

texts: Why is the total resistance across the capacitor \$R_{\text{sig}} + R_{\text{G}}\$? Why is it not just \$R_{\text{G}}\$?


texts: Systemverilog interface definition - lint error message

texts:
I'm using Systemverilog interfaces to enable the implementation of generic functions.
The interface is defined in one file as follows:
interface interface_onehot_to_binary

# (parameter WIDTH_ONEHOT=16)
(); // Empty port list

localparam WIDTH_BINARY = $clog2 (WIDTH_ONEHOT) ;
    function logic [WIDTH_BINARY-1:0] onehot_to_binary
    (logic [WIDTH_ONEHOT-1: 0] onehot);
    automatic logic [WIDTH_BINARY-1:0] binary=0;
        foreach (onehot[index])
        begin
            if (onehot[index]==1'b1) begin
                binary=binary|index;
            end
        end
        return binary;
    endfunction

endinterface

And then instantiated in another file as follows:
interface_onehot_to_binary
#(.WIDTH_ONEHOT(256))
inst_interface_onehot_to_binary
(); // Empty port list

The simulation and synthesis tools that I use digest this code without issues.
But the SpyGlass linter fails with the following error message:
interface 'interface_onehot_to_binary' declaration does not have a modport definition.
The error points to the first file - where the interface is defined.
What's wrong with my code? How can it be solved?


texts: How should I handle meta-values in finite state machine implementations using VHDL?

texts:
I recently added 'X' propagation to my RT-Level VHDL designs, to detect early whenever operations take place on unknown ('X') or uninitialized ('U') values. The latter may come from registers, which I forgot to reset, or from memory which cannot be reset at all. Unknown values may come from logic operations on uninitialized values. I do not care about unknown or uninitialized values as long as they do not lead to undefined behavior, e.g., undefined state changes in a finite state machine (FSM). I do not distinguish between 'X', 'U' or any other meta-value, all are treated as 'X'.

I'm familiar with applying 'X' propagation to data paths, but I struggle to apply it to FSMs because the code is getting much more complex and readability is decreasing. Here is a stripped-down example, how my FSMs with 'X' propagation look like:

library ieee;
use ieee.std_logic_1164.all;

entity fsm is
    port (
        clock  : in std_logic;
        reset  : in std_logic;
        input  : in  std_logic_vector(1 downto 0);
        output : out std_logic); -- mealy output
end entity fsm;

architecture rtl of fsm is
    type states is (RUNNING, WAITING, UNKNOWN);
    signal state : states
        -- synthesis translate_off
        := UNKNOWN
        -- synthesis translate_on
        ;
    signal next_state : states;
begin  -- architecture rtl

    process(state, input)
    begin
        next_state <= state;
        output     <= '0';

        case state is
            when RUNNING =>
                case input(1) and not input(0) is -- some complex condition
                    when '1' => next_state <= WAITING;
                    when '0' => output     <= '1';
                    when others =>
                        next_state <= UNKNOWN;
                        output     <= 'X';
                end case;

            when WAITING =>
                next_state <= RUNNING;

            when UNKNOWN =>
                output <= 'X';
        end case;
    end process;

    process(clock)
    begin
        if rising_edge(clock) then
            case to_x01(reset) is
                when '1' =>    state <= RUNNING;
                when '0' =>    state <= next_state;
                when others => state <= UNKNOWN;
            end case;
        end if;
    end process;
end architecture rtl;

I use case statements to check inputs for some condition, so that, I don't have to repeat the condition as with if statements:

if (input(1) and not input(0)) = '1' then
    next_state <= WAITING;
elsif (input(1) and not input(0)) = '0' then -- repeated condition
    output <= '1';
else
    next_state <= UNKNOWN; output <= 'X';
end if;

I do not find the case statement very readable because without 'X' propagation, the condition would be much more clearer:

if input(1) = '1' and input(0) = '0' then
    next_state <= WAITING;
else
    output <= '1';
end if;

Another problem is to keep track when mealy outputs will be unknown. In the example above output will be unknown when the condition is undetermined.

So my questions are:

Should I propagate 'X' values (to the FSM state and mealy outputs) or should I just report an error?
Is there a more readable code template to test complex conditions as in the example above?
Is there a better method to check wether a correct reset has been applied? (Note: the state should still be unknown until the first rising clock-edge!)

All after all: the code must be synthesizable. (Due to the synthesis guard, the state UNKNOWN will never be reached in real HW and is thus optimized away.)


texts:
Any idea where I can get parts for Roland synthesizers?

I have a Roland Fantom (FA-76, the original without sequencers and what not) and its pitch bender seems to be a bit worn out, or possibly dusty. (As I pitch up/down, sometimes the pitching skips around a bit, especially near center.)  I'd like to get a replacement for the pitch bender, but can't figure out where to order parts.  E-mails to Roland never get replied.

Any thoughts?


texts: choosing a power supply in case of biasing a photo diode

texts:
i am very new to power supply design

i have a photo diode whose peak current is 150mA and bias voltage of 12V, photo diode being reverse biased.

i have a input voltage coming 28V from battery, so i would require a 28V to 12V regulator to bias the photo diode

my doubt is,  what should be maximum output current that can be expected while selecting an LDO or DC-DC(do i need it?)?

as the current is generated by the photo-diode itself even if any high current output is un-necessary i feel, so a normal LDO  like TPS79801-Q1
with Imax being 50mA should fit in my application ?

also i am less familiar about heat that would be generated across the LDO in conversion of 28V to 12V, as the current is very low i dont need to worry that much about power dissipated ?

EDIT: datasheet of photodiode

EDIT2: pulse width 10ns-150ns and PRF of 20us-1S

EDIT3: kindly put your comments at similar question of same problem to know behavior of photo diode in saturation


texts:
I am designing a prototype board in Kicad. I need CONN_3X8 schematic component and footprint module for connecting 8 off-board ESC to my prototype board. I can't find any such connector in Kicad and also creating it will be messy.

Any suggestions?


texts:
I didn't quite get how this circuit from falstad works:
http://www.falstad.com/circuit/e-amp-sum.html

Specifically, how can 2 voltages in parallel add up when negative input (ideally) has infinite resistance?


texts: Isolation between cells for battery charging & testing

texts:
I want to charge Lipo battery packs and possibly other chemistries too.  Six cell packs for starters.  But hope to handle more and less.  Perhaps a lot more cells.  For electric vehicles, skateboards, bikes etc.

I want to isolate cells from one another to be able to handle twenty cells or more.  And to charge those cells individually so balancing is unnecessary.  Possibly charging with Arduino PWM channels.

Is it possible to isolate Arduino PWM outputs inexpensively?  (And inputs?) Charge currents of one amp would be good to start.  Five amps or so would be nice eventually.


texts: I am trying to make understand to working of uln2003 but not able to run this circuit properly please anyone help me to understand why this is not working..


texts: Working house main Control Miniature Circuit Breaker(25A) instead of transfuse (16A)?

texts:
I have two  Miniature Circuit Breaker, so one is  ordinary main Miniature Circuit Breaker(house main MCB) in range of 25A and the other is my device (Auto-Transformer) in range of 16A, So when i run the Device some times first Miniature Circuit Breaker(25A) work and cut the power line, So my question is why not the second Miniature Circuit Breaker working first, dose it's come back to that quality or any  other setting like it's Trip characteristics?

The MCB 25 A:

The MCB's 16A:

Thanks a Lot.


texts: .96 inch TFT with ST7753 and AVR - can't draw individual pixels

texts:
I bought this from aliexpress: https://www.aliexpress.com/item/32859042892.html It seems to be a good display, even a bit higher res, than advertised, however, I'm having trouble doing anything more than just clearing the display. The pixel I set, just before the endless while loop, does not change color. Nor does PixelTest work. What could be wrong here? In addition.. there's this weird magic nr in the clear display function's for that I have no idea, how much it should exactly be...

Here's the code I'm using

spilcd.h

#include "spi.h"

#define DCPORT PORTC
#define DCDDR DDRC
#define DCDDRPIN DDC2
#define DCPIN PINC2

#define RSTPORT PORTC
#define RSTDDR DDRC
#define RSTDDRPIN DDC3
#define RSTPIN PINC3
#define NORON 0x13
#define SWRESET 0x01 // software reset
#define SLPOUT 0x11 // sleep out
#define DISPOFF 0x28 // display off
#define DISPON 0x29 // display on
#define CASET 0x2A // column address set
#define RASET 0x2B // row address set
#define RAMWR 0x2C // RAM write
#define MADCTL 0x36 // axis control
#define COLMOD 0x3A // color mode

// Color constants
#define BLACK 0x0000
#define BLUE 0x001F
#define RED 0xF800
#define GREEN 0x0400
#define LIME 0x07E0
#define CYAN 0x07FF
#define MAGENTA 0xF81F
#define YELLOW 0xFFE0
#define WHITE 0xFFFF

void write_cmd(uint8_t  command) {
    DCPORT &= ~(1 << DCPIN);
    send_recieve_spi_byte(command);
    DCPORT |= (1 << DCPIN);
}

void write_word (uint16_t w)
{
 send_recieve_spi_byte(w >> 8); // write upper 8 bits
 send_recieve_spi_byte(w & 0xFF); // write lower 8 bits
}

void hardware_reset() {
    RSTPORT &= ~(1<< RSTPIN);
    _delay_ms(1);
    RSTPORT |= (1<< RSTPIN);
    _delay_ms(200);
}

void initialize_lcd() {
    DCDDR |= (1 << DCDDRPIN);
    RSTDDR |= (1 << RSTDDRPIN);

    DCPORT |= (1 << DCPIN);
    RSTPORT |= (1<< RSTPIN);

    hardware_reset();

    write_cmd(SLPOUT);
    _delay_ms(150);
    write_cmd(COLMOD);
    write_cmd(0x05);
}

void set_addr_window(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1)
{
    write_cmd(CASET); // set column range (x0,x1)
    write_word(x0);
    write_word(x1);
    write_cmd(RASET); // set row range (y0,y1)
    write_word(y0);
    write_word(y1);
}

void clear_screen()
{
    set_addr_window(0,0,110, 160); // set window to entire display
    write_cmd(RAMWR);
    for (unsigned int i=53800;i>0;--i) // byte count = some magic number
    {
       send_recieve_spi_byte(0);
    }
}

spi.h

uint8_t send_recieve_spi_byte(uint8_t data)
{
    PORTB &= ~(1 << PINB2);
    // Load data into the buffer
    SPDR = data;
    //Wait until transmission complete
    while(!(SPSR & (1<<SPIF) ));
    PORTB |= (1 << PINB2);
    // Return received data
    return(SPDR);
}

void init_spi_oneway() {
    DDRB = (1 << DDB2) | (1 << DDB3) | (1 << DDB5);
    SPCR=(1<<SPE)|(1<<MSTR)|(1<<SPR0);
        PORTB |= (1 << PINB2);
   // SPCR = 0x50;
}

void init_spi_twoway() {
    DDRB &= ~(1 << DDB4);
    init_spi_oneway();
}

main.c

/*
 */

#include <avr/io.h>
#include <util/delay.h>
#include "spilcd.h"
#include <stdint.h>
#include <stdlib.h>
void Write565 (uint16_t data, uint16_t count)
{
 while(count--)
 {
    send_recieve_spi_byte(data >> 8);
    send_recieve_spi_byte(data & 0xFF);
}
}

void DrawPixel (uint8_t x, uint8_t y, uint16_t color)
{
 set_addr_window(x,y,x,y); // set active region = 1 pixel
 write_cmd(RAMWR); // memory write
 Write565(color,1); // send color for this pixel
}

void PixelTest()
// draws 4000 pixels on the screen
{
 for (int i=4000; i>0; i--) // do a whole bunch:
 {
 int x = rand() % 110; // random x coordinate
 int y = rand() % 160; // random y coordinate
 DrawPixel(x,y,RED); // draw pixel at x,y
 }
}

int main() {

    init_spi_oneway();
    initialize_lcd();
    write_cmd(DISPON);
    clear_screen();

    PixelTest();
    while(1) {

    }

    return 0;
}


texts: Transistor in cutoff mode but still allows current to flow

texts:
Hello everyone,
I am a freshman in computer science, and as we are dealing with a lot of hardware, we stumbled upon transistors. We learned that if a transistor is in cutoff mode, it basically acts as a switch that is not closed.
In the picture I provided, we can see that the transistor is in cutoff mode, as the voltage supplied to the base is not enough (it should be around 0.6V). But, if I had an open switch, the voltage between the collector of the NPN transistor and the ground should be 5 Volts. In this case, however, it says 4.881V. I have no idea where the voltage is lost along the way, because as the current does not pass through the transistor, no current should flow through the entire branch, and therefore there should be no loss of source voltage. What am I getting wrong?


texts: Required modifications for water level control

texts:
I have a small doubt about the circuit present in the following page:

http://www.electronicshub.org/water-level-indicator/

The circuit present in the above page helps to just detect and indicate the water level present in the container. But I want to modify that circuit in such a way that after reaching the certain limit it should indicate and as well as it should automatically control the level of water. For that purpose, what are the modifications to be done to that circuit?

And also, Is it possible to use any type of microcontroller for that circuit or any particular microcontroller is required for that project?

Kindly clarify my doubt. Thanks in advance.


texts:
I have a STM32WB55CGU6 where I have all my ADC pins used up and im trying to obtain the battery level using a pin which does not have a ADC (PB6) which is branched as shown in the picture:

This follows the principle where it will charge and discharge  following this link :
link

This is my current program but somehow it doesnt work and im pretty sure im doing something wronf but what I am not too sure.

while(1){
      HAL_GPIO_WritePin(GPIOB, GPIO_PIN_6, GPIO_PIN_SET);
      HAL_Delay(1);
      HAL_GPIO_ReadPin(GPIOB, GPIO_PIN_6);
      while(HAL_GPIO_ReadPin(GPIOB, GPIO_PIN_6)==1){
          time++;
      }
      if (HAL_GPIO_ReadPin(GPIOB, GPIO_PIN_6)==0){value = time;}
}

Im programming with STMCubeIDE where I have set the pin to GPIO_Analog


texts: Hysteresis calculation for "open-collector output comparator" with a pull-up resistor

texts:
Standard comparators such as LM2903 and LM311 have open collector outputs.
I see many times the output of these comparators are tied to Vcc by a pull-up resistor (e.g. in a Schmitt trigger case).
Eventhough there is a question about why it is tied to Vcc here: Why do they usually make comparators open collector?
I still don't understand the reason.

Anyway my question is not that. It is about calculation of hysteresis. Many times for Schmitt trigger hysteresis calculation I was given the following link:
http://www.random-science-tools.com/electronics/inverting-schmitt-trigger-calculator.htm

But this calculator I suppose does not take into account the pull-up resistor.

Imagine using a pull-up resistor to Vcc for a Schmitt trigger in an open-collector output comparator such as:

Would the hysteresis calculation include this pull-up resistor (R3)? Does it have effect on the hysteresis?