text stringlengths 83 79.5k |
|---|
H: Use of Toggle flip-flops and JK flip flops
I was studying digital electronics, especially latches and flip-flops and the like and I came to understand that flip-flops are basically memory storage elements, in that case why would I need configurations to continuously toggle values from 0 to 1, like in the case of J-K flip-flops or T-flip-flops?
AI: E.g. Binary counters, Frequency divider
Some quick samples: http://hyperphysics.phy-astr.gsu.edu/hbase/electronic/tflipflop.html |
H: Using capacitive coupling to implement pulse transition
I was reading about master-slave flip flops, used to implement edge triggering and I read that instead of using master slave configurations, using RC coupling to clock inputs could also enable pulse transition. How is this possible?
AI: Your question is a bit vague — can you provide a specific example?
But in any case, the general concept is that an RC high-pass filter will convert a rising edge into a narrow positive pulse and a falling edge into a negative pulse. The negative pulses can be inverted to create a second set of positive pulses that's offset in time. Essentially, you end up creating a "local" 2-phase pulse-type clock out of the original single-phase square-wave clock.
In older logic technologies (think vacuum tubes), it was possible to "tune" the pulse widths so that data would propagate through just one flip-flop during one pulse duration, so multi-phase clocks were not necessary. However, as systems became larger and more complex, and we moved on to newer technologies (solid state) whose characteristics were less well-controlled, this approach had to be abandoned as unworkable. Multi-phase clocks became common (up through the first generation of IC microprocessors), and eventually, we switched entirely to master-slave flip-flops, which allowed us to migrate to single-phase square-wave clocks, simplifying clock generation and distribution. |
H: Stepper motor resolution
What does "mm/step" exactly mean? Where and how is the distance measured? How can it be converted to °/step?
I have been looking for this, but I haven't found the exact answer.
Here is an example datasheet, where the resolution is in this measure given:
http://www.farnell.com/datasheets/42855.pdf
AI: The datasheet you cite is for a linear actuator, which is the combination of a stepper motor and a leadscrew. In order to convert from linear to angular measure, you would need to know the thread pitch (how far it moves in one rotation) of the leadscrew. |
H: How data movement from large register to small register works in VHDL?
I went through a VHDL sample code for memory management. In that data from a 32 bit register was directly moved into a 8 bit register. My doubt it is how this data movement can happen? Is there is any default condition for VHDL for such data transfer?
AI: The default behavior is to match up the bit indices, so if you have
signal reg32 : bit_vector(31 downto 0);
signal reg8 : bit_vector(7 downto 0);
reg8 <= reg32;
it is equivalanet to
reg8(7 downto 0) <= reg32(7 downto 0);
However, any decent VHDL compiler should give you at least a warning about the width mismatch. |
H: how can i drive a motor with an inverter providing it's power supply?
I'm trying to drive a gyroscope that needs a 3 phase 400Hz 32v 0.7A power supply. i'm going to use an inverter to provide my supply(1phase to 3phase AC: LS-IG5A-0.75kw). i have 2question about it:
1-can i give a perfect sin wave from an inverter output?or it needs special considerations and circuits?
2-can i give a fixed output frequency from an inverter?
thanks
Brochure here.
Manual here.
AI: As Brian Drummond points out, you'd need to use something like a transformer (or transformers if you don't have a 3-phase transformer available) to reduce the mains voltage output of a standard VFD to your aircraft-type requirement.
From a brief scan of the data it seems you can adjust the carrier as high as 15kHz and maybe just set the inverter to use a V*f strategy, so it might well work. The PWM won't make very nice sine waves at the maximum 400Hz output, but it might be good enough. |
H: Should ventless electrolytic capacitors be mounted upside down?
I read in this CDE application guide and this Nichicon application guide that if a screw terminal electrolytic capacitor is installed upside-down, the vent may not function properly and the electrolyte may leak out. Proper orientation is upright, or horizontal with the vent at the top of the capacitor.
Smaller electrolytic capacitors often do not have such a vent, instead having a scored top.
I don't see any reason to expect a problem in this case. Is there any restriction on the mounting orientation of this style of capacitor?
AI: I've spoken to a UCC rep, who gave me a pretty detailed answer.
He said that older wax-based aluminum electrolytics could have safety issues with being mounted upside-down. If the wax warmed up, it could run to the bottom, cover the vent and resolidify. This would effectively prevent the vent from operating, potentially making a bigger boom in a failure condition.
He also said that more modern waxless caps still had potential issues with electrolyte leaking out through the vent. This is especially true if the cap isn't being run with high ripple currents. If the cap is warm, the high temperatures put pressure on the vent, creating a better seal.
Finally, he mentioned that scored PCB-mount caps could still leak electrolyte if mounted upside-down, and that they don't recommend it, but it's not nearly as serious a concern due to the smaller quantity of electrolyte in PCB caps. He didn't say so, but I'd expect that warmer caps would actually leak more electrolyte in this case, unlike the screw terminal caps. |
H: Will an SPI flash memory chip have the same issues with non-atomic write operations as a dsPIC's internal EEPROM?
A while back I had some intermittent trouble with the internal EEPROM of a dsPIC. Every so often, some value in the EEPROM would be found zeroed out on power-on. I tracked the problem down to when the chip lost power after the erase step of the write cycle, but before the write had completed. It was all about the timing of the power-down relative to the firmware execution, which was (in normal operation) random. I solved this by adding a buffer section to my EEPROM, to ensure that an incomplete write-cycle could be completed on restoration of power. I had to turn EEPROM writes into an atomic operation.
Now I'm using a different dsPIC without internal EEPROM, and I'm trying to use an external flash memory chip to store persistent data. I'm wondering if I should have similar concerns. Should I be worried that my external flash chip will power down mid-write and lose data, and write a fix for this in my firmware like I did for internal EEPROM? Or does the chip itself guarantee atomic write operations?
For further detail, my buffering technique defines an area of persistent memory that consists of three fields: address to write to, data to be written, and a READY flag. A "write" consists of four steps: write to buffer, set READY flag, write from buffer, clear READY flag. On power-up, you check the READY flag. If it's set, execute whatever's in the buffer. This worked well in EEPROM, but I'm not sure if it will work well in flash.
AI: I have never heard of a flash memory chip (or processor with internal flash) that has sufficient energy storage internally to complete a write (or erase) cycle if external power should be removed. In other words, if you don't have control over when your system powers down, you always need to create a protocol that can detect and deal with any individual flash update operation that might have been interrupted.
One way around this is to provide the necessary energy storage (e.g., an electrolytic capacitor) on your board, such that you can detect an external power failure, yet still complete any write/erase operation that may have already started.
EDIT: Your write buffer concept could be used with the external flash, but it needs to be modified to take into account the larger erase granularity. According to the datasheet, the minimum erase size is one "sector" (4K bytes).
You'll need to reserve three sectors for your write buffer. One of these will hold your READY flag (call this the WB_R wector). The second will hold the sector address of the sector being updated (call this the WB_A sector). The third will hold the updated data for that sector (call this the WB_D sector).
To update any particular byte (or a group of bytes in a single sector), follow the following steps. We assume that WB_R is already erased.
Erase WB_A.
Locate the flash sector that contains the byte you want to change (call this the DEST sector).
Write the sector address of DEST to WB_A.
Erase WB_D.
Copy the contents of DEST to WB_D, but when you get to the byte(s) that you're changing, write the new value(s) to WB_D instead of the old value(s).
Set the READY flag in WB_R. Note that this means you change it to its non-erased state. Since the erased state is 0xFF, this means that you write 0x00.
Erase DEST (getting the sector address from WB_A).
Copy the contents of WB_D to DEST.
Erase WB_R.
On power up, check the READY flag, and if it's set (anything other than 0xFF — it may have been only partially written or partially erased), jump directly to step 7.
Note that with this algorithm, each of the write buffer sectors gets written and erased at least once for each write operation you do. This could become a problem if you do a lot (more than 100,000) of writes over the lifetime of the product. If that's the case, you'll need a more sophisticated wear-leveling algorithm. |
H: What is the purpose of adding a 300 ohm to 500 ohm resistor on the WS2812B Neopixel data line?
Adafruit's best practices for their Neopixel LED strings say:
Place a 300 to 500 Ohm resistor between the Arduino data output pin and the input to the first NeoPixel.
What is the purpose of this optional but recommended resistor?
AI: http://learn.adafruit.com/adafruit-neopixel-uberguide/power claims "can help prevent voltage spikes that might otherwise damage your first pixel".
In conjunction with the other warning about connecting ground first, I think it's there to prevent current flowing through the clamp or parasitic diodes between the data line and the positive power rail. It limits the current into the pin. Potentially if you have the data line connected but the positive power rail disconnected, it might attempt to power the LED through the data pin and burn it out.
It will also very slightly mitigate damage from static charge building up on one end of the data line while disconnected, and it will act as a termination resistor reducing "ringing" from signal edges. Normally termination resistors are smaller, though. |
H: What effects might an electrolyte leak have on nearby electronic components?
If an electrolytic capacitor were to leak electrolyte on nearby circuit boards, what might the effects be? Short-circuits? Altered impedances? Are there caustic effects? Or is it possible to generalize aluminum capacitor electrolytes to this degree?
AI: It can be inherently corrosive.
Perhaps more important is that the electrolyte is highly conductive electrically, so if power is applied and electrolyte is spilled on a board it can electrolytically etch away traces if there is voltage between them. |
H: Current spikes in simple transformer?
I'm using 220v -> 48v 830 W transformer directly connected to the 220v grid and used to operate my PCB drill.
The issue with transformer is that it's making irregular (with 0.1-2 min interval) sudden "BZZ" noises, accompanies with current spike in input coil and voltage spike in output coil.
Before using it as drill power unit, it was powering a linear voltage regulator supposed to regulare voltages up to 60v, but it was burnt out with one of those voltage spikes.
I wonder what could cause such spikes? Defect in transformer or it is normal behaviour?
AI: Sounds like some kind of arcing within the transformer (perhaps turn-to-turn). If the transformer does this with no load and there is no sign of any other disruption on the incoming power, I would suggest discarding the transformer as it could be dangerous. |
H: Understanding current, wire size, and voltage drop
I am trying to understand the relationship between these. I have 24AWG 300V copper PVC insulated wire. From what I have learned, this wire can be used to connect a Panel LED that draws <20 mA @ 110V to a 110V main power terminal strip.
I have read that voltage drop would be a problem with increasing lengths of wire at smaller gauges. This wire's length is less than 2 feet and at room temperature. Using a calculator, the Vdrop is on the order of a thousandths of a volt. Am I doing my math correctly? I have only been able to find examples of this situation where people used 14 gauge wire, which has to be way overkill.
AI: Voltage drop is one consideration, there are others.
Think about the potential fault current and fusing for that circuit.
You want the wire to be sufficiently large gauge to be able to blow the fuse or trip the breaker without causing a hazardous situation (such as the wire going incandescent). In many cases that may be prescriptively spelled out by safety regulations (NEC, UL or whatever).
There may also be minimum gauge requirements just for mechanical robustness (for example AWG20 is the minimum wire gauge allowed in some situations). |
H: How to choose an alternative for a specific BJT transistor?
I'm trying to reproduce some circuits with electronic pieces that I've at home. Unfortunately I miss some recommended transistors so I'm trying to understand how to replace them with an alternative transistor and overcome this problem.
How can I choose the right transistor alternative for my circuits. I know that there will be a lot of parameters depending from my circuit but which are the most important parameters that are mandatory? and are there criteria that could be helpful for choosing the right alternative?
My specific case
In my case I don't have a 2N2222 transistor. In alltransistors.com I've found that I can use BFX95, BSW63, ECG123A, MM531 that are different alternatives that I don't find in other site where it seems that 2N3904 is the right one. I don't know which are the parameters they look at.
For example I'm try to amplify a signal and send it to a loud speaker (with a 100 Ohm resistor) in a circuit with a load lower than 6 V, can I use a C945 that as the same Ueb but uses an hfe of 130 instead of 100 of 2N2222? What will happen?
AI: Look at the obvious things first: how much voltage and current must the transistor handle in the circuit? How much power must it dissipate? Any transistor that meets these specs will probably work to some degree.
Then look at lower-level details such as current transfer ratio (does the circuit only work with a certain minimum gain?) and capacitance values (especially in high-frequency circuits).
Does the circuit exploit some particular feature of the specified transistor? If so, you'll need to verify that your replacement transistor behaves similarly. |
H: Switch poles from inverted power to make negative positive?
My understanding is that voltage is relative (where you measure affects voltage) and that current flows with voltage difference.
Why can't you just switch the poles/wires of an inverted signal/power supply to get a non-inverted output?
This is mostly in reference to power supplies (switching/voltage regulators) and op-amps, but sort of curious as to theory as well.
AI: If the output of a power supply is isolated, meaning it can float over a range of voltage relative to its input, then the polarity of its output is only relative. Whether it is a positive or negative supply is only determined by how you think of it and how you hook it up to your load relative to whatever it is you consider 0 V.
If a power supply is not isolated, then it is already referenced to some other voltage. If your load is also connected back to that node somehow, then you can't just flip the leads of the DC output around. For example, you might have a 5 V power supply that runs off of the battery in your car. If it is not isolated, the negative output of that supply will most likely be connected to the negative output of the battery, which is connected to the chassis of your car. If you are powering something that also connects to the chassis, then you can't flip the leads around and think of it as a -5 V supply.
On the other hand, if you have a power supply that plugs into the wall, most likely its outputs are isolated from the wall power and therefore the wall plug ground. In that case you can flip the leads around any way you wish to consider it a positive or negative supply. |
H: ARM microcontrollers for robotics
I have been working on ARM9 microcontroller LPC3141 until recently, but I am wondering if there are any better and newer ARM microcontrollers more suitable for robotics.
ADD:
Are there any general rules on how to choose the right ARM? I mean are families like "cortex", ARM9, ARM11 intended each for a different purpose?
AI: From my understanding ARM processor come in in the M series, A series and R series among others. The M series is usually for energy efficient Micro-controller type of applications. The A series is devoted to more a microprocessor where you are runnning an OS like linux or andriod inteded to run aplication. The R series is more adequate when Real time performance.
But choosing which one is the correct for you robotics application depends on what you are trying to accomplish. If you are trying to create an autonomous vehicle guided by GPS probably it can be done with the M series but if you are looking at computer vision while using that to navigate and create maps of your surrounding you might be stepping in to the realm of the R series or perhaps even x86 architectures |
H: What's the most efficient way to derive negative voltage for a bench power supply?
I’m building a bench power supply based on two LM317 with the following specs:
Input: 127VAC (from mains)
Output: adjustable from 1.25VDC to 15VDC
Current: limit adjustable from 100mA to 1.5A
In the LM317 datasheet from On Semiconductors there is a reference for the “current regulator” circuit that requires a negative voltage (below -1.25V) in the FET (detail #1 in the figure).
Since my power supply is not handling negative voltages I was wondering on using a 24VAC center tapped transformer (127VAC to 12-0-12) ignoring the center tap to power the whole circuit (detail #2 in the figure).
So, my question is how to derive the negative voltage necessary for the FET?
Also, If I decided to use the center tap of the transformer, changing it to a 48VAC one (127VAC to 24-0-24), I’ll use the full rectifier bridge between +24VAC a 0VAC and I’ll try to extract the negative from the -24VAC of the trafo. Since I only need something around -1.5V isn’t that a waste of cooper on the trafo (detail #3 in the figure)?
What is the best approach to power the power supply and also provide the necessary negative voltage for the current regulator circuit?
AI: A 24VAC transformer will give you as much as 40VDC with a light load. That's pretty marginal for an LM317 with zero output. Way too close for comfort, in my opinion.
Anyway, if you were to use a third LM317 to regulate the input voltage down to +5VDC, you could use that 5V to power a 7660 charge pump to generate about -4.5V for your JFET current sink.
The filtered unregulated voltage likely is too close to the maximum 40V input voltage of the 317 (actually maximum difference between in and out). Maybe you can use 317HV, but an 18V transformer would be better.
Unfortunately the LM7805 is only good for 35V max input, so you'd need a Zener in series with the input of the LM7805 if you wanted to use that part to drop the voltage for the 7660 with a 24VAC transformer. |
H: What is this type of flexible contact strip called?
The LCD below is from a cheap digital clock which was (obviously) damaged (broken glass).
The electrical connection between the PCB and the display was realized with this pink strip.
Its flexible...
...and consists of alternating rows of conductive and insulating material between the pink boarders.
[above image was altered in contrast/brightness to highlight the alternating strips]
What is this kind of connector called? Is it only used for displays?
I am pretty impressed that the connection is reliable just from the very slight pressure between the strip and the PCB. Also, its easily removable from the display. There seems to be some conductive layer on the glass, from where the signal goes into the displays internals. This connection seems to be damaged for the three rightmost signals, where the glass is broken.
AI: That is called a zebra strip or Elastomeric_connector.
It is made from silicone rubber with conductive carbon particles in them. This is used to make sure the connection between the PCB and glass is flexible, as both are neither thermally nor mechanically compatible at all. Also, as it doesn't rust or really react with anything galvanically at all it ensures a pretty good, albeint fairly high impedance, connection between the indium-tin-oxide or other connection material on the glass and the contacts on the PCB. |
H: Need for edge triggered versions other than master slave
I am studying synchronous digital circuits and I have come to the conclusion that master slave flip flops are edge triggered? Is my study correct? If master slave versions ARE edge triggered, why do we need separate edge triggered flip flop versions like the edge triggered D flip flop (the non- master slave configuration)?
AI: Master-slave just a way of combining two gated or level triggered latches together to form an edge-triggered flip flop. A master-slave D flip flop is just one way that you can build a D flip flop.
The idea behind a master-slave flip flop is that you can connect two latches back to back so the 'master' latch will update while the clock is low and the slave latch will update while the clock is high. In this instance, when the clock transitions from low to high, the current state at the input of the master flip-flop is captured and propagated to the output. This functionality forms a D flip-flop.
However, master-slave is not really the only way to build a D flip-flop. It is possible to build both dynamic gates that use capacitance to hold the value during the clock transition, allowing the gate to be much smaller and simpler. It is also possible to build the same functionality with some inverters and transmission gates. It depends on what level of the design you are working at. If all you haveis logic gates, you probably need to build a master-slave flip-flop. However, if you are working at the transistor level, then you can build something more optimized.
tl;dr: a master-slave flip flop IS a D type flip-flop, but it is ot the only way to make one. |
H: Voltage regulator IC capabilites
I want to convert unregulated 10-14V DC to 5V DC and 12V DC regulated(constant) supply;This is a buck step down regulated voltage supply IC it outputs the voltage that I require. Is this IC all I need? Or there will be some more components needed?
Will this IC have:
Under-voltage and short-circuit protection.
Thermal shutdown prevents damage from overheating.
Reverse-voltage protection.
I have seen buck step down regulators which have many more components, than just a IC. For example this: http://www.pololu.com/product/2110. What is the use of other components, Are all the other components used to provide the above mentioned 3 points?
AI: Getting 5V from a supply that is ranging from 10V to 14V is no problem for the LM2576 and it has thermal and current limit protection.It doesn't have under-voltage-lock-out but it does have an on-off pin that can be used (with an external circuit) to provide this function.
It doesn't have reverse input voltage protection either - you should consider using a diode for this.
Getting 12V from a supply that ranges from 10V to 14V is more complicated and you can do this with a buck-boost type controller. Buck on its own can only produce voltages that are smaller than its input voltage - that is why the 5V is relatively easy. Note that there is a section in the LM2576's data sheet that talks about buck-boost but this is to produce a negative output voltage only and you should not get confused with the device - it cannot produce a boosted positive output easily.
You could use the LM2576 to produce 5V then have a boost regulator on the 5V output to produce 12V - boost regulators do what they say - they boost the voltage output and therefore the input supply voltage to them needs to be below the output voltage they produce.
Regarding the other device linked - without a circuit diagram it's guesswork as to what all the components do - UVLO would hardly account for anything more than two resistors on a lot of chips available (such as Linear Technology's offerings) and reverse voltage protection can be achieved with a maximum of three components usually.
The LT1074 can supply 5A at 5V and, given your input power is able to supply 3.3A, the 1074 may be more suitable: -
It's got enough capability to tee it's output to a boost regulator for the 12V rail providing you manage the output load currents. There's also the LT8471 that can provide two outputs - this picture shows the general idea: -
The negative 12V supply is easily made a positive supply - read the data sheet if you are interested. |
H: BLE113 Bluetooth 4.0 module with CR2025 3v battery power supply
A question regarding the power supply of a BLE113 Bluetooth 4.0 module: I am attempting to order several bluetooth modules, but the main concern is the power supply. Since I am new in the field of all sorts of modules and electronics, what is the best way in which can I connect a bluetooth module to a power supply such as CR2025 3V?
The main idea is to connect the mentioned bluetooth 4.0 module to an Apple iOS application.
AI: Your main concern with any wireless module on a low-performance power supply is to design in very heavy decoupling. Coin cells in particular - excluding recheargable lithium ion type (which are very rare) - have internal resistance up to about 100 ohms, so you will not be able to draw more than a couple of milliamps from them. As your BLE113 module is specified to draw up to 18mA, this will significantly reduce your battery lifetime or even pull the battery flat . The solution for this is (obviously) to use a big energy reserve in the form of an aluminum electrolytic capacitor of enough capacity to deliver all the energy needed for a single transmission.
Then obviously also make sure your average power consumption does not exceed what the battery can deliver (efficiently): power down the wireless radio as much as you can as well as your microcontroller or whatever other active devices you have in your application. |
H: SIM900 email send recive Firmware > 1137B11SIM900M64 ST?
I just received what I believe is the latest version of firmware SIM900, 1137B11SIM900M64 ST. I did the upgrade and
I try to implement without any results, commands reported in SIM900_Email_AT_Command_Manual_V1.02
One thing I find curious is that these new commands are not reported in the manual very last 1.05 of AT commands
Already beyond anyone had any experience with this version/, can tell where the problem is, or is it that there is a newer version of firmaware have to implement?
for each command to implement the response is ERROR. this is what tells me that probably this is not implemented
for example: cmmd resp
AT+EMAILCID? > ERROR
AT+EMAILCID=? > ERROR
AT+EMAILCID=1 > ERROR
and thus to each and every one of the commands reported in the manual.
AI: 1137B11SIM900M64 ST not support E-mail.
need a special version of the firmware
1137B10SIM900M64_ST_Email_TEST_20111103 - test only version |
H: What are the most common data storage devices in small consumer electronics?
What are the standard ways of data storage in small consumer electronics (routers, phones, etc.)? For simple devices I guess microcontrolles with in-system programmable flash are enough, but for example on a smartphone, would there be an internally mounted micro-SD card or similar? Where would OS, etc. be stored?
AI: For items such as you use as examples, there is usually a NAND flash chip (or more than one) hanging off the main processor.
For smaller items (say microwaves), the code will either be in internal flash on the microcontroller, or in very cost-sensitive high-volume applications will be in ROM, again usually on the same die as the micro. |
H: Will an SPI EEPROM chip have the same issues with non-atomic write operations as a dsPIC's internal EEPROM?
A while back I had some intermittent trouble with the internal EEPROM of a dsPIC. Every so often, some value in the EEPROM would be found zeroed out on power-on. I tracked the problem down to when the chip lost power after the erase step of the write cycle, but before the write had completed. It was all about the timing of the power-down relative to the firmware execution, which was (in normal operation) random. I solved this by adding a buffer section to my EEPROM, to ensure that an incomplete write-cycle could be completed on restoration of power. I had to turn EEPROM writes into an atomic operation.
(For further detail, my buffering technique defines an area of persistent memory that consists of three fields: address to write to, data to be written, and a READY flag. A "write" consists of four steps: write to buffer, set READY flag, write from buffer, clear READY flag. On power-up, you check the READY flag. If it's set, execute whatever's in the buffer. This worked well in internal EEPROM.)
Now I'm using a different dsPIC without internal EEPROM, and I'm trying to use an external EEPROM chip to store persistent data. I'm wondering if I should have similar concerns. Should I be worried that my external EEPROM chip will power down mid-write and lose data, and write a fix for this in my firmware like I did for internal EEPROM? Or does the chip itself guarantee atomic write operations?
AI: The chip cannot guarantee atomic writes - if the power goes away while it is writing (or erasing), there's nothing it can do about it.
Of course, the chip designers could implement some kind of holding store (as you have done) - but that adds cost that other users won't want to pay. Also, what happens if the power goes down whilst writing to the buffer instead of the "real" memory? |
H: Understanding the guaranteed data consistency within CAN network
I am reading the CAN spec and it says the following about data consistency:
Data Consistency: Within a CAN network it is guaranteed that a message is simultaneously accepted either by all nodes or by no node. Thus data consistency of a system is achieved by the concepts of multicast and by error detection
Is my understanding that when no node accepts the message that the transmitter will send the message again and that the error count will increment correct?
Does the transmitter know that all nodes accepted the message based upon the acknowledge bit by the receivers? How does the transmitter know that all nodes sent this acknowledge bit on the bus and not just some of the nodes?
AI: The transmitter doesn't know if all the nodes acknowledged the message during the ACK bit.
However, any node which has not received the message correctly will create an error-frame which all nodes will see - they will then discard the message. The sender will then retransmit. |
H: How to get higher amperage out of a power supply?
I currently have a 24V - 5A power supply in a commercial product that may require upwards of 8A from the load. Ideally, I would just hook up another 24V - 5A power supply in parallel and not worry about the overcurrent. However, I know that this is an issue because of the slight differences in voltage from each power supply (they will fight til one dies).
Is there any way for me to boost the amperage available of this power supply safely without completely replacing it? Footprint is an issue since this is a commercial system, I have about 4" x 2" of space in my box.
For background, I am a degreed electrical engineer, but did not focus on circuit theory (went more of the emag/nuclear route).
AI: If the power supply outputs can be put in series (i.e. their 0V ends can be "lifted" from ground) then you get 48V @5A and you can probably get a cheap off-the-shelf buck regulator that will convert down to 24V @9A. If you were designing from scratch I'd consider this part: -
The above circuit is shown generating a 12V output from inputs ranging from 15V to 60V. If both power supplies are connectable to produce one at 48V then the above circuit, with ratio modification to the two resistors in the red box will easily produce 24V. However, I'm sure you could pick something up from a chines source or ebay for ~$10.
If they both have to be grounded then you could use a H-bridge driver chip where one half of the H bridge is powered from one supply whilst the other half is powered from the other 24 v supply. Maybe something like this.
Or you could have both supplies individually driving their own 12V flyback converters and wire the outputs in series (transformer outputs are used in flyback converters). This will work too. |
H: How to use "voltage controlled switch" in OrCAD?
In this OrCAD project, I tried to build a really basic DC-DC converter with use of "S" or "SBreak" parts in OrCAD's Analog Library. But, according to analysis (picture below), the blue DC line should be equal to 5 VDC, but OrCAD says it's at 0 V.
I know that the part "S" or "SBreak" is working with "VON" and "VOFF" voltage levels and on their working/closing resistances "RON" and "ROFF". What and how is it with "S" switches and how to use them effectively?
AI: Look what you have in your picture: -
How can you expect sensible results with Ron at a 2,000,000 ohms and Roff at 1,000,000 ohms. With these value the voltage across the ten ohm resistor is going to be about 50 microvolts when the switch is off and about 25 microvolts when the switch is on. Is this what you see? |
H: How can I communicate the difference between 2 watts of continuous power and a 2 watt capacity?
I'm trying to understand the difference between a power output in watts and a power capacity in watts, and I'm open to the possibility that I'm thinking about it all wrong.
If I want to charge a battery with a 2 watt-hour capacity, how long is it going to take me if I'm using a power source with a continuous output of 2 watts?
AI: "If I want to charge a battery with a 2 watt capacity, how long is it going to take me if I'm using a power source with a continuous output of 2 watts?"
There is no way to tell. The maximum instantaneous power output (2 W in your case) doesn't tell us how much total energy the battery can hold. For example, if this battery can only sustain this 2 W output for 15 minutes before it goes dead, then it can hold 1/2 Watt-hours, which is 1.8 kJ. If it can sustain 2 W output for 10 hours, then it can hold 20 Watt-hours, or 72 kJ.
You are charging the battery at 2 W, which is the same as saying you are transferring 2 J of energy into the battery every second. Obviously it will take a lot longer to transfer 72 kJ of energy at 2 J/s than it will take to transfer 1.8 kJ at 2 J/s.
On top of that, batteries have inefficiencies. If this battery is 75% efficient, for example, then you need to give it 1/75% = 1.33 times more energy during charging than it can ultimately hold and return to you during discharging. |
H: What do memory configurations like "256Kx18" mean?
This is a beginner question here. When choosing memory ICs, one of the options is the memory size/configurations. I understand the size part, but what does the "16Kx9" mean? It seems the same memory size is usually available in different configurations. I attached a screenshot from Digikey as an example.
AI: 256K x 8 means 256 kibi-locations, each location holding 8 bits. There are 18 address lines (218 = 256 * 1024) and 8 data lines. |
H: What is the proper GPRS / GSM modem setup to work with 5 voltage sensors?
I've been looking at modems and most of them come in RS232/485 input only. I need to hook up 5 different power cables to the modem to monitor their voltage.
Some of the modem's I've found have 4 to 8 digital and analog input/output. I've also looked at maybe having an Arduino in between the modem and sensors.
What is the proper GPRS / GSM modem setup for 5 voltage sensors?
AI: You could use a GPS tracker - here's one that has (amongst other features): -
Programmable logging and upload interval
4 x alarm inputs
2 x analog inputs [GS902]
2 x relay outputs
1 x low voltage alert
It doesn't give you the full 5 analogue inputs you need but it's a start. |
H: How do I connect this piece of electronics to show the digit display? (from satellite decoder)
I have the following piece of board/electronics:
Link: https://i.stack.imgur.com/pNErb.jpg
Link: http://i.imgur.com/4BCKU21.jpg
Now, I recently bought an arduino, so I want to connect the digit display to show digits,
I already have blown out an IR receiver so that's the reason I disassembled an old satellite decoder, and I pulled the IR receiver out from this.
But now I am curious, I cannot find any datasheets for this (maybe they are closed source?).
I am wondering how I can connect this to work with an Arduino?
AI: In my experience, the pinout for LED displays of a given configuration and number of pins almost always conforms to defacto industry standards. Here is a similar display available through distribution that I expect would have the same pinout.
Edit: David Tweed has noted the display is Common Anode, so the below schematic should be correct. The digit-drive transistors appear to be NPN emitter followers. You could retain those and the segment resistors to drive the display from another micro (total 11 lines required).
This assumes you're going to strip out the display and drive it directly. If you want to continue to use the micro on the board, the protocol is probably not going to be easy to reverse engineer, even if both halves were working. |
H: What are the various files types in Actel (Microsemi) Libero?
While researching What files/directories are needed to recreate a Actel/Microsemi Igloo2 project?, I found about various files types. But not all are defined in the Libero SoC or Design Constraints, both v11.2 User's Guides. Specifically what are the files with the suffixes
bfm, cfg, cxf, dat, def, gen, ipd, loc, log, map, pro, rpt, sdb, xml?
This question is the same as List of Xilinx file suffixes (for ISE), but for Actel. I'm not worrying about SmartFusion2 parts, just Igloo2 for now.
AI: Partial answer... there are quite a few I don't know, and Libero has decided to segfault when I start it tonight...
bfm: Source file - keep under version control. Bus Functional Model script which you write in their ad-hoc language, compile into a .vec file, which is read and executed by a testbench instantiating their VHDL BFM models.
cfg: This captures information about the settings that were specified for the system.
cxf: SmartDesign core configuration file. This and the matching .sdb allow SmartDesign to recreate the DirectCore components via its "Generate Design" command.
dat:
def: Discontinued Programming file. Output file from flashpoint.
edn: is the Output file.
gen: Output netlist file from the generated cores
ipd: Programming file
loc:
log: log file from configured generated cores
precision.log: Precision logfile
map: lets you know the location of the Logic inside the FPGA
_syn.prj: Synplify log file
pro: FlashPro settings. Generated by FlashPro.
psp: Precision project file
rpt: Report. Optionally generated from a menu item in Designer.
sdb: Source file - keep under version control. Archive to permit recreation of DirectCore components.
srr: Synplify logfile
tcl: Used to run synthesis
xml: XML files. Some are part of the auto-generated SmartDesign, passing info to the embedded software tools. There may be others.
Additional:
prj: Source file - keep under version control. Project file; stores Libero settings for a project
adb: Actel Designer database, stores the compiled design for P&R. Output
pdb: Actel Designer physical database; essentially the finished bitfile
readable by FlashPro
vec: Compiled from .bfm
pdc: Source file - keep under version control. Constraints such as pinout, I/O standards.
sdc: Constraints generated by the tools (e.g. Synplicity). If I modify this I treat it as as source file.
The ones I have listed as Source Files are the ones I keep under version control. I tend to keep all my actual sources OUTSIDE the Libero project structure and "link" them into Libero to minimize interactions between Libero and versioning. |
H: 555 saw tooth generator diodes purpose?
I'm given this 555 timer based monostable saw-tooth generator. This is a known arrangement for this part. The difference from other circuits I've seen is that the bias network of the external transistor is composed from a Zener + regular (small signal) diode. Why is the Zener diode been used? What advantage does it have over a simple resistor and why is the other diode needed?
AI: The PNP transistor is part of a constant current source for the capacitor. The current is determined by the voltage across \$R_E\$ (ignoring the relatively small base current).
The voltage across \$ R_E\$ is \$ V_Z - V_{BE} + V_D \$ where \$V_D\$ is the forward voltage across the diode, so we can say that \$I_C \approx\$ \$ (V_Z - V_{BE} + V_D)\over R_E \$
Although the currents through the diode and the base-emitter junction are typically quite different, the voltages are not that far apart, and the magnitude of the temperature coefficients of both will be about 2mV/°C, and they will tend to cancel.
In that case, \$I_C \approx\$ \$ V_Z\over R_E \$
The Zener voltage in this circuit must be less than 5V for this circuit to work (as the capacitor has to charge to 2/3 of 15V). The temperature coefficient of zeners in the 4.3-4.7V range is approximately zero.
(Ref Motorola Semiconductor Data Library 1N47xx series)
The combination of the zener diode and the diode stabilizes the constant current against both temperature changes and changes in the supply voltage, however it actually increases the variation in time with supply voltage since the threshold voltage of the 555 is derived by a divider from the supply voltage.
Edit: In reference to an additional question, I include a "Functional Table" from a version of the 555 datasheet (CMOS type, but the logic is the same). |
H: How to determine an expression that detects underflow?
This is a part of my computer science assignment:
When adding two unsigned binary integers, an overflow can easily be verified by observing
the carry out. Specifically, an overflow occurred if and only if S' · Cout = 1.
Does anybody know what this S might represent? is it the sum? if it is how is this expression making sense?
The adder-subtractor circuit also performs the subtraction of the two unsigned integers: A−B.
If the magnitude of B exceeds A, then the subtraction will produce an unusually large result, i.e., an underflow occurred.
In terms of the inputs and outputs A3A2A1A0, B3B2B1B0, S3S2S1S0, Cout and
S, determine an expression that detects underflow.
Determine the simplest Boolean expression that simultaneously detects overflow
or underflow.
I have no idea in which direction I should go. I don't even know how to tag this. Can anybody give me a little hint on how to solve them? Like what the answers are supposed to look like?
I think it shouldn't be too hard.
AI: I think \$S\$ is a control bit that determines whether or not a subtraction operation is desired. \$S=1\$ means subtraction. \$S=0\$ means addition. When you add two unsigned numbers together you can ONLY get an overflow and this is always indicated by \$C_{out}=1\$. When you subtract two unsigned numbers you can ONLY get an underflow and this is always indicated by \$C_{out}=0\$ (when subtraction is implemented in the usual way by inverting all the bits of \$B\$ and setting \$C_{in}=1\$. This makes me think that \$S\$ is just \$C_{in}\$ in this case.
If I'm right, then \$S' \cdot C_{out}\$ being the "overflow case" (which can ONLY happen for addition) makes sense. \$S'\$ will be 1 (because addition has \$S=0\$) and if \$C_{out}=1\$ then you have an overflow. That all matches up with what you write, at first. So maybe I'm getting this correct.
Underflow (unsigned and only during subtraction) would then be \$S \cdot C_{out}'\$. So a signal that combines underflow and overflow would be \$S' \cdot C_{out} + S \cdot C_{out}'\$, which is just an xnor between \$S\$ and \$C_{out}\$. |
H: Arduino LED matrix and 2D array, data seems to be corrupting
I'm trying to drive an 8x8 LED matrix with an arduino nano, but I can't get the LEDs to display what I tell it to.
I'm using this LED Matrix
Here's my code:
int row1 = 2;
int row2 = 3;
int row3 = 4;
int row4 = 5;
int row5 = 6;
int row6 = 7;
int row7 = 8;
int row8 = 9;
int col1 = 10;
int col2 = 11;
int col3 = 12;
int col4 = 18;
int col5 = 14;
int col6 = 15;
int col7 = 16;
int col8 = 17;
void setup() {
int i;
for(i = 2; i <= 18; i++) {
pinMode(i,OUTPUT);
}
for(i = 2; i <= 9; i++) {
digitalWrite(i, HIGH);
}
}
void loop() {
int display [8][8] = {
{1,0,0,0,0,0,0,0},
{0,1,0,0,0,0,0,0},
{0,0,1,0,0,0,0,0},
{0,0,0,1,0,0,0,0},
{0,0,0,0,1,0,0,0},
{0,0,0,0,0,1,0,0},
{0,0,0,0,0,0,1,0},
{0,0,0,0,0,0,0,1}
};
updateScreen(display);
}
void updateScreen(int screen[8][8]) {
Serial.begin(9600);
int i;
for (i = row1; i <= row8; i++) {
Serial.println(i-1);
digitalWrite(i, LOW);
digitalWrite(col8, screen[i-2][0]);
Serial.print(screen[i-2][0]); Serial.print("|");
digitalWrite(col7, screen[i-2][1]);
Serial.print(screen[i-2][1]); Serial.print("|");
digitalWrite(col6, screen[i-2][2]);
Serial.print(screen[i-2][2]); Serial.print("|");
digitalWrite(col5, screen[i-2][3]);
Serial.print(screen[i-2][3]); Serial.print("|");
digitalWrite(col4, screen[i-2][4]);
Serial.print(screen[i-2][4]); Serial.print("|");
digitalWrite(col3, screen[i-2][5]);
Serial.print(screen[i-2][5]); Serial.print("|");
digitalWrite(col2, screen[i-2][6]);
Serial.print(screen[i-2][6]); Serial.print("|");
digitalWrite(col1, screen[i-2][7]);
Serial.println(screen[i-2][7]);
delay(1);
blank();
digitalWrite(i, HIGH);
}
}
void blank() {
digitalWrite(col1, LOW);
digitalWrite(col2, LOW);
digitalWrite(col3, LOW);
digitalWrite(col4, LOW);
digitalWrite(col5, LOW);
digitalWrite(col6, LOW);
digitalWrite(col7, LOW);
digitalWrite(col8, LOW);
}
And here is the output:
1
1|0|0|0|0|0|0|0
2
0|1|0|0|0|0|0|0
3
0|0|1|0|0|0|0|0
4
0|0|0|1|0|0|0|0
5
0|0|0|0|1|0|0¾j
6
0|0|0|0|0|1|0|0
7
0|0|0|0|0|0|1|0
8
0|0|0|0|0|0|0|1
So I can tell that the error (probably) isn't my wiring, because those array values are clearly wrong, I have no idea where the ¾j is coming from.
AI: The problem is you're reading outside the bounds of screen. Screen has valid addresses of 0-7, and you're trying to read from screen[8][n].
8
887|22021|-15872|-30720|124|2|9|10
^ How can you have line "8"? The line number is Serial.println(i-1);, and the value is Serial.print(screen[i-1][0]);, so the error will be present in the array access as well. To fix it, you just need to change to screen[i-2].
Ok, the other corruption (6 0|0|0|0|0|0|Á) issue is because you're heavily oversaturating the serial port. I stuck a 1 second delay in after each loop, and it fixed that issue.
Change:
void loop() {
static int display [8][8] = {
{1,0,0,0,0,0,0,0},
{0,1,0,0,0,0,0,0},
{0,0,1,0,0,0,0,0},
{0,0,0,1,0,0,0,0},
{0,0,0,0,1,0,0,0},
{0,0,0,0,0,1,0,0},
{0,0,0,0,0,0,1,0},
{0,0,0,0,0,0,0,1}
};
updateScreen(display);
delay(1000); // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<
}
or
void updateScreen(int screen[8][8]) {
Serial.begin(115200);
int i;
<snip>
Output:
0
1|0|0|0|0|0|0|0
1
0|1|0|0|0|0|0|0
2
0|0|1|0|0|0|0|0
3
0|0|0|1|0|0|0|0
4
0|0|0|0|1|0|0|0
5
0|0|0|0|0|1|0|0
6
0|0|0|0|0|0|1|0
7
0|0|0|0|0|0|0|1
I also tried simply increasing the baud-rate (to 115200 baud), and that also fixed the issue without the delay, so either option would work. |
H: Why does splitting a FPGA critical path work to improve performance?
Context
I am currently reading the (very good) course material on "Introducing the Spartan 3E FPGA and
VHDL" promoted here (community ads) and I don't really get the idea of splitting a critical path to increase performance:
The example is about displaying the 8 MSbits of a 30-bits counter on LEDs. In the codes below, the first example has a setup time of 4.053ns and the second 3.537ns, achieved by splitting the counter in two 15-bits counters and a carry flip-flop.
Question
Why does it work? Isn't the time to ripple the carry from the LS to the MS counter the same, and even higher from inserting the flip-flop? In the end, MS counter will still need its input from the LS counter to finish its cycle...
Bonus points for those who illustrate their answer with diagrams of the critical path before/after and how the signals propagate.
Code
Before splitting:
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity Switches_LEDs is
Port (
switches : in STD_LOGIC_VECTOR(7 downto 0);
LEDs : out STD_LOGIC_VECTOR(7 downto 0);
clk : in STD_LOGIC
);
end Switches_LEDs;
architecture Behavioral of Switches_LEDs is
signal counter : STD_LOGIC_VECTOR(29 downto 0) := (others => ’0’);
begin
LEDs <= counter(29 downto 22);
clk_proc: process(clk, counter)
begin
if rising_edge(clk) then
counter <= counter+1;
end if;
end process;
end Behavioral;
After splitting:
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity Switches_LEDs is
Port (
switches : in STD_LOGIC_VECTOR(7 downto 0);
LEDs : out STD_LOGIC_VECTOR(7 downto 0);
clk : in STD_LOGIC
);
end Switches_LEDs;
architecture Behavioral of Switches_LEDs is
signal counter : STD_LOGIC_VECTOR(29 downto 0) := (others => ’0’);
signal incHighNext : STD_LOGIC := ’0’;
begin
LEDs <= counter(29 downto 22);
clk_proc: process(clk, counter)
begin
if rising_edge(clk) then
counter(29 downto 15) <= counter(29 downto 15)+incHighNext;
if counter(14 downto 0) = "111111111111110" then
incHighNext <= ’1’;
else
incHighNext <= ’0’;
end if;
counter(14 downto 0) <= counter(14 downto 0)+1;
end if;
end process;
end Behavioral;
AI: Good question! It does seem a little odd at first blush, but I assure you it makes sense.
In the first version, counter(14:0) must be all-ones before the carry can propagate all the way through to bit 15. With the path split, you test against "111111111111110", so you can tell one clock cycle earlier that the next cycle is going to generate a carry. If you examine the simulation output in a wave viewer, you'll see that incHighNext becomes 1 during the same clock cycle that counter(14 downto 0) becomes "111111111111111". At the end of that cycle, you can already tell that the high-bits-counter is going to have to increment, so you don't have to wait for the carry to propagate all the way from the lsb. |
H: What is the current before arriving a resistor and after leaving it in the wire?
Suppose we have a very simple circuit, with just a resistor between a wire connected to a power source. What's the actual value of current travelling the wire before and after the resistor? Is it different? Or is it the same across the wire, between the power source?
My guess is that it should be the same, since the resistor limits the current flow, thus create a "congestion" for the current that goes through it. This congestion also slows down the current before entering the resistor and lessen the overall electrons flow through the wire because the resistor is limiting the total amount of electrons that can pass the resistor. So even if the wire can carry more electrons, but the resistor is limiting it, the wire only supplies the amount of electrons allowed by the resistor and the amount of electrons actually on the wire are the same as the maximum go through the resistor. Is this correct?
AI: Yes, the current in a wire leading up to a resistor will be the same as the current in the wire leaving the resistor (in the ideal case).
There are always real world factors that change ideal behavior however. There could be a small leakage current from the wires at near where they join the resistor or leakage from the resistor body itself to a surrounding part of the circuit. Leakage currents like this are normally exceedingly small and are thus usually ignored for most low voltage applications. They can however become much more significant in high voltage circuits. |
H: ADC pin current consumption
I am using a voltage divider to read about 9V. This divider n/w is connected to an ADC (analogue pin). Now, I am concerned about the wattage of the resistors in the divider n/w. I am using a KL04 Freescale ARM chip. I bring the voltage from 9V to about 2.5V via 10k and 3k n/w. When reading the current, what is the current that is sunk into my pin? The max of each pin is 25mA. Will the controller sink 25mA each time while reading this pin? I am a bit confused.
Kindly advise me.
AI: The pin of the ADC will not take that current unless the voltage on that pin is taken above the supply rail to the chip. Your potential divider ensures it doesn't do that in two ways. Firstly it is a potential divider and therefore will reduce the real input's voltage to a lower level and secondly the impedance of the resistor means the raw input voltage would have to be ridiculously high to generate 25mA. |
H: Differences between a LM317AHVT and a LM317T
Is there any practical difference between the LM317AHVT and LM317T vis-a-vis regulating a 900mA, 9-12V LED?
AI: The "HV" stands for 'high voltage'. If you look at the datasheets you'll see the main difference is the maximum voltage across the regulator (60V for the HV vs. 40V). |
H: Microcontroller requirements for TFT display
I want to know if I can drive this 320x240 TFT display:
http://www.buydisplay.com/download/manual/ER-TFT032-2_Datasheet.pdf
Which has this controller built-in with 168KB dedicated RAM:
http://www.buydisplay.com/download/ic/ILI9320.pdf
Without having to use an expensive Micro with a dedicated LTDC chip.
but this is my first project using a nice looking display (not just alphanumeric) and I'm not entirely sure how to choose the Microcontroller for it and whether I need a particular one that has an LTDC. I want to display basic menus and don't need fancy animations, but I want it to look professional with minimal flicker and quickly refreshed screens when the menu changes. Any idea what the memory requirement/Clock speed on the MCU would be needed for a project like this?
Thanks for any help!
AI: Since the display includes the Ilitek ILI9320 controller, then your interface requirements are much lower, as the microcontroller no longer has to interface directly with the TFT and instead only talks to the controller chip via a simple interface: either SPI, which takes six wires: RS, CS, CLK, MOSI, MISO and RESET. Or you can use an 8080-compatible parallel interface which takes 13 wires: an 8-bit data bus, and RS, CS, WR, RD and RESET. (There are options to use larger data-buses, up to 18 bits, but I don't recommend that for a low end microcontroller.)
There are two optional interfaces in which the microcontroller generates all of the clock signals (VSYNC, HSYNC and DOTCLK); you don't want to do that since it would require a high-end controller.
So just about any microcontroller will do, however you need to have enough flash memory to hold whatever static items you want to display; for example if you are going to be displaying text then you will need to allocate arrays to store bitmaps for whatever fonts you will use. Even a small font can take 60KB.
One of the advantages of this controller is that includes 172,800 bytes of RAM, which is enough to store 320*240*18 bits. However it is not double-buffered, meaning that when you write to the RAM, it will immediately show up on the screen, and if you updating a lot of the screen, it will be noticeable. |
H: Arduino clock speed prescalers at start without fuses
I know it's possible to change the clock prescaler at runtime. But is there a way to set the prescaler that is used at boot on an ATMega328? I'm aware of the fuses, but those are pretty permanent. I want it to start up at 8MHz and see if it's running on a lower voltage backup battery first. And if not, then switch to 16MHz. I've tried doing it as the first thing in setup() but it doesn't seem fast enough.
AI: I'm aware of the fuses, but those are pretty permanent
You can use the CLKDIV8 fuse, it only controls the preloaded cpu divider value so I don't consider it a permanent change.
The fuse sets the default loaded value to CLKPR (Clock prescale register) to either
clk/1
clk/8
Then in your code you can just set the divider to clk/1 to restore the cpu speed to 16MHz
I'm not sure but unless the bootloader is adaptive this change may affect the UART speed and create problems with the Arduino bootloader, this needs to be tested.
I did a test with my Arduino pro mini (m328p). After enabling the CLKDIV8 fuse using an external programmer, the Arduino bootloader becomes unresponsive and I don't see any way to override the UART speed that Arduiono IDE tries to use.
Updated Solution
I found another solution that doesn't need to change the bootloader, you just create a new profile for the board that has the CLDIV8 fuse enabled.
You need to modify the file boards.txt (e.g. arduino-1.5.5\hardware\arduino\avr\boards.txt), the baud rate for each board is stored there.
Locate the section that refers to your board, for example in my case
## Arduino Pro or Pro Mini (5V, 16 MHz) w/ ATmega328
## -------------------------------------------------
pro.menu.cpu.16MHzatmega328=ATmega328 (5V, 16 MHz)
pro.menu.cpu.16MHzatmega328.upload.maximum_size=30720
pro.menu.cpu.16MHzatmega328.upload.maximum_data_size=2048
pro.menu.cpu.16MHzatmega328.upload.speed=57600
pro.menu.cpu.16MHzatmega328.bootloader.low_fuses=0xFF
pro.menu.cpu.16MHzatmega328.bootloader.high_fuses=0xDA
pro.menu.cpu.16MHzatmega328.bootloader.extended_fuses=0x05
pro.menu.cpu.16MHzatmega328.bootloader.file=atmega/ATmegaBOOT_168_atmega328.hex
pro.menu.cpu.16MHzatmega328.build.mcu=atmega328p
pro.menu.cpu.16MHzatmega328.build.f_cpu=16000000L
Now copy and paste that section to create a duplicate entry that we are going to modify. In that entry you'll have to change the name so that it doesn't conflict with the existing one (any new name will do), and set the baud rate to 1/8 of the one that was originally used.
I'm showing the changes in bold
The old entry with the new one following it look like this in my case:
## Arduino Pro or Pro Mini (5V, 16 MHz) w/ ATmega328
## -------------------------------------------------
pro.menu.cpu.16MHzatmega328=ATmega328 (5V, 16 MHz)
pro.menu.cpu.16MHzatmega328.upload.maximum_size=30720
pro.menu.cpu.16MHzatmega328.upload.maximum_data_size=2048
pro.menu.cpu.16MHzatmega328.upload.speed=57600
pro.menu.cpu.16MHzatmega328.bootloader.low_fuses=0xFF
pro.menu.cpu.16MHzatmega328.bootloader.high_fuses=0xDA
pro.menu.cpu.16MHzatmega328.bootloader.extended_fuses=0x05
pro.menu.cpu.16MHzatmega328.bootloader.file=atmega/ATmegaBOOT_168_atmega328.hex
pro.menu.cpu.16MHzatmega328.build.mcu=atmega328p
pro.menu.cpu.16MHzatmega328.build.f_cpu=16000000L
## Arduino Pro or Pro Mini (5V, 16 MHz) w/ ATmega328 CLKDIV8
## -------------------------------------------------
pro.menu.cpu.16MHzatmega328CLKDIV8=ATmega328 (5V, 16 MHz) CLKDIV8
pro.menu.cpu.16MHzatmega328CLKDIV8.upload.maximum_size=30720
pro.menu.cpu.16MHzatmega328CLKDIV8.upload.maximum_data_size=2048
pro.menu.cpu.16MHzatmega328CLKDIV8.upload.speed=7200
pro.menu.cpu.16MHzatmega328CLKDIV8.bootloader.low_fuses=0xFF
pro.menu.cpu.16MHzatmega328CLKDIV8.bootloader.high_fuses=0xDA
pro.menu.cpu.16MHzatmega328CLKDIV8.bootloader.extended_fuses=0x05
pro.menu.cpu.16MHzatmega328CLKDIV8.bootloader.file=atmega/ATmegaBOOT_168_atmega328.hex
pro.menu.cpu.16MHzatmega328CLKDIV8.build.mcu=atmega328p
pro.menu.cpu.16MHzatmega328CLKDIV8.build.f_cpu=16000000L
After saving the file you'll see a new entry in Arduino IDE, by using it you will be able to program the modified board. |
H: Arduino at 5V but 8MHz
Is there any reason not to load the Arduino Pro 8Mhz bootloader onto a 5V arduino (custom design, just a standard ATMega328p)? I'm doing some battery backup stuff with it that doesn't play nice with 16MHz (since the backup is only 3V). But I want to run the rest of the system at 5V under normal power conditions.
Should I be able to just load the Arduino Pro 3.3V 8Mhz bootloader (and select that profile, or many create my own)?
Anything to watch out for?
AI: Only difference between the regular Arduino 16mhz bootloader and the 8mhz bootloader is that the 16mhz requires an external 16mhz crystal. The 8mhz bootloader uses the internal clock source instead. Less accurate.
AND the lower the voltage, the lower the internal crystal can work at. But in your case, there is no problem with running at the internal 8mhz at 5v. |
H: Why do I need a transistor to control a relay with an arduino, and which one should I get for this circuit?
I need to control a coffee machine plugged into a wall outlet using a relay connected to an arduino. Apparently I need to connect a transistor to the relay. Why? Is it because the arduino can't supply enough current to trigger the coil in the relay?
So the info on the packaging of this relay says "R46-5D12-12 ROHS SPDT 12A-12VDC". How do I go about choosing a transistor? Will I need anything else other than a diode?
edit: The relay will need to be triggered for about 0.5 - 1 seconds every once in a while. The load is definitely not big. It'll simply replace the power button on the coffee machine with an arduino.
AI: There are multiple reasons you want to do this in your case the reasons I can think of are:
1) The relay needs 12V on the input to turn on. An Arduino GPIO only outputs 5V. A transistor in between will allow a 5V signal from the Arduino to switch a 12V signal via the transistor to the relay - thus turning it on.
2) The transistor provides protection. In the event of a back emf voltage spike or some other undesired event only your transistor will be blown, instead of the entire Arduino.
3) Using a transistor should provide marginally faster switch times because the transistor can source more current than the few mA that an Arduino can - thus saturating the coil faster.
Read this info sheet (http://www1.electusdistribution.com.au/images_uploaded/relaydrv.pdf). and pay attention to these images in particular. They show you what a good switching circuit would be and explain how to implement them. |
H: Why does my book's D flip flop differ from others?
My understanding of a D flip flop is that when the clock is high and D=1, it sets Q to 1. If D=0, Q is set to 0. So it is like a set to 1 if D=1 and reset to 0 otherwise.
The table repeatedly given in my book is:
D CLK Q QN
0 High 0 1
1 High 1 0
x 0 (last Q) (last QN)
x 1 (last Q) (last QN)
The book is: John F Wakerly, Digital Design Principles and Practices.
It repeatedly reuses this table when describing negative edge/enable flip flops. It seems like it is doing a T flip flop, basically. But it defines T flip flop later too.
Am I misunderstanding D flip flop? Why does the book differ from other sources?
AI: You mention that the table looks like a T flip flop. Is it possible you are interpreting the table incorrectly?
I believe the "QN" column represents "Q NOT", where the "Q" column is the value of Q resulting from the specific input. In this case, the table correctly represents the behavior of a D flip flop. |
H: Small AC Transformer
Came across these small Zwave controllers here .These are small enough to fit inside the electrical switch housing in the wall. Just wondering how is this device so small as the AC->DC transformer is usually pretty big. Are they using some special kind of smaller transformers that are there?
AI: It's probably a switched-mode power supply which tend to need smaller transformers. If you pull apart a small AC adapter / wall wart you'll often find it contains a lot of empty space and the AC pins take up a substational amount of the total size.
Here's an example photo taken from Ken Shirriff's blog - although maybe it's a fraction smaller than it should be because it's a page describing an unsafe model: |
H: VGA switch 3 in 1 out
My team and I are going on a software development competition in 1 week. We will demonstrate the software on multiple laptops, but we have only one projector. So we need to be quickly able to switch between VGA inputs to the projector. And we need to have 3 inputs and 1 output. We know the basics of electronics, making PCBs... (our school has a electrical/computer technician course) All we need is the schematic. But we have not been able to find one. A 2-in 1-out would do too. We could just cascade two of those in a row. If you could help us we would be very thankful.
AI: Texas Instruments do a series of analogue switches for multiplexing VGA signals. Here's one of them: -
They also do a 7-channel one here called the TS3V712E |
H: What happens when plates of a fully charged capacitor are isolated from each other?
I'm a mechanical engineering student and I'm working on a project that involves a high voltage capacitor.
I understand that when the separation between the plates of a charged capacitor is increased, the voltage increases. But I'd really like to know what happens to the plates if the capacitor is fully charged , disconnected from the charging circuit and then the plates are moved apart from each other by an infinite distance. Will each plate remain charged?
AI: Charge = capacitance x voltage (\$Q=C\cdot V\$)
If the capacitor has a voltage across its plates and the supply is disconnected, the charge remains irrespective of the distance so, if distance increases (and capacitance falls) then voltage increases proportionally. If the plates are taken to an infinite distance, the voltage becomes infinite.
It should be noted that the energy "held" in the capacitor increases as the plates are pulled apart i.e.
Energy = \$\dfrac{CV^2}{2}\$
The increase in energy comes about because work (joules) has to be done to move the plates physically apart i.e. there is a force needed to open up the gap. This, I believe keeps all the conservation of energy and charge equations happy and smiling. Remember, that on a regular capacitor, there is an attractive force between the two oppositely charged plates and it is this force that is trying to stop the plates from being pulled-apart.
If the capacitor plates remain connected to the supply, as the distance increases the voltage must stay the same so therefore charge is reduced (because C reduces) and this pushes current back into the power source. |
H: Does USB require protection if it is only connected to the regulator input?
I have the following schematic powering my circuit.
Is it required that I protect the USB power pin with some fuse?
AI: It looks like your device is a target as opposed to a host controller. As such your device would be consuming power off the USB cable. So generally it is not necessary for you to put a fuse in the 5V path from your USB connector. You could add it but it would be more for protecting against faults inside your target device.
On the other hand if your device was to be a host controller where it is expected to source power from in internal power source out to the USB connector then you would want to provide some current limit protection. How you choose to do that will depend upon your application but choices could include fuse, resettable polyfuse or one of the various USB power switch/current overload detector chips. Any of these will protect your host device in case someone plugs in a bad cable / device that happens to have a short in it. |
H: What is the oscillator used for on HT12E/D?
Every tutorial I've found on the internet connects the oscillator in and the oscillator out with a resistor. What can these ports be used for?
AI: There is an internal RC oscillator (the capacitor is inside, and connected to OSC1). The external resistor forms part of the oscillator.
see the datasheet: http://www.holtek.com/pdf/consumer/2_12ev120.pdf Page 9 gives the oscillator frequency vs. the resistor value. |
H: Determine power needs of a motor
I recently stripped a motor out of an old 2887-z gaf dual-8 mm projector. I'm not even sure if the motor AC or DC, although I suspect its a brush less ac motor. Unfortunately, I disposed of the connections between the chord and motor without analyzing what they did to the power - although I was under the impression they didn't do much.
I've included images of the motor - there's a large transformer built around the motor.
Q: How do I determine the motor's power needs and characteristics so that I can buy a power supply?
motor images
https://i.stack.imgur.com/MIHKT.jpg
user guide
http://www.atsrentals.com/docs/8mm-Projector-Manual.pdf
other:
the motor is very pre-internet age so I am unable to locate specs. but I thought I shoud mention there is a serial number "846-542" paint stamped onto the secondary winding and a "J" "R" stamped on either side of the motor.
AI: The motor looks like a shaded pole AC induction type - very efficient and very quiet. Similar to this one from http://www.indiamart.com/lunar-motors-pvt-ltd/ac-shaded-motors.html - SPM61 series.
Only question is - what was the AC supply voltage to the projector - 220V or 120V. This is answered in the user guide - 120V, 60Hz. |
H: How do the streetcars in Toronto draw power from the lines?
I've tried googling this but to no avail. I've been trying to figure out how streetcars can draw power from a short circuit.
For reference:
(source: roadstories.ca)
If I imagine the power lines simplified as a shorted battery like so
and we assume the streetcar acts like a resistor like so
Would it not just reduce back to the first diagram with the short circuit?
AI: Power feeds in from the overhead wire and connects to a pantograph pick-up on the roof. This routes the power through to a controller and then to the motor and the return path for current travels along the rails: -
I used to remember a thing called a trolley bus in my home town when I was a kid - it was a regular bus with rubber wheels but had a double overhead cable pick-up - positive (it was a dc feed) was on one wire and negative (return) on the other. Ye olde trolley bus: - |
H: Is PWM bound to a certain voltage?
I have been working mostly with 5V rated MCU but I am venturing into the world of 3.3V rated MCU's.
That should not effect PWM,right?
(PWM is bound to time, not voltage as I understand it)
Any info would be appreciated. Thanks.
AI: The PWM is a discrete-value output that is modulated in time.
As such, it only requires a output that can encode two discrete steps. This output can be translated from one signaling format to another with no theoretical losses.
0V-5V is one common format, as is 0V-3.3V, and 0V-\$_{n}\$V, and more exotic current-mode mechanisms. However, translating from one signaling mechanism to another is possible with little effort, just requiring the use of the proper buffering device, so no single PWM physical coding mechanism is limited to that mechanism by anything other then the costs of the parts required to perform the level/mode translation.
So the answer to your question, on the face of it, is no. |
H: Are BJTs used in modern integrated circuits to the same extent as MOSFETs?
On modern integrated circuits, are there as much BJT's on the chip as MOSFET transistor? If not, why?
AI: It is very dependent on the circuit. See this reply on details why one would use one over the other:
When is a MOSFET more appropriate as a switch than a BJT?
For discrete transistors there are advantages to each. When we talk about ICs and VLSI systems the MOSFET is the device of choice because of the simpler manufacturing process and the fact that they are easier to miniaturize. |
H: Firmware protection on AVR and PIC controllers
Can someone extract the HEX file that I burn in a microcontroller I provide them?
If that is possible, how can someone ensure that their code is secured in embedded systems? In the case of PIC and AVR microcontrollers, how can one protect their firmware from being reproduced?
AI: Most micro controllers these days have part or manufacturer specific methods to protect the embedded firmware code. This is generally done by locking out the circuits that normally allow the code memory to be read out. (You'll have to look for part specific details in the data sheet or at the manufacturers web site in applicable application notes).
Once locked it is not possible to read out the code memory using normal techniques. This provides a reasonable level of protection to keep most hackers from viewing the machine code for your embedded application.
Many MCU devices these days have on-board FLASH memory to strore the program code. A previously stored and protected program stored in FLASH can usually be replaced with new code but it takes a full chip FLASH erase operation to unlock the protection mechanism. Once erased the part will operate like it did before the original protection lock. If a new program is loaded it is generally possible to re-lock the part in order to protect the newly loaded machine code.
Any discussion of code protection in microcontrollers would not be complete without mention that there is usually no guarantee that any protection scheme offered by the part manufacturer is fool proof. Manufacturers will even state that the protection systems are not 100% fool proof. One of the reasons for this is that there is a whole black market industry going on where, for a fee, diligent hackers will read out code from a protected part for anyone that wants to pay. They have devised various schemes that permit the code to be read out of the ROMs or FLASHes on protected micro controllers. Some of these schemes are incredibly clever but work to better success on some part families than on others. So be aware of this fact then you try to protect your program from prying eyes.
Once someone has their hands on the binary image of the machine code that has been read out of a microcontroller, whether that was a protected microcontroller or not, they can process the machine code through a tool called a disassembler. This will turn the binary data back into assembly language code that can be studied to try to learn how the algorithms of your program work. Doing accurate disassembly of machine code is a painstaking job that can take huge amounts of work. In the end the process can lead to the assembler code like I described. If your program was written in some high level language such as C, C++ or Basic the assembly code will only represent the compiled and linked result of your program. It is generally not possible to reverse engineer stolen code all the way back to the high level language level. Experienced hackers can come close given enough time and experience.
What this means is there is actually a benefit to writing your embedded application firmware in a high level language. It provides another layer that makes it harder for your program to be fully reverse engineered. Even greater benefit is to be had by using the highest state of the art in optimizing compilers to compile the embedded application because the highest performance optimizers can literally turn the program into a huge spaghetti bowl full of dozens of calls to short subroutines that are very hard to decipher in a disassembler.
Most experienced embedded developers will tell you to go ahead and use any protection scheme that is offered on the MCU in your application....but not to depend upon it to the end of road for your product. They will tell you that the best way to stay ahead of the competition is to constantly upgrade your product so that the old versions are out of date and uninteresting by the time that hackers may have cloned your code. Change the code around, add new features, spin your PC boards from time to time to swap all your I/Os around and any other things that you may think of. This way you can win the race every time. |
H: Why is MSP430's Stack Poniter(SP) always alligned to even address?
While I was reading through the MSP430's User's guide, I came to know that its stack pointer is alligned to even address. (Read Pg.189 of http://www.ti.com/lit/ug/slau208m/slau208m.pdf)
Why is it so ? Why is the stack pointer alligned to even address?
As per my understanding, each address location in RAM can store 16bits of data irrespective of even or off address location.
From the below image it is clear how that data can be pushed or popped in RAM.
Now it is like each address(even or odd) can store 8 bits of data. But I expected each address can store 16bits of data.
AI: Each memory address references a single byte, but the internal data bus (and flash memory) of the processor is 16 bits wide. When accessing values in memory that will be used for data, this is irrelevant from a hardware perspective; it's something the compiler will deal with. When accessing values in memory that will be executed, i.e. are machine code instructions, the processor has to make sure that the instructions are always aligned to an even-numbered byte address. It does this by enforcing a constraint on the PC (Program Counter) register that it must always be even (bit 0 of the PC probably isn't actually implemented as a DFF at all, just hardwired to logic 0). Instructions have to be on even byte addresses because the processor has to be able to read the entire instruction in a single operation from a single 16-bit wide memory location. If the instruction was on an odd byte address, it would be half in one memory location and half in another. The processor would need to be considerably more complex to deal with that possibility; it's simpler (and, ultimately, cheaper) for the processor designer/manufacturer to accept the tradeoff of less complexity in exchange for the processor only being able to deal with even addresses for instructions. |
H: Could this white paste be the cause of intermittent power in a Dell LCD board?
I took apart my Dell 17" to try to repair it. I expected a burned out capacitor or something else obvious but the only thing I found was this white paste touching several components. Could this be the cause of the problems or is it generally non-conducting?
AI: What you have there is the dreaded BenQ-designed CCFL inverter design that permeated all 17-19" TFTs in the mid-00's. You will likely find many more of the exact same failures in almost all brands of CCFL-backlit displays of that era, because with very few exceptions all commodity displays used the same CCFL inverter design. The biggest problem with this design is that BenQ designed in freestanding 2SC5707 transistors for the (bipolar) power switching, which are designed for 9-W (peak) 15" display backlights. Then they reused the design for 17 and 19 inch displays at higher brightnesses, driving the transistors beyond their design limits. This caused them to overheat (you will see a bit of scorching near those transistors) and eventually fail.
The problem was compounded by a bad default choice of capacitors, which are often faulty as well. These capacitors would get higher ESR which caused the primary power stage to ripple more and exaggerate the overloading of the 2SC5707 transistors. These problems are technically unrelated, but one often leads to the other.
I can't really read your brand and type of capacitor from the photos, but at first glance they look like quality brand and my experience with Dell monitors is that they usually replace the default BenQ choice with better caps. That means that the repair is probably as easy as getting a couple 2SC5707's from eBay and replacing them on the board. The fundamental problem still persists though, and it is advisable to improve the heat dissipation capacity of the transistors by e.g. attaching a bit of copper clad board on the flange. |
H: Can't get output from GP5 and GP3 in PIC12F629
I can't get output from GP5 and GP3 from a PIC12F629 I have. My code is the following:
#include <xc.h>
#define _XTAL_FREQ 20000000
#pragma config WDTE=OFF , BOREN=OFF , PWRTE=ON , MCLRE=OFF , FOSC=INTRCIO
void main(){
TRISIO = 0;
GPIO = 0;
while(1){
GPIO = 1b11111;
}
}
When I connected the resistor and LED to other pins, every LED lights up, except those connected to pin 2 and 4. I verified both the LED and resistor and they are working ok. The MCU is brand new. I even tested this setup with another, used IC before.
What did I do wrong?
Can some one explain what 1b or 0b in GPIO value mean? I guess b could be binary.
Note: My IDE is MPLAB X, XC8.
AI: See the table on page 6 of the PIC12F629 datasheet, it lists GP3 as:
Input port w/ interrupt-on-change
Then again on page 23:
Figure 3-3 shows the diagram for this pin. The GP3 pin is configurable
to function as one of the following:
• a general purpose input
• as Master Clear Reset
GP3 can only be used as an input on this device.
As noted in the comments the 1b prefix is unusual, modern Microchip compilers in the XC range all support the standard 0b as a prefix which indicates a binary radix number.
In your original code you listed 1b11111 as the value for the port. If we read from right to left this would set GP0, GP1, GP2, GP3 and GP4 to the value 1 (but note that GP3 isn't an output, as above). You don't have enough digits to set GP5 to 1.
If you set your output port to 0b111111 you are now setting GP0 to GP5 (again reading right to left). |
H: Multi-cell battery measurement design
The task is to measure the voltage of individual cells in a 48-cell battery pack of AA cells in series.
The measurements serve to log performance statistics, warn the user if/when a cell dies, or that a cell is otherwise unbalanced compared to the whole pack. I'm thinking about how to wire this up to the MCU. My current design idea is as follows: connect the minus of the battery pack to GND, and then place a voltage divider from each tap of the pack towards ground, so that the voltages of the taps are brought within the 0..5V range. After that, place 6 analog multiplexers of 16:1 configuration, so that any two taps can be addressed individually. These two selected channels are amplified with an opamp in differential fashion, and fed to a PIC. The analog muxes, the opamps and the PIC are powered by a battery/LDO combo.
It isn't hard, it just seems overly complicated, so I wonder if I miss a simpler solution?
AI: Use high voltage multiplexers first then get one pair of signals that can be fed into a single (albeit expensive) high-common-mode differential amplifier.
The MAX14802 is an analogue switch (16 channel) that uses 200V technology and typically can be run from +/-100V or +200V/0V or +40V/-160V etc.. Digital interface is 3.3V/5V.
It has a data input that controls which switch is active and using 2 devices you can select the individual battery/cell to be measured. Obviously, for 48 cells you'll need 6 devices but because they are high voltage devices you'll only need one set of high-precision resistors and an instrumentation amplifier to do the measurements.
I think the AD8479 looks like it'll get close to being accurate for the differential/instrumentation amplifier and is only a few dollars. |
H: Zigbee communication outdoors at long distance ( around 1 - 1.5 km)
I am planning to put some control boards around the school campus ( planning to use Arduino board with some add-ons). I would like to communicate with these boards and was thinking of Zigbee.
The distance between two controller boards is around 1 - 1.5 km. However, searched wiki that the distance depends on the line-of-sight of the transmittor.
Outdoors with line-of-sight, range may be up to 1500 m depending on power output and environmental characteristics
The environment I intend for installation has many buildings, thus no "line of sight" between each controllers. So, is there anyway I could use Zigbee (perhaps add I few more points for data collection and transfer)? Or is there any other communication media I could use?
AI: Minimum data rate for Zigbee is 20k bits per second and this dictates the bandwidth of the receiver. The wider the bandwidth of the receiver, the more noise the receiver picks up so running at a smaller bandwidth means that for a given transmit power, the operating distance to the receiver can be bigger.
Received power needed for a given data rate is: -
Power required in dBm is -154dBm + 10\$log_{10}\$(data rate) dBm
So at 20kbits/sec the power needed is -111 dBm but this is really the hard limit and you should always consider what is called as fade-margin - basically add at least 20dB to this figure - this takes you to -91dBm.
The transmitter, in free space (ideal conditions) pushes power from its antenna and the Friis formula that equates power to distance is this: -
Link Loss (dB) = 32.4 + 20\$log_{10}\$(F) + 20\$log_{10}\$(d)
where F is MHz and d is distance between the two antennas (kilo metres).
So if the radio uses 1GHz and was 1.5 km away, the link loss would be 32.4 + 60 + 3.52 = about 96dB. If it's transmitting +10dBm then the power received would be -86dBm. This seems to work because I calculated a 20kbps receiver needed -91dBm BUT again this is a free-space perfect transmission and there are various rules of thumb needed to convert this to "on-earth" with lots of obstacles (this is a very big subject). If you added another 20 to 40dB to these figures you'd be looking at something that should work reasonably reliably.
This means you might need to be transmitting at +40dBm (10 W output power). This is too high for Zigbee so either consider directional antennas that add gain at both transmitter and receiver or consider a mesh network as recommended in the wikipedia link in the question. |
H: PIC12F629 Doesn't react on input
I've build this circuit :
The diode is actually a LED.
With this code on MPLAB x,XC8 :
#include <xc.h>
#define _XTAL_FREQ 20000000
#pragma config WDTE=OFF , BOREN=OFF , PWRTE=ON , MCLRE=OFF , FOSC=INTRCIO
void main(){
TRISIO = 0x001000;
GPIO = 0b000000;
while(GPIO = 0b001000){
GPIO = 0b110111;
}
}
But the GP0(pin7) doesn't react on GP3(pin7) pressed button, why?
AI: You must add a pull down resistor to your button.
The GPIO pins are sensitive to voltages. When you press the button, the voltage (vs GND) at the GPIO is set to 5V, and the MCU will see this. But when you release the button, what is the voltage at the GPIO? 0V? probabliy not, what forces that voltage to be 0V?
When left open, or floating, the value of the GPIO is undefined. It could be 1, or 0. Or could switch quickly (oscillate). On AT Tiny, when left open under some condition the input stage starts to consume a lot of current... (which is bad for a low power MCU...)
Thus, you could solve this by adding a resistor (called a "pull down") between your GPIO and GND (10k is fine).
Or you may connect your button to GND instead of 5V and enable the internal pull up resistor of the MCU GPIO (I don't know if this particular model offers that feature). |
H: Calculation of unknown components in "unbalanced" bridge circuit
A Bridge is a mechanism that is use for measuring unknown values of passive elements in circuit. Generally a DC excited bridge use for resistance measurement (ie. Wheatstone bridge) and AC excited bridge (ie Schering Bridge) for reactive components like capacitor or inductor.
simulate this circuit – Schematic created using CircuitLab
In general use of bridge, whether DC or AC excited, to measure unknown component, one can vary one or two components values. When the bridge is balanced which means Va and Vb in schematic is equal; with proportion of components one can define the unknown value.
Almost any tutorial tells about balanced condition calculations. Of course they are voltage indepedent and with proportion of components one can easily calculate values.
Question is, in the case which we want to find unknown component value without balanced condition(unbalanced condition) of course with measured voltages of Va and Vb, how can we do that?
AI: When a bridge is balanced, you know that there is no voltage between Va and Vb, and as a consequence, there is no current flowing between them as well. This vastly simplifies the circuit analysis, making it easy to determine the unknown component(s) relative to the known ones.
For small values of imbalance, it is possible to linearize the analysis around the balance point, which retains some of the simplicity, but for large values of imbalance, you're forced to do the full analysis of the entire circuit. It can be done, but you've given up all the advantage of using a bridge in the first place. Other circuit topologies would actually be simpler to analyze. |
H: Is this a good layout for a 5A buck converter?
I have updated this question with the suggestions in comments and answers. Make sure you read everything.
I want to make a PCB for a switching regulator (buck converter). It's a TL5001-based regulator, but this doesn't really matter since the layout is about the power stage, which is common to any regulator of this type.
Here's what I got so far:
The basic idea is to make a star ground. The center of the star is the connector on the right, which is the output connector.
I tried to keep traces away from the inductor (it's a toroid but I'm not sure how it affects nearby traces.
C7 is the input capacitor, placed near the MOSFET, to provide enough current during switching.
The small components (C8/R10 and C9/R12) are snubbers for the catch diode and MOSFET. Previous experiences with this circuit have shown I need a snubber, or else I get a ringing about 15MHz. 10nf+56R solves this. The datasheet only talks about a snubber at the diode, not the MOSFET.
There is no trace between the coil and the diode (thin yellow line) because I couldn't find a way to run a low-impedance trace there, so I'll just solder a thick piece of wire in place.
The rest of the circuit is the PWM controller (TL5001) and the MOSFET driver (2N2222/2N2907).
The feedback pin of the IC is not connected, but it's a solder pad (LSP1 on the left) because I would prefer to run a remote sense wire.
Traces will be rounded once i get a more definitive layout, to reduce EMI (I don't know if that's even necessary)
As you can see, the board is also single-layer, as I don't have the capability to do double layer boards at home, so ground plane layer is out of the question
I would prefer answers to stick to the topic here which is the LAYOUT of the board. I'm not interested in answers regarding:
The converter IC: Yes, I know there are better ones that are faster, cheaper, and every other adjective you can throw at it. But I have a few TL5001s.
The MOSFET driver: Yes, i know there are dedicated MOSFET drivers. But this pair of 2222/2907 does the job I need.
Double layer boards: as I said before I don't have the capability to do double-layer at home.
"But you can have them made for cheap!": Yes, I know. I also know I could just buy a converter, and even save myself the headaches. But I CAN'T have boards made (3 month delays at the post and import restrictions).
Anything unrelated to layout of the board.
EDIT:
Here's a schematic. Vout for me is variable 2-12V, Iout is 0-5A.
EDIT 2:
Here's the schematic corresponding to the layout. There are minimal component changes (addd R13, R14 for slew rate limit, R12, C9 for snubbing mosfet).
Edit 3:
This is the final board I built:
Picture of the finished board:
And here's a video of it in action: http://youtu.be/NXNk-duzGrI
AI: Many switched regulators include example layouts, such as the suggested alternative part TPS40200. http://www.ti.com/lit/ds/symlink/tps40200.pdf . The datasheet shows the evaluation module layout and a suggested layout. If you copy that layout then your circuit will probably work.
One thing I found interesting is that switched regulator layouts tend to use copper fills instead of traces to connect high-current paths and simultaneously provide some heat sinking. For example in your layout C10-C12 and the large rectangular component could sit on top of a solid rectangle of copper. Keep in mind that the electrons will take the lowest impedance path. |
H: How to wire 2 Female USB plugs into a "Y" USB connector?
I want to make a USB Y connector from a PC USB backplate it is faster than buying one, fun and educational, (a usb hub is 20 dollars here).
I have many PC USB backplates available to wire into a hub so i had a go:
I wired all the wires of the same color together in Y formation, but i can only use one of the usb plugs at a time, and not both.
Is there a way to switch round some of the colors so that they are useable concurrently?
I thought USB was simply in series / in parallel.
AI: USB is not simply in series or parallel.
You need a USB Hub chip to build what you are trying to build.
Good luck! |
H: How much force does a solenoid really have?
This hopefully isn't too off topic for this forum, but here goes: after many days of tinkering I managed to get a circuit working that, in the end, energizes a solenoid to pull a lever. Sadly, even though the solenoid became energized and pulled its plunger in, it didn't have the strength to pull the lever. The solenoid I used says that it is rated to have a holding force of 1.1 lbs and an operating voltage of 12V.
I gave it 12V, and the solenoid snapped on and pulled its plunger in (it's a pull type of solenoid). But when tied the plunger to the lever, it seemed to lose all strength, not budging the lever at all...not even a wiggle. The same is true if I resisted the movement of the plunger with my hand--or just held it lightly in my hand. It seemed to lack any pull power when there was something there to actually pull. I then upped the voltage by stacking three 9V batteries in series, thinking it might give the solenoid some more muscle--but to no avail.
Is this related to its holding force? Should I buy a different solenoid that can hold more weight? Have others experienced this?
UPDATE
I measured the voltage of the batteries I was using to power the solenoid. It was very interesting. First off, they must have already been drained from powering the solenoid the last time because, although they're relatively new, their voltage from the get-go was reading about 14V instead of the 18V I would expect from putting two 9V in series. I connected them to the solenoid and watched the voltage drop down to less than 2V and continue dropping. So it would seem that at the current that the solenoid needs, the batteries can't sustain their voltage. Perhaps a 12V solenoid can't be powered with common batteries? Or am I thinking about this all wrong and I should expect to see the voltage of the batteries drop when connected to something that draws a current? Especially that much current? Is that normal operation for a battery? Or maybe I need to add a current-limiting resistor, while allowing enough current to go through to power the solenoid?
AI: Force from a solenoid = \$(N\cdot I)^2 \dfrac{μ_0\cdot A}{(2 g^2)}\$
Where:
μ0 = 4π×10-7
F is the force in Newtons
N is the number of turns of the coil
I is the current in Amps in the coil
A is the area in length units squared (cross sectional area of the coil)
g is the length of the gap between the coil and the iron.
If you want to check your solenoids pull force and you know the number of turns and have a good estimate of the "gap" and the cross sectional area of the winding then use the formula.
However, it's notable that force is proportional to current-squared and if the 12V you used dropped down to (say) 6V under the load of the solenoid, the pull force would quarter because the current would have halved. It's also worth noting that the force is inversely proportional to the gap-squared - double the gap and the force quarters. |
H: Digital logic input with very wide input voltage range
We are developing an industrial controls product that will be used to monitor the presence or absence of voltage ranging from 5V to 480V. Since the unit will be generic and programmable, this input may be used in a variety of unpredictable ways.
The problem I have been wrestling with is how to monitor such a wide range of voltages with a single circuit design. For example, if I drive an optocoupler LED directly, I can't get the 5V to turn it on without the 480V destroying it. Voltage regulators typically operate on much lower voltage than 480V, so I'm in a bit of a dilemma.
The industrial controls solutions I've seen get around this problem by saying, "purchase this other model for high voltage input" or "buy this high voltage input converter and add it on." Is that really the only solution here? Am I trying to do the impossible? Any input would be appreciated, no pun intended!
A possibly related question
AI: You should be able to do this if you think of this input voltage as a analog signal. Attenuate it by 100, and you have something in the 0-5 V range. 5 V in results in only 50 mV, but that is still plenty high enough to detect above any reasonable noise floor.
It might be a good idea to run this into a micro to actually measure the voltage, then have the code decide whether the input voltage is really "present" or not. With such a 100:1 range, I expect it's not as simple as just checking whether it's over 4 V, for example, or not. The code can hopefully check what the expected level is, perhaps see that it is fairly steady, or whatever. Keep in mind that a line that is at 480 V when "on", might have more than 5 V of noise on it when off. I think some logic that does more than just a dumb fixed threshold comparison will be useful.
Due to the high voltage, you want to use a high impedance divider else it will dissipate significant power. 1 MΩ top resistor and 10 kΩ bottom resistor sounds like it might work. That's not quite 1/4 W at 480 V in, and of course much less at lower voltages. It also provides 10 kΩ impedance output to drive the A/D input with. |
H: Effects of "loading down" Voltage-Divider Circuits
Hello I am currently a beginner in the world of electrical engineering and would like some help on voltage-divider circuits.
My question mainly concerns the "loading down effect". Can someone please explain what this effect is and what effect it has on a simple voltage divider circuit?
Please try to keep it as simple as possible without going into too much detail, I want to know the main idea behind it.
AI: simulate this circuit – Schematic created using CircuitLab
Here's an example, see if this makes sense.
Consider the circuit on the left. Assume the meter VM1 is perfect- it has infinite input resistance. The voltage VM1 measures is \$ 10V \cdot \$ \$R2 \over (R1 + R2) \$ = 5V
Consider the circuit on the right. The meter VM2 has an input resistance of 1M represented by an ideal meter in parallel with 1M ohms. The equivalent resistance of R4 in parallel with R5 is R4||R5 = \$ R4\cdot R5 \over (R4 + R5) \$ = 90.909K ohms. The voltage VM2 reads is then \$ 10V \cdot \$ \$R4 || R5 \over (R3 + R4 || R5) \$ = 4.76V
The loading down of the 1M resistance reduced the reading by about 5%.
If you've been doing Thévenin equivalents, this should come as no surprise, since the unloaded divider could be replaced by a 5V source with 50K in series, and 1M is 20 times the source resistance. |
H: Schematic Diagram of the circuit
I would like to know what will happen in the circuit diagram below when the switch is on( connected to a voltage source and R1) and switch off(connected to the R2)
My thoughts...
For switch on only the R1 and VT will be left?
for switch off VT and R1 will be removed?
the capacitor will act as a source, am I right?
simulate this circuit – Schematic created using CircuitLab
AI: The way this is drawn R2 does nothing. When the switch is off (as drawn) nothing happens the circuit is incomplete.
When the switch is on you will charge the capacitor until it is fully charged and current will stop flowing. R1 and R2 simply sum to 1 equivalent resistor R. And the charge profile will look like this:
Source: http://hyperphysics.phy-astr.gsu.edu/hbase/electric/capchg.html |
H: How to decide to cuttoff frequecies of filter in case of using ADC( Flow: Analog-signal to ADC to bits to fir_filter to filtered_output)
FIR filter has to be used for removing the noise. I don't know the frequencies of the noise that might be adding up into the analog feedback signal I am taking.
The ADC has takes just a voltage value from a as a feedback and gives 16 bits digitize value as the output. Whatever voltage value I measure on the board using the voltmeter I can calculate it using the 16 bits on my screen (teraterm).
My apparatus consists analog feedback signal then i am using ADC to digitize the value now I have to apply FIR filter to remove the noise, Now I am not sure which noise the noise which added up in the analog signal from the environment or some sort of noise comes there due to ADC ?
Well the voltage which is coming from the Wheatstone bridge is that is affected by some type of noise, if yes how can decide the frequency cutoffs to remove the noise?
AI: There are a couple of reason's you will see a lot of noise with this circuit:
No anti-aliasing filter. You HAVE to put an analog filter (even a simple RC filter) before the ADC to filter out frequencies higher than your nyquist frequency. If you don't do that, noise on these higher frequencies will alias down to every other frequency you look at and mess up your signal.
You are using a differential ADC but you are not putting in a differential signal (you just tied the negative pin to your voltage reference). Also, almost every differential ADC requires that the average of the voltages at the +/- pin ALWAYS fall within a small range, and your ADC is no different (the ones I've worked with just go haywire if you don't). Look at the datasheet for your ADC. Figure 48 has a setup identical to what you are trying to do -- use that setup and you'll be fine
One last note, as a direct answer to your question, selecting a frequency for your filter completely depends on the frequencies you are interested in. True noise is "white" and will have components across all frequencies. The best you can do is to filter out every frequency you are not interested in to get rid of as much noise as possible. If that's not good enough, you have deeper problems. |
H: Can I use a higher ohm resistance relay?
I'd like to build the circuit detailed here, which calls for a 12V DC 260Ω resistance relay:
Looking at some relays, what consequence would using a 400Ω relay have? Would I be able to use one without a problem?
Unrelated: I believe it's a non-latching SPST NO relay that I need here, right? From what I understand, a SPDT can function as a SPST by ignoring one of the pins; is this correct?
AI: The 400 ohm relay will stay closed longer. You should reduce the capacitor by about 260/400, so about 220uF in order to make the time similar.
Yes, you can just ignore the normally closed contact. |
H: How to choose what voltage power supply to use?
I'd like to build a keyboard emulator, and I've found three links that detail the process: 1, 2, 3. Here's the rough circuit:
The thing is, across the various articles I've read, people are using different voltage power supplies. All use DC. Most use 12v, but some reference 5v supplies. Others use 9v or 10v.
My question is: how do I select a voltage to use? I'd like to create the above circuit approximately 5 times, on the same supply.
Batteries would probably be easier - would it be possible to use a single 1.5v AA battery? If not, how many would I need? When would I use AAA's? How long could I expect the batteries to last?
I can of course change the capacitors and relays out, to match the voltage of the power supply.
Some general guidance would also be appreciated! Some background is in my other questions.
AI: It may be possible to use a 1.5v AA battery if you are able to find relays that operate at that voltage. Relays will be the most costly part of this setup, so I'd start searching for relays that you think would operate well for your purposes. The specifications and price on the relays should be the most important consideration in building this. You'll want to find them rated at very low voltage levels as well as having comparable closed switch resistance values to what is discussed in the articles.
Looking at some relays on digikey here:
http://www.digikey.com/product-search/en/relays/signal-relays-up-to-2-amps/1049448?k=relay
there seem to be many relays that have a Turn-On voltage between 1.05 and 1.5 V. If you get one of them, then you can choose your circuit to operate at that low of a level. In short, find a relay you like/have/can get cheap and then build the rest of your circuit around them. |
H: Convert the input of an ATX power supply from 110 V AC to 11-14 V DC
I was just wondering if it is possible to convert an old ATX power supply for my server. It feeds with 110 V AC from the grid, but I want to operate my mainboard directly from the solar battery, which has 11 to 14 V DC.
Could this be theoretically possible?
AI: Yes, it is theoretically possible. But by the time the conversion is done, most of the ATX power supply would have been redesigned. The hard part of it. The hardest change would be the transformer. To give an idea about complexity of an ATX power supply, here's a reference design.
There exist ATX power supplies which run from low voltage DC. These are used in vehicles and other field applications (example). Look for them.
DC to AC inverter could be another option, of course. |
H: What is this Circuit's function? Does it involve Isolation?
My question is: Does this circuit isolate the "X Volts" lines from ground (1) If not, how should I implement an opto-coupler to provide isolation between the data lines ("X Volts") and ground? (Question 1 - Main question)
I briefly looked up the datasheets for both the BAW56 and the GL05T
The BAW56 is a high-speed switching diode? Is this for when one line is in use it will close the other line? (Question 2)
and the GL05T is for ESD/groundloop protection is this correct? (Question 3) It looks like Unidirectional Clamping as shown in the datasheet. So this means no current can pass FROM ground, and only current can pass TOWARD ground once the zener is satisfied?
It doesn't seem to be isolated because I don't see any opto-couplers involved.
Further information:
"X Volts" lines are data lines pulled up (with resistors) to 3.3v
AI: It's simply ESD protection for both of those X data lines. Nothing more.
The GL\$05\$T provides protection against positive transients that exceed the \$5\$V avalanche breakdown of that device, and the BAW\$56\$ signal diodes provide protection for negative transients below the Vf of that diode, which is about \$0.7\$V, so they would start to conduct for any negative transients that exceed \$-0.7\$V.
It's not an isolation circuit, as there is a clear path to ground, therefore it is not isolated, by definition.
how should I implement an opto-coupler to provide isolation between
the data lines ("X Volts") and ground
It's not entirely clear to me what you want to do here, since you have provided too little information about the signal on the "X Volts" lines. If you want to isolate a signal, then there are plenty of opto-isolated signal examples to be found on the web, and the signal lines before the opto-isolators might still require the same ESD protection as your post shows, but you would not send transients into the signal ground, they must only go to the protective ground.
For fast differential signals, you will want to use a digital isolator, such as the Analog Devices ADuM\$1100\$ or ADuM\$1200\$ and friends. Optocouplers are generally too slow for this. For a bidirectional bus like USB you must use a specialized isolator like the ADuM\$4160\$. |
H: How to open 8-pin Mini-DIN female connector?
I have a female connector that looks like this.
I want to use it in the panel of my product, so I have to remove the outer black sheath. Any tips on how I do it? I can't get it to open. Even to solder a wire into it, I need to open it, and I have no idea how to do it... I'm guessing it'll look something like this once its opened.
AI: Take an exacto knife and keep scoring the outside surface (just above the forward arrow). Eventually you will get through the plastic and will be able to pull the sheath back and have access to the pin-out. If you are impatient like me you could use a dremel but you may completely destroy everything in the process. |
H: why in some circuit there is use of bubble followed by bar?
It is a circuit of ring counter. The clock here is negative triggered. but for set and clear it use bubble with bar.What is the need of bubble followed by bar. why it can not use a PRE and CLR (without bar) without bubble. Because both give the same result.
Is there any specific reason for choosing bubble and bar both?
AI: You're asking why there is a double negative.
Typically in a circuit diagram, the elements will be real, purchaseable or manufactureable things. Many logic chips have active-low signals, such as CL(ea)R, so they come with that "bubble" baked in, indicating their inverted logic.
So, when a designer needs a flip-flop which has that active-low input, they will often label the net (wire) with what the signal means for the application, which could mean it too has negative, active-low logic. |
H: Choosing resistor values for inverting amplifier and why?
The gain here is A = -Rf/Rin. However, lets say I want a gain of 10 V/V. Which resistor value would you choose and why?
I know that you could have infinite number of combinations for these resistors but why would some one use specific value. i.e Rf = 100Mohm, Rin = 10Mohm gives a gain of 10V/V but also Rf = 10 ohm and Rin = 1 ohm gives the gain of 10V/V. What difference would it make to the design?
My thoughts say that higher value resistors are not precise so it wouldn't give you precise gain and using lower value resistors sink higher current from the source (Vin). Are there any other reasons? Also, let me know If I am right or wrong as well.
AI: There are downfalls with choosing very large resistors and very small resistors. These usually deal with the non-ideal behavior of components (namely Op-Amps), or other design requirements such as power and heat.
Small resistors means that you need a much higher current to provide the appropriate voltage drops for the Op-amp to work. Most op amps are able to provide 10's of mA's (see Op-amp datasheet for exact details). Even if the op-amp can provide many amps, there will be a lot of heat generated in the resistors, which may be problematic.
On the other hand large resistors run into two problems dealing with non-ideal behavior of the Op-Amp input terminals. Namely, the assumption is made that an ideal op-amp has infinite input impedance. Physics doesn't like infinities, and in reality there is some finite current flowing into the input terminals. It could be kind of large (few micro amps), or small (few picoamps), but it's not 0. This is called the Op-amps input bias current.
The problem is compounded because there are two input terminals, and there's nothing forcing these to have exactly the same input bias current. The difference is known as input offset current, and this is typically quite small compared to the input bias current. However, it will become problematic with very large resistance in a more annoying way than input bias currents (explained below).
Here's a circuit re-drawn to include these two effects. The op-amp here is assumed to be "ideal" (there are other non-ideal behaviors I'm ignoring here), and these non-ideal behaviors have been modeled with ideal sources.
simulate this circuit – Schematic created using CircuitLab
Notice that there is an additional resistor R2. In your case, R2 is very small (approaching zero), so a small resistance times a small bias current I2 is a very small voltage across R2.
However, notice that if R1 and R3 are very large, the current flowing into the inverting input is very small, on the same order as (or worse, smaller than) I1. This will throw off the gain your circuit will provide (I'll leave the mathematical derivation as an exercise to the reader :D)
All's not lost just because there's a large bias current though! Look what happens if you make R2 equal to R1||R3 (parallel combination): if I1 and I2 are very close to each other (low input offset current), you can negate out the effect of input bias current! However, this doesn't solve the issue with input offset current, and there are even more issues with how to handle drift.
There's not really a good way to counteract input offset current. You could measure individual parts, but parts drift with time. You're probably better off using a better part to begin with, and/or smaller resistors.
In summary: pick values in the middle-ish range. What this means is somewhat vague, you'll need to actually start picking parts, looking at datasheets, and deciding what is "good enough" for you. 10's of kohms might be a good starting place, but this is by no means universal. And there probably won't be 1 ideal value to pick usually. More than likely there will be a range of values which will all provide acceptable results. Then you'll have to decide which values to use based off of other parameters (for example, if you're using another value already, that might be a good choice so you can order in bulk and make it cheaper). |
H: How do you visualize negative Frequency in Time domain ?
In the field of Digital signal processing I have seen people using words
Complex signals and Negative frequencies. For eg. in FFT Spectrum.
Does it really have significant meaning in the time domain or is just a part of the mathematical symmetry.
How do you visualize negative Frequency in Time domain ?
AI: FFTs work by treating signals as 2-dimensional -- with real and imaginary parts. Remember the unit circle? Positive frequencies are when the phasor spins counter-clockwise, and negative frequencies are when the phasor spins clockwise.
If you throw away the imaginary part of the signal, the distinction between positive and negative frequencies will be lost.
For example (source):
If you were to plot the imaginary part of the signal, you would get another sinusoid, phase shifted with regards to the real part. Notice how if the phasor were spinning the other way, the top signal would be exactly the same but the phase relationship of the imaginary part to the real part would be different. By throwing away the imaginary part of the signal you have no way of knowing if a frequency is positive or negative. |
H: Using a Zener to protect devices from solar overvoltage
I am making some pretty crude devices that are directly powered from solar panels. The instability is not an issue, but I want to avoid over-voltage.
I am using two 100W panels in series and want to make sure on a very (very!!) sunny day it does not exceed 30V.
If I use a 30V Zener diode alone would that be OK? Looking at the power curve am I right to assume there will be no power if a Zener shorts it? Does the panel try to fix the current so the voltage drops?
This is opposite to a constant voltage supply that would make it blow up? Or have I missed the point?
AI: The zener doesn't "short" the power source (panel), it simply limits the terminal voltage to a fixed value. The zener will be dissipating power equal to the zener voltage multiplied by whatever current the panel can deliver at that voltage (minus whatever current the load is drawing, of course), so it needs to have a suitable power rating.
You can "amplify" the power handling capability of a zener diode with a power transistor, which you can then bolt to a heatsink. Such a setup would be able to absorb the full 100W of the panel if necessary.
simulate this circuit – Schematic created using CircuitLab
This circuit doesn't do anything at all as long as the input voltage is less than the zener voltage. However, once the zener starts conducting, the transistor will also conduct about 50× the zener current, and will dissipate about 50× the power. If the panel can deliver, say, 3A @ 30V, the transistor will dissipate about 88W and the zener will dissplate about 2W. |
H: Is impedance matching a requirement for CAT-5e traces?
I'm building a patch-board for CAT-5e cables, whereby any pin can be re-wired to any other by a set of jumper cables. This is for testing black-box systems where weird things have been done to Ethernet sockets in order to make it difficult for someone to just walk up and plug in a laptop.
I'm in the PCB design phase, and have the following design in mind:
Here's the design I have in mind:
The board is using 0.254mm traces, and the total length of each trace is no more than 25mm. I've alternated the traces on each side of the board to increase clearance between them, and hopefully the PCB itself should provide a little insulation against EM leakage.
I'd like to know if impedance matching is going to be an issue on a standard 10/100 Ethernet link, across this kind of design. Obviously the outer traces are currently about 50% longer than the middle one.
Any other recommendations on improving the design would also be welcome.
AI: About trace length matching:
IEEE 802.3 specifies propagation delay and not distance (see 23.6.2.4 Delay from IEEE standard section 2).
It says that you should have a maximum propagation delay of 570ns for your entire link and also propagation speed per meter should not exceed 5.7ns/m (thus the 100 meter common "limit").
But you are not concerned by these specs (just a reminder, in case you have a long link).
23.6.2.4.3 Difference in link delays
The difference in propagation delay, or skew, under all conditions, between the fastest and the slowest simplex
link segment in a link segment shall not exceed 50 ns at all frequencies between 2.0 MHz and
12.5 MHz. It is a further functional requirement that, once installed, the skew between all pair combinations
due to environmental conditions shall not vary more than ± 10 ns, within the above requirement.
You should retain that the maximum skew allowed on your whole link is around 10% of the maximum propagation delay (570 ns). As you are designing a custom adapter, we will take large margins to simplify computations and consider your adapter is equivalent to 1 meter of link.
So the maximum propagation delay allowed for your segment is 1/100 of 570ns = 5.7ns.
The allowed skew between pairs is 1/100 of 50 ns = 500 ps.
Given your routing specs, the propagation delay of the signal is around 50 ps/cm.
So with a 500 ps allowed skew delay, you can have a length difference of 10 cm.
No worries here.
Also, about EM leakage, 100 Mbits Ethernet signal frequency is 12.5 MHz, even if it is rise time equivalent frequency that matters, you don't have to worry to much if you are following advices given here by Dzarda and dextorb |
H: Can a digital pot and op-amp challenge the performance of a programmable gain amplifier
Currently I'm using a Microchip PGA for applying gain factors of 1, 2, 4, 8, 16 and 32. It's used in a design of strain gauge amplifier. The part number is MCP6S21 and I am happy with its performance in these areas listed below: -
Noise - it doesn't seem to introduce any but there is a large gain stage preceding it. It is specified as having 10nV / \$\sqrt{Hz}\$ but like I say, the circuit isn't challenging in this area.
Input offset voltage is quite good at +/-275uV and I expect, at the output this could be up to 32 times higher on maximum gain. Again, this is easily acceptable for the product.
Gain error is +/-1% - providing this is a stable gain error with temperature then no problem. The MCP6S21 is specified as having a gain drift of ±0.0004% per deg C
Bandwidth and slew rate are flat easily beyond 100kHz at all gains.
The input to the PGA is from an op-amp and the PGA feeds an ADC via a low-pass RC filter i.e. the output isn't feeding a low-load and the input impedance could be a few hundred ohms without too much bother.
There may be better PGAs that are rail-to-rail input/output devices but does a digital pot combined with an op-amp come close to challenging this "moderate" level of performance?
AI: What would you be trying to improve? Performance? Cost? Availability?
There are no guarantees on the noise, the offset drift with temperature, the gain tempco. There is a guarantee on the gain error.
The typical noise is not bad for a CMOS-input type. The typical gain tempco is excellent (4ppm/K), but no indication of the drift with time.
Offset voltage drift with temperature (4uV/K typical, no maximum) looks like the biggest error source to me- though if you have a load cell that's zero'd or tared at every measurement like most bathroom scales, it probably doesn't matter much. Same with the initial offset- it's possible to do 50 or 100x better in those departments with a separate op-amp. To do better in the gain tempco department you might have to go to discrete precision resistors and an analog switch, but that would push the price up considerably.
Sounds like you're really tight for space. Do you really need the PGA or could you just use more bits in the ADC? A (real) 20-bit ADC ("24-bit") would give you a resolution of a few uV in a few V, which is probably at or below the noise floor of that op-amp. |
H: Murata OKR-T/10 pulldown value
On the Murata OKR-T/10, the data sheet specifies a 49kohm pulldown resistor but I've seen people using a 1k. Is there a more correct value or does anything 1k or above work just as well?
AI: I would say that a 49kR is inside the chip and if you want to enable it you need to explicitly drive On/Off High (either by a transistor or a logic signal).
If you use a 1k resistor (pull-up) it will be always-on.
Don't forget input and output caps. |
H: Designing for High Acceleration
I'm looking into designing a board for a robotics application that is going to be spinning very quickly, and am wondering if there is anything special to take into account. It's going to be in the ballpark of 6000rpm, with the edge of the board 50mm from the center. That's a constant acceleration of around 2000g, with shocks of a couple times that. If I shock mount the board, that would reduce the sudden acceleration but not the rotational one.
What should I do differently from normal PCB design? Would through hole be better than surface mount? Which way should I orient the board, so that the acceleration is parallel to the board (preferable) or perpendicular? Which way should I orient components? Would conformal coating or potting be a good idea? I'd prefer not to, both for repairability and because of the weight. At what kind of accelerations would the component internals themselves start to break?
Also, maybe this is the wrong place to ask this, but what's the best orientation for a lithium polymer pouch battery in this environment?
AI: The best advice I can give you is keep heavy stuff along the centreline. This also applies to xtal oscillators you may be using. You might also want to ensure that the mass of elements you use are balanced about the centreline of spin or you might get some heavy-duty vibration.
For small/low mass SMT components surface mount is fine but it might be worth considering glue to add extra bonding - not too much of course because the glue has mass.
Over about 10,000 g we tend to solid pot the electronics and we've not had a problem with jobs shipped over many years up to g forces over 20,000. Connectors (inter-board PCB stuff) can be a bit flaky so use those with turned pins and multi-leaf contacts (at least three).
There is a company in the US called Statek that make hi-G xtals - not cheap but if you want peace of mind I'd consider using them. Alternatively, look at Linear Technology's array of silicon oscillators - they not bad (and no moving parts other than the electrons) - I've been testing one across temperature recently and it stayed within 10 ppm/degC across 60degC.
I've never known the internal wires on a chip to fail. We always try to make sure the acceleration pushes the components onto the PCB but sometimes this is not feasible and then we pot stuff. I believe, at 6000g you should be OK not potting.
Also, It might be worth doing a spin-test on the finished article to check for vibration and anything going wrong. We do that with all our kit. Vibration we fix just like a tyre fitter does - small weights aren't preferred so we usually drill small amounts of metal off the outer casings. |
H: Paralleling Power Supplies
I was just curious. Can one parallel Linear Regulators, LDOs or Switching Power Supply ICs in order to increase total possible power output? By parallel I mean tie Vin to the same rail and Vout to the same rail and duplicate any supporting circuitry (feedback networks, caps etc.).
AI: It depends. The problem is picking a system that causes the regulators to share the current more-or-less equally, given that they won't have precisely the same output voltage as a result of component tolerances, etc.
On approach that works on many circuits is to simply include a small-value resistor in series with each output. Obviously, the drawback is that this increases the effective source impedance of the regulators, reducing the precision of the regulation.
Some regulators (and regulator controller chips) have explicit support for load sharing. See their datasheets for the specific details. |
H: BCD to 7 Segment Decoder Schematic: Need help fitting in page
I am working on the schematic for a BCD to 7 segment decoder right now. I understand the logic, but it is the design of the schematic that I need help with.
Here is my schematic so far:
As you can see, I only have three outputs done and I need to add four more. The problem that I am having is everything is so vertical and there is so much white space to the right. I would like to be able to fit in all in one page without having to zoom really far out, because then you can't read the inputs or outputs. I guess I just feel like there is a more simple or efficient way that I can be doing this. In the truth table we are using 1010-1110 as don't cares, and 1111 as 0 for all segments to be off.
AI: This is a question about being artistic I think but, try rotating everything thru 90 degrees or using net-names to connect things to get rid of the main mass of connections. Not sure if you can use net-names to connect small stubs of wire in your program but I suspect you can. Try this rotated view: -
There is a lot of white space between the parts you've drawn - I'm sure you can cram a few more parts in if you stick with the same diagram philosophy. Alternatively, look up a 74xxxx chip that does the same thing and copy how it portrays its internal logic. |
H: Toggle LED on when Button is pressed PIC
I've got an olimex board with a PIC16LF76(Schematic - PIC IS a different pic):
I'm trying to toggle the LED when the button is pressed down, my C code looks like:
#include <xc.h>
#pragma config FOSC = HS // Oscillator Selection bits (XT oscillator)
#pragma config WDTE = OFF // Watchdog Timer Enable bit (WDT disabled)
#pragma config PWRTE = OFF // Power-up Timer Enable bit (PWRT enabled)
#pragma config CP = OFF // FLASH Program Memory Code Protection bit (Code protection off)
#pragma config BOREN = OFF
int main() {
TRISA = 0x20;
ADCON0 = 0b111;
while(1){
if((PORTA & 0x20)==0) {
PORTA |= 0x01;
} else {
PORTA &= ~0x01;
}
}
}
Whats going wrong(Something similar would work for Atmel AVR)? My compiler is XC8 and I am using MPLabX. I can confirm the switch works, and so does the LED as I have tested these parts of the olimex board individually and independently without the PIC chip in the board..
EDIT:
I've tried the answers supplied still to no avail. Also the LED is on despite not setting it on.
AI: Your problem is probably caused by the analogue module. According to page 84 of the data sheet you linked the ADCON1 register needs to be set correctly to enable digital functions on PORTA.
A value of 0b111 is likely to make your code work (but see other answers about debouncing). Various other combinations of values are available in the table for REGISTER 11-2:
This type of configuration is common on the smaller 12F and 16F devices, which lack the ability to individually select analogue or digital per-pin.
As Spehro notes in the comments there are a number of ways to find which registers are associated with a port. The easiest is TABLE 4-2: SUMMARY OF REGISTERS ASSOCIATED WITH PORTA, which looks like this:
This table becomes even more useful on large devices that have lots of functions such as extended analog features or capture and compare. Many of these need to be disabled after reset (e.g. comparators) and some might interfere unintentionally if misconfigured (e.g. MSSP).
Note that this table also shows that the 16LF76 does not have LATx registers, so other comments above can be safely ignored for this device. |
H: Problems with Atari Punk Console circuit
I am trying to build an APC using the following schematic:
(source: instructables.com)
And the output is having some issues.
Sound only comes out when the rightmost potentiometer is at 0 resistance, and in that position the rightmost 555 heats up rapidly. In any other spot, the speaker simply makes clicking noises.
One possible difference is that I am using TLC555 chips instead of LM555 as suggested in the diagram. Would that make a difference?
AI: Using a TLC555 should not be a problem. The behaviour you observe is a failing of the APC circuit itself.
When the rightmost potentiometer is at 0 resistance, the 555 heats up rapidly because, internally, pin 7 shorts to ground during parts of the oscillation, to discharge the 0.1uF capacitor. With the potentiometer at 0 ohms, this results in a direct short across the power rails and a very large current flowing through pin 7 (as well as a direct short discharging the capacitor). The absolute maximum current through pin 7 for the TLC555 is 150mA. To ensure this isn't exceeded, you could try connecting 220 ohm resistors (I'm assuming a 9V supply) in series with both potentiometers, and also between pins 6 and 7 of the rightmost 555.
Most of the audio range of the circuit is contained within the lowest 20% or so of the resistance of the right-most potentiometer. Try reducing the value of this potentiometer, or connecting a 10k 'fine tuning' potentiometer in series with it, if you want more precise control. |
H: MCLK in I2S audio protocol
I am working with the I2S audio protocol in one of my projects and I'd like to use it in one of my final projects for a class of mine. Quite honestly though, I don't entirely understand the MCLK line. You'd think, "Oh that just stands for Master Clock" and you might be right but since everything has to do with audio and sampling rates, I get confused.
I'm using the CS42436 in software mode: in short it takes in 3 signals (that I'm questioning).
MCLK - Master Clock (Input) - Clock source for the delta-sigma modulators and digital filters.
SCLK - Serial Clock (Input) - Serial clock for the serial audio interface. Input frequency must be 256 x Fs
FS - Frame Sync (Input) - Signals the start of a new TDM frame in the TDM digital interface format.
Can somebody explain how to use these clock signals in reference to this picture?
I know the middle signal is the serial clock, but the other two I don't understand at all.
AI: The top signal is Frame Sync (FS). FS is used to indicate whether the audio is for the left or right channels. Don't think of them as "left" and "right" though, those are just arbitrary names. Think of them as channel 0 (FS clear) and channel 1 (FS set), time-division multiplexed onto a single communications link.
The bottom signal is the serial data that is being clocked into(?) your MCU.
MCLK is not visible in that diagram. It is the clock that is used by the audio codec (in your case, a CS42436) to time and/or drive its own internal operation. It is a relatively high frequency; a common value is 256*Fs (where Fs is the sample rate, e.g. 44.1kHz). Values in the range of 10-60MHz are pretty typical. |
H: 3 phase circuit, 3 x single-phase (hot-hot) loads: what ampacity?
I'm not an electrician (thus the question), but I'd like to know what is possible from a specification standpoint.
Let's say we have a standard 3 phase power supply for a commercial building. We want to supply a sub-panel with 3 phase power and the sub-panel is supplied from a 3 phase 100A breaker.
We want to supply 3 dedicated single phase 208V loads, so we'll be building effectively a "load triangle."
What is the maximum ampacity for each load?
It's confusing to me, because each leg is supplying two loads "half way." So does that mean it's "ok" to use 3 100A two-phase breakers in the sub-panel (assuming the loads are correctly distributed)?
Don't worry too much about the nature of the loads. In fact, they will be EVSEs (electric car chargers). This means they'll have a fairly reasonable impedance match, but be continuous draw (which means they'll actually be derated from 100A by 20%).
AI: 3 times 100A at 120V means you've got 36KW coming into your fuse board.
3 times 57.7A at 208V means you've got 36KW going out of your fuse board.
Assuming your load is balanced, anything more than 57.7A on the load side will be more than 100A on the supply side.
Where I work, we step down the wiring and the circuit breakers so the end points break before the supply points, so for 208V circuits we'd be looking at a 3 phase (3 pole) 50A circuit breaker to break all three circuits if there is an overload on one, or 3 single phase 50A circuit breakers if you can allow single phase loads to fail independantly |
H: Is a N-Channel Mosfet save/reliable for level shifting UART from 3V3 to 5V?
I am busy with a design that needs to connect a Raspberry Pi to an Arduino via UART.
Previously I have designed a circuit that worked okay.
(source: protoneer.co.nz)
But now I want start using SMD components and is planing on using the following component: BSS138BKS + 10k Resistor Bank.
I am not an expert at these things and I am usually use designs from other circuits in my new designs.
My question is, will the BSS138BKS used like in the original setup with the 2N7000 be able to run continuously without issues.
And is this the right way to do level shifting between the two devices? (I don't want to damaging the boards).
Edit: Updated circuit
AI: The BSS138 should work just fine in your level shifter circuit. Just make sure to connect it's G, D, and S pins up in the same method that you used for the other FET. For a level shifter like this it is essential that the D (drain) pin be connected to the side that has the 5V levels so that the body diode in the FET does not go into continuous forward BIAS.
This type of level shifter actually supports bi-directional signalling but will work just as well with the unidirectional signalling of your UART ports.
When you build it up with the BSS138 parts you may want to check the rise time of the signals passing through the level translator. If they are too slow for the baud rate you intend to use you may need to lower the value of the pullup resistors on one or both sides of the translator FETs. |
H: What happens if I omit the pullup resistors on I2C lines?
Just now I realized that the I2C data and clock lines (SDA and SCL) must have pullup resistors.
Well, I've built a couple of clocks using the DS1307 RTC (see datasheet) according to the schematic below. Notice that I have omitted both pullup resistors.
Both clocks work fine, one of them is working for more than 3 months now. How is that possible? In any case, I wanted to know:
What happens when the I2C pullups are omitted?
Is the lack of pullups likely to damage any of those two ICs in my board?
I'm after answers that address my specific case of connecting ATmega328P to a DS1307 RTC like in the schematics I provided, but if the question doesn't get too broad, it would be helpful to know what happens when the pullups are omitted in general, i.e., in other scenarios of I2C operation.
PS. I did search the Net to find the answer, but could just find articles about dimensioning the pullups.
Update: I'm using Arduino IDE 1.03 and my firmware handles the RTC using the DS1307RTC Arduino lib (through its functions RTC.read() and RTC.write()). That lib in turn uses Wire.h to talk to the RTC.
Update 2: Below are a series of scope shots I took to help explain how the I2C is working without the external pullups.
Update 3 (after I2C pullups added): Below is another series of scope shots I took after adding proper (4K7) pullup resistors to the I2C lines (on the same board). Rise times dropped from about 5 µs to 290 ns. I2C is much happier now.
AI: 1) What happens when the I2C pullups are omitted?
There will be no communication on the I2C bus. At all. The MCU will not be able to generate the I2C start condition. The MCU will not be able to transmit the I2C address.
Wondering why it worked for 3 months? Read on.
2) The lack of pullups is likely to damage any of those two ICs in my board?
Probably not. In this particular case (MCU, RTC, nothing else), definitely not.
3) Why was the MCU able to communicate with the I2C slave device in the first place? I2C requires pull-up resistors. But they weren't included in the schematic.
Probably, you have internal pull-ups enabled on the ATmega. From what I've read1, ATmega have 20kΩ internal pull-ups, which can be enabled or disabled from the firmware. 20kΩ is way too weak for the I2C pull-up. But if the bus has a low capacitance (physically small) and communication is slow enough, then 20kΩ can still make the bus work. However, this is not a good reliable design, compared to using discrete pull-up resistors.
1Not an ATmega guy myself.
update: In response I2C waveforms, which were added to the O.P.
The waveforms in the O.P. have a very long rise time constant. Here's what I2C waveforms usually look like
PIC18F4550, Vcc=+5V, 2.2kΩ pull ups. Waveform shows SCL. The rise time on SDA is about the same. The physical size of the bus is moderate: 2 slave devices, PCB length ≈100mm. |
H: What is digital Termination and when is it used?
I have heard transmission line termination but today I came across this "Digital termination" but couldn't find out why is it used and what effect does it have on digital signals?
AI: Digital termination is the same thing as transmission line termination. It's just a nuance that indicates that the goal is to reduce reflections of fast edges rather than match a specific impedance per se, although in reality, they're the same thing.
There are a number of ways to terminate a digital line. If a digital driver has lower impedance than the line impedance, you'll often see a series resistor to make up the difference. On the other hand, digital receivers usually have an input impedance that's higher than the line impedance, so a shunt resistor (AKA "parallel termination") is used.
When using parallel termination, the other end of the resistor is attached to a voltage source. This can be ground, Vcc, or some other voltage in between (in which case, two resistors are used as a voltage divider to create the equivalent Thévenin voltage and resistance).
What you have is an example of parallel termination to ground. |
H: What are advantages of Two's Complement?
In some ADC/DAC devices their are options to output/input the data in 2's Complement form.
What are advantages of representing digital data in Two's Complement form When you can simply have straight binary code and save time of conversion?
AI: Two's compliment representation of signed integers is easy to manipulate in hardware. For example, negation (i.e. x = -x) can be performed simply by flipping all the bits in the number and adding one. Performing the same operation in raw binary (e.g. with a sign bit) usually involves a lot more work, because you must treat certain bits in the stream as special. Same goes for addition - the add operation for negative numbers is identical to the add operation for positive numbers, so no additional logic (no pun intended) is required to handle the negative case.
While this doesn't mean it's easier from your perspective, as a consumer of this data, it does lessen the design effort and complexity of the device, thus presumably making it cheaper. |
H: What actually limits the speed of a USB flash drive?
My system outputs data through USB which is to be stored in a external memory. But it seems that flash drive is not having that much speed like that specified in USB 2.0 protocol.
What actually limits the speed of flash drive?
AI: There are a couple of different limitations that come into play when using USB devices:
The device itself, while it may support USB 2.0 that doesn't mean it will read/write at the maximum speed of USB 2.0 (so device hardware limitations like the flash memory used).
The USB protocol overhead. While the maximum bitrate in USB 2.0 is 480Mbs the maximum effective bitrate for data is 280Mbs or 35MBs (http://en.wikipedia.org/wiki/USB#USB_2.0).
Multiple devices on the same controller. Your computer has a built-in USB hub to allow for more USB ports without adding more (USB) controllers. If another device also uses a lot of bandwidth on the same hub the bandwidth remaining for your USB stick will drop.
Possibly there are more factors in play here but I think I covered the major ones here. |
H: How to understand initialization and stack checking of ARM assembly language
I am trying to understand How bad a 'void main(void)' is from the following link:
tech notes. But I have difficulties in understanding two assembly languages examples, the first one is shown below:
int main(void)
{
return 42;
}
|main|:
mov ip,sp
stmfd sp!,{rfp, fp, ip, lr, pc}
sub fp,ip,#4
cmps sp,sl
bllt |x$stack_overflow|
bl |__main|
mov r0,#42
ldmdb fp,{rfp,fp,sp,pc}^
I have found some explanations from ARM v7-M Architecture Application Level Reference Manual. so I know that stmfd is like PUSH here. But I still have many questions.
Why do we call the first six instructions the initialization and stack checking?
What do ip, rfp, fp, and sl mean?
Why does it sub 4?
What is bllt? I just find bl in reference manual
Where does 'x$stack_overflow' come from?
Why does it use ldmdb?
If you can give me a tutorial or reference manual about ARM assembly languages, I will be very happy. Because I think there is another more difficult assembly language example from that link.
AI: The custom on this website is to ask one question per eh, question, but I'll try to asnwer them all.
why do we call the first six instructions the initialisation and stack checking?
Because that is what they do. These instructions are insterted by the compiler, they are not caused by the C-level statement(s) in the main() that the user wrote.
what does ip rfp fp sl mean?
Looks look aliases (alternate names) for registers that have a specific purpose.
why does it sub 4?
To make room on the stack for something that it is not using. Looks like a missed opportunity for the optimizer :(
what is bllt? I just find bl in reference manual
lt is a condition: on these ARM chips ANY instruction can be conditional. In this case it is branch-and-link-iff-less-than.
where does 'x$stack_overflow' come from?
It is supplied by the runtime library, and called when the stack is (about to be) exceeded.
why does it use ldmdb?
that is the load-multiple-registers-from-a-full-descending-stack instruction. in other words: pop.
PS: for the bare-metal microcontroller softeware I mostly write the requirement that main() must return an int is a royal PITA. There is no OS or script or whatever to return to, so who cares what main() returns? main() should be an infinite loop, but the compiler insists on a return 0; after it. And then it complains about an unreachable statement :( |
H: Astrom-Hagglund Relay PID tuning - relay transfer function?
I'm implementing a PID temperature controller on a PLC. To cut down on installation time (this design may be reused many times), I want to have the PID parameters tuned automatically rather than manually.
To do this, I'm trying to implement Astrom and Hagglund's relay tuning algorithm. Essentially, the control effort is inverted each time the feedback crosses the setpoint (eg, each time the sign of the error changes).
Now, I'm pretty sure that when I do this, I just change the input to the plant back and forth between a positive and negative amplitude. Most descriptions of the method seem to also indicate this. The trouble I'm having is that right next to that description, I always see a diagram that looks like this:
This diagram seems to contradict this idea by seemingly suggesting that the plant input should be the error multiplied by the setpoint value. That is, the output from the relay is
$$
\text{Plant Input} = \left\{\begin{matrix}
Ae(t);\; e(t) > 0
\\ -Ae(t);\; e(t) < 0
\end{matrix}\right.
$$
rather than just
$$
\text{Plant Input} = \left\{\begin{matrix}
A;\; e(t) > 0
\\ -A;\; e(t) < 0
\end{matrix}\right.
$$
where \$A\$ is the amplitude and \$e(t)\$ is the error signal.
Intuitively, the first one seems wrong as this is essentially just a proportional controller, and when the error becomes negative, the double minus sign means control action is still positive. Still, I want to be absolutely sure about this - which one is right?
AI: Your second PlantInput description is correct.
Relay tuning relies indeed on input steps whose sign depend on the sign of the error. An IEEE Control System Society file also graphically shows it.
The diagram you posted is ambiguous, but interpreting the relay block as a sign function rather than a gain (which is usually of triangular shape) would dissolve your confusion and have it agree with your intuition. |
H: How to efficiently implement a single output pulse from a long input on Altera?
I have a fast clock and a switch called 'ready'. When the switch is flipped (ready goes HIGH), I would like the output pcEn to produce a pulse that lasts only for one clock cycle. pcEn will only output another pulse the next time ready goes HIGH again.
The following code simulates correctly, but is unfortunately not synthesizable. Note that space is an important consideration, so I was wondering if it's possible to implement it without using a state machine (which uses a lot of logic elements).
module control
(
output logic pcEn,
input clock, ready
);
always_ff @(negedge clock)
pcEn <= 1'b0;
always_ff @(posedge ready)
pcEn <= 1'b1;
endmodule
AI: My usual technique is to implement a 2-stage synchronizer to bring the asynchronous input in to the clock's timing domain, and then use one more flip-flop as the edge detector. Depending on the logic you use in the last statement, you can detect rising edges, falling edges or both.
module control
(
output logic pcEn,
input clock, ready
);
reg r1, r2, r3;
always @(posedge clock) begin
r1 <= ready; // first stage of 2-stage synchronizer
r2 <= r1; // second stage of 2-stage synchronizer
r3 <= r2; // edge detector memory
end
pcEn <= r2 && !r3; // pulse on rising edge
endmodule |
H: A subsystem with randomised outputs (no microcontrollers)
I'm trying to make a subsystem that has several outputs. By default, all outputs are 0. When turned on, I want it to randomly set one output to 1, and make it stay at 1 until reset (the reset procedure can be anything, but is preferably a pulse). I'm a bit of a newbie at electronics, but I know all of the basics. Apart from the basic components, I have access to 555s and most of the 4000 series.
Preferably, I would like to avoid the use of a microcontroller.
AI: Four possibilities spring to mind:
Your idea of an astable connected to a 4017, might just work, if you use
A trigger pulse of 1000 or more times the period of the astable oscillator (possibly using a 555 monostable to extend the existing trigger pulse)
A thermistor, governing either the frequency of the astable oscillation, or the length of the trigger pulse.
In this case, the tiny random heating/cooling of the thermistor by air currents may be sufficient to produce a random result.
If this doesn't work, a microcontroller is the easiest option (this is probably true even if you have no experience with microcontrollers).
The kind of algorithm that would be implemented inside a microcontroller can be built out of 4000 series logic, but it would not be entirely straightforward. With a handful of shift registers and XOR gates you can build a linear feedback shift register (LFSR), which produces a pseudo-random bitstream. You could demultiplex a few bits of the shift registers to enable one of N outputs (easiest if N is a power of two). You may need to clock the LFSR more than once per output, to avoid strong correlations in the random output.
If you actually need a genuine source of randomness, one low-cost option is to use transistor avalanche breakdown noise to generate a random bitstream, and then use a shift register and demultiplexer again to generate the random one-of-N output. |
H: FR4 measurement tolerances
I am going to get a PCB produced, but was wondering how the FR4 thickness measurements work, i.e. how thick are 1.6 and 0.8 FR4, in millimeters, to a few decimal places?
AI: If you look at the specifications from your supplier, you will see something like this:
STANDARD BOARD THICKNESS & TOL. From 0.10 mm (0.004") to 3.50 mm
(0.138") Tolerance : IPC Class B
The "Class B" refers to the laminate thickness (no cladding), and you can refer to the IPC information for the relevant numbers
To get the overall tolerance for a multilayer board you have to add up all the tolerances of each layer and the copper thickness tolerances. |
H: Measurements with multimeter giving paradoxical values
I study civil engineering (majoring in electrical engineering) and part of the program in my university is a design project. For this project my team developed a PCB and naturally it was full of bugs.
This week we were debugging it and we got a few strange values. After applying a voltage we checked a few lines to see if they had logical voltages on them (referenced to the ground). 2 were really strange. Point 1 had 0 voltage between it and the ground, point 2 had 23 V between it and the ground, measuring the voltage between 1 and 2 with the meter resulted in a difference of 0V. How is this possible?
The issue is already resolved. There was a resistor that was not soldered properly, so the point was floating (as in not connected to anything). After connecting it, the multimeter gave expected values.
To reiterate: how can a badly connected circuit cause a multimeter to contradict itself?
AI: Think of the meter as being a resistor (say 10M ohms) with an ideal meter in parallel.
Imagine now that point 1 is open, point 2 is 23V wrt ground. You will measure 23V wrt ground on pin 2, but anything wrt point 1 will measure zero volts, whether that be ground or your 23V (wrt ground) point 2 or anywhere else.
It's not a violation of Kirchoff's law (KVL) because the meter is not ideal and you're not making the measurements simultaneously.
simulate this circuit – Schematic created using CircuitLab
Looking at the above schematic, if VM2 is an ideal meter and VM1 is a real meter (10M ohm input resistance), then when the switch is in the NC position, VM1 reads 0V and VM2 reads 23V. When the switch is in the NO position, VM1 also reads 0V, but VM2 reads 0V. |
H: Lighting LED using keypad and microcontroller
So I am working with Gizduino (Arduino clone), keypad and led. What am I doing is getting the value of keypressed and then light up the led according to the value (eg., when I pressed 2 on the keypad 2 LEDs will blink). I know this is just basic but please bear with me. I have this code (I will not include some really basic things like keymapping or something that is not related to my question).
int led1 = A0;
int led2 = A1;
void setup()
{
pinMode(led1, OUTPUT);
pinMode(led2, OUTPUT);
}
void loop()
{
char keypressed = myKeypad.getKey();
if(keypressed != NO_KEY)
{
if(keypressed > 47 && keypressed < 58) // is between '0' and '9'
{
if(!mySwitch)
{
num1 = (num1 * 10) + (keypressed - 48);
}
else
{
num2 = (num2 * 10) + (keypressed - 48);
}
if(keypressed = '1')
{
digitalWrite(led1, HIGH);
delay(500);
digitalWrite(led1,LOW);
delay(500);
}
if(keypressed = '2')
{
digitalWrite(led2, HIGH);
delay(500);
digitalWrite(led2,LOW);
delay(500);
}
}
}
What's happening is that when I press '1' in the keypad the first led will blink and after that the second one will too. Why is this happening? Is there a problem in my code?
AI: The equality testing operator is ==, the assignment operator is =.
You are using = instead of == so the if condition returns always true.
This line if(keypressed == '1') assigns character 1 to the keypressed variable, since keypressed becomes a non zero value the if condition is always true.
The code should be like:
if(keypressed == '1')
{
digitalWrite(led1, HIGH);
delay(500);
digitalWrite(led1, LOW);
delay(500);
}
if(keypressed == '2')
{
digitalWrite(led2, HIGH);
delay(500);
digitalWrite(led2, LOW);
delay(500);
} |
H: Howland Current Pump VS Wilson Current Mirror
I am interested on knowing what would be a better solution to create a current source for low current applications (below 20mA), an opamp based current source such as a Howland current pump (link to PDF) using closely matched resistors, or something like a transistor based current source such as Wilson current mirror using matched transistors in a single package.
I am aware that there are a lot of factors that should be considered, to start with, the types of opamps used, the type of load, bjt vs fet, voltage compliance, etc... So in a general way, what I would like to know is if its worth looking into a transistor based solution, does it offer any advantages over opamp current sources in low current applications?, or should one just stick to opamps for simplicity?
AI: You will never get the ac and dc performance with the Wilson current mirror that the Howland current source can attain. Plus the Howland can sink and source current.
For the Wilson current pump, consider the mirroring BJT's constant current region - there is a voltage on the base set by the "other" BJT (that is acting like a diode) and you know that this sets a current into the base of both transistors - look how compliant the graph is - outside the saturation region. It's not really a good constant current source when Vce changes: -
The Howland current pump (on the other hand will have a compliance graph that is as flat as a pancake meaning you can swish Vce around and the collector current will remain really quite flat (dependent on resistor matching of course). |
H: Creating an Arduino-based Gameboy cartridge?
First off, I am not sure if this question fits here, so sorry for any inconvenience, mods!
I've looked over the internet, and I found this pretty little thing called nanoloop, and I've been wondering if I can make something like that myself. As I am pretty familiar with Arduino, I thought that I could make an Arduino somewhat of a Gameboy cartridge, and probably someone on the internet has done it, right?
Wrong. I haven't found a thing in people trying to use Arduinos as Gameboy cartridge processor. So, here comes my question: Is such thing possible? If so, where would one start?
AI: Such a cartridge is essentially a ROM. It gets requests from the CPU in the gameboy for a particular address, and answers with the appropriate data. I doubt whether an Arduino could mimic this process fast enough to satisfy the gameboy CPU: the arduino would have to wait for the read strobe, the sample the (16 bit) address bus, find the data, and put it out (8 bits). But maybe it is possible for clever person with too much spare time. Start with getting the exact timing of the bus. According to wikipedia it is a custom 8080/z80 hybrid, so getting the documentation might be a challenge in itself. Then study the AVR instruction set and see whether you can satisfy the timing. That will definitely require assembly programming. |
H: How does a GPU/CPU communicate with a standard display output? (HDMI/DVI/etc)
I am interested in how the cpu/gpu presents (to whatever equipment that it does) video data after it has been processed.
I have been told that the video is processed by the CPU/GPU and then sent to an integrated circuit by high speed serial that converts the serial signal to an appropriate display output, but I can't confirm this by searching online.
I'm interested in the signaling and can't search for protocols/etc because I don't know what it is that I'm looking for. So does the CPU/GPU interact with video outputs directly (I can find these protocols easily) or is there a "middle man" so to say and if so what is it, type of chip/etc?
AI: The image displayed on the monitor is stored in your computer's video RAM on the graphics card in a structure called a framebuffer. The data in the framebuffer is generally 24 bit RGB color, so there will be one byte for red, one for green, and one for blue for each pixel on the display, possibly with some extra padding bytes. The data in the video RAM can be generated by the GPU or by the CPU. The video RAM is continuously read out by a specialized DMA component on the video card and sent to the monitor. The signal output to the monitor is either an analog signal (VGA) where the color components are sent through digital to analog converters before leaving the card, or a digital signal in the case of DVI, HDMI, or DisplayPort. The hardware responsible for this also generate the horizontal and vertical sync signals as well as all of the appropriate delays so the image data is only sent to the monitor when it is ready for it. In the DVI and HDMI, the stream of pixel color information is encoded and serialized and sent via TMDS (transition minimized differential signaling) to the monitor. DisplayPort uses 8b/10b encoding. The encoding serves multiple purposes. First, TMDS minimizes signal transitions to reduce EMI emissions. Second, both TMDS and 8b/10b are DC balanced protocols so DC blocking capacitors can be used to eliminate issues with ground loops. Third, 8b/10b ensures a high enough transition density to enable clock recovery at the receiver as DisplayPort does not distribute a separate clock.
Also, for HDMI and DisplayPort, audio data is also sent to the graphics card for transmission to the monitor. This data is inserted into pauses in the data stream between video frames. In this case, the video card will present itself as an audio sink to the operating system, and the audio data will be transferred via DMA to the card for inclusion with the video data.
Now, you probably realize that for a 1920x1080 display with 4 bytes per pixel, you only need about 8 MB to store the image, but the video RAM in your computer is probably many times that size. This is because the video RAM is not only intended for storing the framebuffer. The video RAM is directly connected to the GPU, a special purpose processor designed for efficient 3D rendering and video decoding. The GPU uses its direct access to the video RAM to expedite the rendering process. In fact, getting data from main memory into video memory is a bit of a bottleneck as the PCI bus that connects the video card to the CPU and main memory is significantly slower than the connection between the GPU and the video RAM. Any software that requires lots of high resolution 3D rendering has to copy all of the 3D scene data (primarily 3D meshes and texture data) into video RAM so the GPU can access it efficiently. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.