text
stringlengths
83
79.5k
H: Using Audio Cable to connect to computer I have a HB100 Microwave Sensor Module which I am going to use for an experiment, and I want to transfer the data it produces directly onto my computer. Since the output of the device is in the audio frequency range, I want to connect it using an audio cable. But how exactly do I do this and receive the data on my Windows 7 machine? Do I need additional programs? AI: Assumption: The HB100 Sensor Module must include an integrated low-frequency signal amplifier to boost its signal - since the HB100 device itself generates signals of (typical) 200 microvolts peak to peak. Such a small signal may easily be swamped by interference from fluorescent and CFL lights in the vicinity of the audio cable. If the signal voltage is amplified sufficiently, it can be fed into the sound card line-in or mic-in ports of your computer - see the specifications of your sound card to determine which of the ports accepts what signal voltage levels, before actually hooking it up. Sound-cards can accommodate the 25 Hz to 1 KHz doppler frequency range that the device generates. The simplest way to receive this data is by saving it as an audio file using Sound Recorder or any suitable sound recording software on your computer. Processing this data subsequently (or in real-time) will of course require appropriate software to be written for the operating system of the computer.
H: Finding an affordable integrated USB MCU I'm in the early stages of designing a development board around Cypress Semiconductor's PSoC 3 and 5 range of chips. Much like the Arduino, I'd like the programming experience to be very easy, and that means being able to program it and interface with it without having to buy a separate programming cable. I've tentatively settled on a solution similar to the Arduino's: embed a less powerful MCU with built in USB support on the board, and have that MCU act as a USB interface to the main processor. Unlike the Arduino, though, I'd like the communication MCU to act as a programmer via the SWD (Serial Wire Debug) interface. With that in mind, I need an MCU that meets the following requirements: Two U(S)ARTs, one capable of being used for SWD, one as a regular UART for user defined communication with the main MCU. Native full-speed USB interface. Cheap in small-medium quantities (~100). Ideally, no external crystal required for USB operation. Ideally, available in a hand-solderable package. Definitely not BGA, preferably not QFN. Big bonuses would be if it's an architecture with a well supported OSS toolchain or shallow learning curve. Even better (but less likely) would be if there was already example code for implementing an SWD or JTAG programmer on that platform. My current candidates are the ATMega8U2, which meets most of the requirements, but isn't as cheap as I'd like and requires an external crystal, and the C8051T623, which is cheap and meets the requirements, but seems to have limited toolchain support and isn't an architecture I'm familiar with. (Edit: It also seems to be non-stock now, which more or less rules it out.) Can anyone recommend an MCU that meets these requirements? AI: NXP has some USB Full Speed ARM Cortex(M0 and M3) based microcontrollers which start in the ~$1.70 range for low quantity. They do not require an external oscillator for USB and have a dedicated PLL for USB use. For example, the LPC11U12FBD48.(price from AVNET)I would personally avoid using 8-bit microcontrollers these days unless you are going to use very little memory or code space in your application. Cortex M0 based microcontrollers often can now best 8-bit controllers when it comes to power efficiency, too.
H: Do you have to set the TRIS register when using open collector outputs on Microchip microcontrollers? I'm using a dsPIC33FJ series microcontroller from Microchip. It has dedicated open-collector outputs/registers. I've read the documentation and it is extremely brief. Does setting the ODCx register have precedence over the TRISx registers? Or do I need to configure the TRISx registers to some setting as well when I am in open-collector mode? I don't have the hardware to test this right now. Thanks, AI: Think about it. The open drain feature would not work as intended if you had to keep the TRIS bit set. That would keep the output driver high impedence. What open drain does instead is switch to high impedance when the output would otherwise be high, but still actively pull low when the output is supposed to be low. So if you want to use a pin in open drain mode, set the ODC bit to 1, the TRIS bit to 0, and then set the LAT bit according to the data you want. When the LAT bit is 0, the pin will actively pull low. When the LAT bit is 1, the pin will be in high impedance mode.
H: Lithium batteries worries For the last few days I have had this strange fear that an external short circuit would cause an explosive fire of my laptop's Li-ion battery. Three questions: Is it true that lithium ion batteries have protections inside, so that an external short circuit would not cause overheating + explosion (even if you directly connect the +/- terminals on the laptop battery) ? My fear started from the pictures shown in this thread: Is this flux residue or the PCB is burnt?. I worry that the possible repair performed on this motherboard by the factory could be bad, and thus cause a short circuit that would result in overheating+fire in the battery. I have kind of accepted that the brown substance is just flux, but what about the soldering itself. Do you think the risk of a short circuit is higher than normal, considering what's seen on the pictures? Or is it completely unthinkable ? Are you certain that I should simply forget all about this worry? Thanks in advance. AI: 1.) Yes, laptop batteries do. 2.) No, a short circuit is not more likely. No, it's not completely unthinkable, just like it's not unthinkable that you'll get hit by a meteorite. It's just highly unlikely. 3.) Yes.
H: How to control Arduino frequency? I'm porting a code from c in the Arduino platform (I'm using an Arduino Leonardo). I wanto to remote control a camera with an IR LED. The info about the remote control want to emulate here. The code, here. The Burst frequency to drive the IR LED is 32700 Hz, and i'm trying to make Arduino runs at this frequency. I've not an engeneering background so i don't really know what to do. I think i need some kind of delay to make Arduino run at that frequency, there is a note on the frequency in the second link i gave: Before compilation, the microcontroller clock frequency must be specified [...] In case the IR light is visible and the camera not responding: [...] check the program timing. The _delay_us() routines in the code need a proper setting of the F_CPU variable. EDIT: i'm posting because i have tried the code in here but it seems to be some communication problem with the IR signal emitted: not every time the LED blink (i have tested with a cellphone cam and it blinks at specified times) the camera is shooting. AI: The code in your example is written for a 7.9MHz clocked CPU: #define F_CPU 7900000 // clock frequency, set according to clock used! Whereas Arduino runs at 16MHz. Since all delays in the code _delay_ms(HPERIOD); are in milliseconds, you should be just fine by deleting that first F_CPU line from the source and recompiling it. Arduino automatically uses the correct frequency for for your board (16MHz).
H: 5-pole, double-throw relay I am working on an electronics project where I need a two way switch, that can be controlled using an arduino and can be soldered by hand. I tried to Google for it, but without luck. Does anyone know of such a component? EDIT: for clarity: I need to switch between two usb lines coming from a phone. I need also to switch the id line. So usb line from phone -> (usb line 1 OR usb line 2). (USB micro has 5 lines, so I need a five pole, double throw) Here is a diagram of what I mean: AI: USB Micro has the following lines: VBUS (+5v) Data+ Data- ID Ground Of these, ID is generally not carried over a cable: It is either shorted to signal ground (host device) or left open (slave device). It does not carry any data. Both VBus and Ground can be left connected to both endpoints in the scheme, thus reducing the switching requirement to 2 lines, D+ and D-. (Another line for ID if it must be carried across, but never seen that done). This is why USB multiplexer ICs typically carry just 2 channels. There are several USB 2.0 multiplexer ICs that would do the job, for instance Intersil ISL54200, Maxim MAX4906/4907, or Texas Instruments TS3USB221E. A TTL-controlled bidirectional analog multiplexer/demultiplexer like the HC4053 may be less expensive but will not work for this purpose, due to data speed requirements and capacitance matching issues. As noted by others in the comments, USB does not take kindly to endpoints being switched. The USB protocol is not a basic TTL logic connection, it involves identification of the USB device and negotiation of speed (and also current limits). Until this handshake is done, the connection is not done.
H: Need help finding datasheet I have tried searching multiple sites such as digikey, google, bing, even wikipedia for the data sheets of the following Items but can not find them these components are from a seagate barracuda. Diodes (Most likely TVS Diodes) Capacitor (I think) AI: Those look like short code numbers. The full part number doesn't fit on small parts like this, so the manufacturer writes short codes. For example, some MMBT4401 transistors I have are only labeled "2X". In the datasheet for the part it tells you what variants have what codes, but going the other way is nearly impossible without a pretty good idea what the part already is. If you know the manufacturer you can dig around their datasheets for parts of this class and hope to find one that lists the short code you see. You might get lucky with some careful google searches using the code you have in quotes, with "SMD code", or "package code", along with "transistor" or whatever you think the device is.
H: Easiest way to make printing head spray ink? If I have a free-standing printing head including ink tanks, what would I have to do to just make it spray some ink? Are there some standardized signal encodings or something? I'm not talking about generating an "output" with a moving head. Just a free head that should spray some droplets of ink. And where would be a good starting point to find out more about such kind of knowledge? AI: A lot of that is proprietary but I've spent a lot of time reverse engineering print heads and building printers :) Usually the firing voltage is high in the 24/30 V range. If you just want it to spit you can usually drive some current through it at the appropriate voltage and get some ink to come out (I assume you have a resistive head and not a piezo most heads now a days are resistive). I'd start by trying to just pulse some through it as you don't want to hook it up continuously and burn out the head. Your just looking to get a short burst, heat up the tiny element behind the nozzle and get the ink to fire out. Whose head are you using? Actually Printing To actually print something takes more effort, we developed dedicated silicon just to do that. But basically you convert the pixels or dots you want to print into high voltage firing pulses that activate each nozzle. So usually the first step after spitting a blog of ink onto a page is to print out some test pattern by firing multiple nozzles. You'll notice that there are a lot more nozzles than there are pins though :) So to figure out the right sequence you'll need a scope or better yet a logic analyzer. Printing and moving across a page or object? That's a whole different story that will involve some encoders and control loops :)
H: Aren't UBEC's just packaged voltage regulators? I'm working on a project where non-trivial currents (theoretical peak ~6A) are needed at several different voltages. Since this is battery-powered, I initially started looking at finding an appropriate switching voltage regulator. After looking into a couple different ICs, I found that the prices (including all of the additional components) were coming out around $15 to $20. I then stumbled on BECs, which are widely used in the R/C market and seem to effectively be pre-packaged voltage regulators (i.e. including all of the additional components). Here's an example. Although I'm not clear on what the name means (it stands for "battery elimination circuit"), it seems that a BEC would serve my purposes at a slightly lower cost and with a lot less work than creating the circuitry from scratch. Is there any reason why a BEC wouldn't be a viable option for voltage regulation in a non-R/C application? AI: A BEC would work for high-current voltage regulation, with perhaps one caveat: Some cheaper BECs seem to have non-exemplary voltage regulation under load. This isn't just about current or inductive spikes, those actually get handled well because BECs are designed to run motors. The issue is more around sustained currents - the thermal protection kicks in quite harshly once things get warm. This may be a good thing, since the BEC survives the heat easily... or it may not, if a combination of voltage sag and thermal current throttling under sustained load would kill your application. For the price of a BEC, it would be a worthwhile experiment.
H: Arduino as Modbus client with MAX485 doesn't get any response I'm having some troubles trying to query a Modbus server with an Arduino through RS485. I've already succeeded in querying a software Modbus server running on my PC through the USB/COM port using the ModbusMaster libray, hence it shouldn't be a software issue. I read about TTL and level conversions and I put on a circuit like this on a breadboard: Using the same firmware/sketch that worked for the software server, I connected the Arduino pin TX and RX to the max485 and A and B to the Modbus server and I issued several requests. I can see the signals converted by the MAX485 (CPA1114) though the oscilloscope and it seems to be right. The LED on the Modbus server lights on as it sees a Modbus transaction. Still, what I read as result of the request is always 0xE0 (invalid server id) or 0xE2 (timeout). I queried the server with the same equal request using another tool (a RS485/USB converter and CAS Modbus Scanner), and it gives the expected results, that is data 0x01. This is the code I'm running on an Arduino Ethernet (with a display for debug purpose): #include <ModbusMaster.h> #include <LiquidCrystal.h> LiquidCrystal lcd(12, 11, 4, 5, 6, 7); ModbusMaster node(1); void setup() { pinMode(3, OUTPUT); node.begin(19200); lcd.begin(16, 2); } void loop() { uint16_t m_startAddress=1; uint8_t m_length=1; uint8_t result; digitalWrite(3, HIGH); // TX result = node.readHoldingRegisters(m_startAddress, m_length); lcd.clear(); if (result == node.ku8MBSuccess) { lcd.print("DATA:"); digitalWrite(3, LOW); // RX for (uint8_t j = 0; j < m_length; j++) lcd.print( node.getResponseBuffer(j), HEX ); } else { lcd.print("ERR "); lcd.print(result, HEX); } delay(500); } These are the request signals emitted by the Arduino, that always fail to get a data response, and the other tool, that always succeed: Arduino request signal USB/RS485 converter signal Overlap of the two signals Is there something wrong with the request signal? Am I making any mistakes in the circuit or the code? Any pointers would be greatly appreciated. As suggested by Kvegaoro, I got it working by editing the ModbusMaster library in order to switch the D3 pin to the right status at the right moment. For doing so I used some code I found on this post (italian) in the Arduino forum. This is the edit I've done in ModbusMaster.cpp, function ModbusMasterTransaction, starting at line 746: // code edited to work with MAX485: // transmit request UCSR0A=UCSR0A |(1 << TXC0); Serial.flush(); digitalWrite(3, HIGH); for (i = 0; i < u8ModbusADUSize; i++) { #if defined(ARDUINO) && ARDUINO >= 100 MBSerial.write(u8ModbusADU[i]); #else MBSerial.print(u8ModbusADU[i], BYTE); #endif } while (!(UCSR0A & (1 << TXC0))); digitalWrite(3, LOW); // -- u8ModbusADUSize = 0; Note that the D3 pin is then hard-coded in the library so this is not a good design, if someone is going to need this would adjust it better. It works though! AI: I think you have an issue with you line driving RE and DE because you set the D3 line high to transmit, then you issue a modbus function 3 (read holding registers). After this you check if the request was a success and after this you set the D3 line low and you read the response from the library buffer from the node. The issues stands that a modbus transaction includes the master querying the slave and the slave responding which seems to be taken care of by the node.readHoldingRegisters() fucntion therefore the master releasing the RS485 bus should happen within this fucntion not after it. What I guess its the problem, its that the modbus library you used is intended for RS232 as the physical layer therefore you might have to modify the library so the RS485 bus is released as soon as the master completely finishes sending the query Hope this helps
H: AC and DC Resistance I have a few questions regarding my task of calculating AC and DC resistances: If a cylindrical conductor is made of two different materials, would the conductor's effective resistance be the parallel combination of two resistors? Or do I just add up both resistances that each material provides? For finding the Impedance \$Z = R + jX\$ (with \$j = \sqrt{-1}\$) do I use \$R_{dc}\$ or \$R_{ac}\$ for \$R\$ in this equation? I see in some previous questions on the internet that people are saying that AC resistance is always greater than DC resistance due to the Skin Effect. What happens when we factor in the Proximity Effect too? Does this inequality still hold? I would greatly appreciate any input for these questions. I seem to be confused with the differences between AC Resistance and Impedance. Thank you in advance! AI: 1) If you don't know the arrangement, you cannot calculate this. 2) The same equation applies to both AC and DC, in the DC case frequency is zero so the additional component is zeroed. The R in the impedance equation is the real part, the DC resistance. So, at DC, "impedance" = "resistance". 3) Skin effect and proximity effect both depend on the frequency. You can't say AC resistance (impedance) will always be greater. It will depend on the circuit, for instance if there are capacitors in a circuit, impedance can be much lower than DC resistance.
H: Why would you attach a Diode to the base of a BJT? I was looking at a DC BJT setup for sourcing current and came accross this I have never seen a diode attached to the base of BJTs before and was wondering what it might be used for? I believe it might be used for compensation due to effects in temperature, but I haven't seen much info on this or why you wouldn't bridge the voltage at the base of Q1 with a resistor instead. Does anyone have any suggestions to why you might do something like this? AI: It is there to keep the transistor's current less susceptible to temperature changes. In the case of Q1: Suppose that instead of having R1 and D1, Q1base was connected directly to ground. Emitter current would be: $$ I_{e} = \frac{20V - V_{be}}{R_{2}}$$ You can see Ie is susceptible to variations in Vbe, which has a known dependency on temperature (T), so you might as well express it as: $$ I_{e}(T) = \frac{20V - V_{be}(T)}{R_{2}}$$ But with the diode, if they are matched and thermally bonded: $$ V_{diode}(T) = V_{be}(T) $$ So now: $$ I_{e} = \frac{20V+V_{diode}(T)-V_{be}(T)}{R_{2}} $$ Which simplifies to: $$ I_{e} = \frac{20V}{R_{2}} $$ Independent of Vbe, and its variations with temperature. The diode is effectively providing the little voltage offset that would be needed to compensate for Vbe changes with T, in order to maintain a constant current.
H: Using Ethernet Bus While reading about the Ethernet protocol, I noticed that it has bus features like collision resolution. I've only ever seen Ethernet networks using a star topology (a bunch of PCs connected to a switch) or point to point (the switch connected to a router). Can you connect office equipment with standard NICs into an Ethernet bus? And if so, how would it actually be wired up? Can you use standard Cat5e? AI: Yep, believe it or not, the old-school ethernet "hubs" (note, not a switch) would actually just broadcast everything received on any RX pair out all the other TX pairs. As such, you did indeed have issues with collisions. From wikipedia: An Ethernet hub, active hub, network hub, repeater hub, multiport repeater or hub is a device for connecting multiple Ethernet devices together and making them act as a single network segment. It has multiple input/output (I/O) ports, in which a signal introduced at the input of any port appears at the output of every port except the original incoming. A hub works at the physical layer (layer 1) of the OSI model. The device is a form of multiport repeater. Repeater hubs also participate in collision detection, forwarding a jam signal to all ports if it detects a collision. Emphasis mine. There is an article about building a passive hub (that only supports three devices) here. There was a question about this particular passive-hub-topology on electonics.stackexcahnge here.
H: What exactly are the differences between a USB host and device Came across some doubts: What exactly are the differences between a USB host and device? Is it just that who powers the bus? When two devices connect how the device say "hey I will be the host and you be the device?" Can one device acts as a host as well as a device. For example, "A" should act as a device when a USB host is connected, and "A" should act as host when a USB device is connected? AI: What exactly are the differences between a USB host and device? The host initiates all communication on the bus, the device only responds when asked by the host. For Details see the specs on usb.org. When two devices connect [...] One must behave as the host and the other as the device. Details can be found in the USB OTG Specs. Can one device acts as a host as well as a device? For example, many Android phones and tablets can (requires Android 3+). The "magic" is in the On-the-Go cable/adapter, which switches the phone into host mode by pulling the ID pin to GND.
H: Did I use this optocoupler correctly? I'm planning on using this optocoupler in a PCB I'm making. I've never used one before so I want to make sure I'm doing this correctly and got the right numbers off the data sheet. The image below is a simplified version of how I set it up. If I read the data sheet correctly the LED has a 3mA max current and around 1.0V forward voltage. The 1.8K resistor should limit the current to about 1.5mA. Then a 100 ohm resistor on the collector to keep it well below it's maximum of 10mA with a bit of room to use higher voltages if I want to in the future. It will always have a 3.3V signal but I'd like to have the option to use different voltage motors and servos on the other side. AI: It seems you have it hooked up right. This only puts about 1 mA thru the LED, so the output current will be similarly limited. At 1 mA you only get a current transfer ratio of 63% or 100%, depending on which variant you are actually using. Even at 100% though, that will only cause the 100 Ω output resistor to rise by 100 mV. You need a much larger output resistor for this optocoupler to make a normal digital output signal. Also note the speed of this coupler. It is not well specified. The worst case is 2.8 µs typical at 2 mA drive and 100 Ω load resistance. You need to figure rather more than that with a larger load resistor to get a full digital output signal. If 10 µs is a significant fraction of your PWM period, then this is not good. Overall, this is not the right optocoupler if you want a normal digital output signal or are trying to pass a PWM signal of more than a few kHz.
H: Why is ISE / XLS is mapping a signal to the global clock GCK0? I've synthesized a design for a Coolrunner II CPLD. I intend to use the CPLD's internal clock. I have an input named CLK. I look at the fitter report and I see this: ** Global Control Resources ** GCK GSR GTS DGE Used/Tot Used/Tot Used/Tot Used/Tot 1/3 0/1 0/4 0/0 Signal 'CLK' mapped onto global clock net GCK0. ** 16 Inputs ** Signal Bank Loc Pin Pin Pin I/O I/O Name No. Type Use STD (snip) CLK 1 FB2_7 43 GCK/I/O GCK LVCMOS18 KPR Of course, CLK is indeed the name of the input I'd like mapped to the clock. But how did it know to do this? One 'gimme' is that CLK is a standard name and XST made a good guess. So I renamed every CLK signal in the design to 'XXX'. I re-synthesized (?) and now the report says: Signal 'XXX' mapped onto global clock net GCK0. So what gives here. How is this working? All that being accepted, will XXX now be the hardware clock, or is there some other step I must take? EDIT: where XXX is used. always@(posedge foo) //create 1 and 2 pipe delays of inputs begin aq2 <= aq1; aq1 <= aquad; bq2 <= bq1; bq1 <= bquad; end This is in a quadrature decoding module. XXX is passed as an argument. foo is XXX here. Of course, this is just Verilog, I don't know what it's doing under the hood. Edit 2 - enlightenment has occurred. I have misunderstood what GCK is. I thought it was a clock signal generated by and internal to the CPLD. It is not. The GC stands for 'Global Control'. It's an architectural mechanism that allows a signal to be propagated around the CPLD's macrocells at very low cost and low skew. It's a network, not a clock. The CoolRunner II does not have an internal clock. I will have to conjure a clock and connect it to pin #43 (the GCK pin) of my xc2c64a CPLD. AI: Without knowing more about your design, we can only guess. Most likely, you connected the CLK (or XXX) signal to the clock pins of one or more flip-flops. That is probably enough for the tool to recognize it as a clock and route it on the global clock routing. In a comment, you add: it's hard to imagine how a designer could make the leap that any CLK pin should be connected to a real clock. There's no requirement that the signals on the GCK nets be "real" clocks, meaning periodic signals with 50% duty cycle. What distinguishes GCK nets is that they have high fan-out, across the whole chip (not just one region), and they have dedicated routing resources (switches) that can connect them to the clock pins of the flip-flops. So when you route any signal to the clock pin of a flip-flop, the synthesis tool will see that as a candidate for a GCK net. If you have fewer nets connected to flip-flop clock pins than there are available GCK nets, it will probably route all of them via GCK resources. If you have more nets connected to clock pins than there are GCK nets, it will probably prioritize the ones with the highest fan-out. The tool might also prefer to route clocks on GCK nets, in order to keep other routing available for logic signals that can't use those resources. This can actually be a problem in some designs. GCK nets have the best propagation delays for nets with very high fan-out. But if your signal actually has low fan-out it might actually be faster to route it on regular logic routing or a regional clock net (I haven't gone back and looked exactly what kind of routing is available in Coolrunner-II). Nonetheless the tool might choose to route clock signals on dedicated clock nets. A synthesis or place & route directive may be needed to get the best performance in these situations. Of course, the synthesis tool is extremely complicated and we can often only guess what's going on under the hood. You may be able to concoct a situation where the tool fails to recognize a clock and doesn't use the GCK nets. For example, if you route a signal to both clock pins and combinatorial logic, that might change the tool's understanding of its function.
H: Single Phase fan induction motor current flow I have dissemble a induction motor in a fan. It look like follows. I have no expereince in this field. When I tried to understand it's current flow, I got these questions. What is the main winding and the auxiliary winding ? I guessed inner winding is the auxiliary winding and outer winding is main winding. Is my guesses are correct? Please clarify for me. And I have marked electrical degrees on the rotor like bellow, Am I correct? again I need some clarification. AI: Ceiling fan has a split phase motor, which is developed by two windings and a capacitor. Right at the time of starting the fan the inner winding will be active. While running the outer winding will be in function. Different speeds, usually use a switch to select from several capacitors. An exception is when a wall mounted PWM control is used for speed. Your phase angles are correct for the magnetic field of the inner windings. I am not sure what information will be of use, so I hope this will be of some help. A capacitor in series with one set of windings, shifts the phase of that set of windings, as compared to the set of windings that do not have a capacitor in series with the power line. This phase difference can be compared to “quadrature” field, creating direction. When current flows in one set of windings it creates the magnetic field. The capacitor will keep its set of windings out of phase with the other set of windings. Adjacent coils in one set of windings will have the opposite polarity (180 degrees difference). While the other set of windings will have a phase difference nearing 90 degrees. So, if any coil of either set of winding is defined as phase zero, the adjacent coil in the other set of windings will be at either 90 or 270 degrees. The coil adjacent coil to the coil defined at phase zero, will be at 180 degrees. Electrically, 90 degrees latter, all the fields shift to the opposite set of windings. This is what shifts the magnetic fields by one half the coil width in any one set of windings. This creates, in effect, a rotating magnetic field, that induces rotation of the armature.
H: Speed control of a DC motor using variac I have a offset printing machine and it's original electrical design uses a variac device to control it's speed (RPM) value of the main motor drive. I don't have access to any electrical wiring diagram, so I need to find it's typical wiring diagram from variac device to motor. bellow picture is the front side of the variac. I got four wires going into DC motor. And above is the backside of the variac device and it seems to me that, it goes through a inductor depicts as in bellow figure. What is the original purpose of that inductor? Is that a interpole motor which used to reduce the spaks on amateur brushes? Or is that for another purpose? I need to know it's typical wiring diagram. How could I simply connect a DC motor to a variac? --Thanks in advance-- EDIT: I confirm that this is a DC motor, there are 2 rectifiers like these. AI: For safety, mechanically disconnect the motor from the printing press. Some printing equipment can pretty much self destruct if run backwards. AC/DC motors have brushes. Speed is controlled by voltage and physical load. Generally two wiring schemes are used, parallel, and series. Series wired, have good starting torque, and poor speed control, so should not be started without a physical load. Common series examples; car starters, vacuum cleaners, hand power tools. Parallel wired, have better speed control, and lower starting torque. Investigate the motor wiring. An ohm meter reading of each pair of wires will help. Many AC/DC motors have access to the brushes on the outside of the motor. If this is the case, carefully remove one of the brushes (paying attention to how it is installed). Then re-test the wiring, to identify which pair power the armature through the brushes. The press manufacture may be able to help, if they originally installed the motor. If all else fails, plan on parallel wiring for the motor. Many armatures have very low resistance, so would draw excessive power on starting. The inductor may have been wired in series with the armature to reduce the starting surge. Some printing equipment starts at a lower speed, then comes up to running speed. The variac may have had an automatic power reduction mechanism when powered off, so when started, it would start slower (lighter load), then come up to speed. If this is a small press, the operator may just set the speed and have a start/run switch. The motor wiring also determines motor turning direction. Verify motor direction, before mechanically reconnecting. Once connected, turnover the press by hand first, to see nothing is binding before power is applied.
H: Repeating the same interrupt in AVR Suppose, AVR microcontroller is handling an interrupt. Interrupts disabled. At this time the same interrupt occurs. Will microcontroller handle the interrupt again after return from the first handler? If "yes", then how can I avoid this? (I want to use INT0 interrupt (on low-level) with a button. But because of bouncing the interrupt can occurs again when microcontroller handle it.) AI: In general, interrupts are disabled when the processor enters an interrupt handler, and automatically re-enabled when the interrupt handler returns. (See CLI, SEI, and RETI instructions in the manual for more info). When the external interrupt is fired, the interrupt flag INTF0 in the EIFR is set to 1. When interrupts are enabled and this bit is 1, the processor enters the interrupt handler. Inside the interrupt handler, this bit could again be set to 1, but the interrupt won't re-occur until after interrupts get re-enabled. You can also explicitly clear this bit to 0 by writing a 1 to the register. If you were inside the interrupt handler, an external event sets the bit, and you clear the bit before returning from the interrupt handler, than the interrupt will not be triggered again. However, note that you can't actually set or clear INTF0 if you're using level-triggered interrupts -- it just matches the state of the pin at all times. If the pin is low, and interrupts are enabled, it will trigger the interrupt again. The only way to stop that is to disable interrupts (either globally, or by masking off the particular INT0 bit in EIMSK).
H: Could I replace a diode with a BJT in a pinch? I'm trying to learn the device physics of these transistors. If I were out of diodes and really needed one to complete my circuit, could I just replace the diode with the emitter and base of a BJT? Or is the idea that BJTs are made of diode junctions just an analogy. AI: What you can do is replace a diode with a diode-connected BJT: a two-terminal device made by tying the base and collector together. Sometimes diodes are made this way on integrated circuits. One good reason for actually using a BJT as a diode is that you can closely match another BJT of the same type. This is useful, for instance, if you're trying to build a current mirror with discrete components. If both devices have identical voltage-current curves, and are close together (thermally coupled) then the mirroring is accurate and, free of thermal runaway. Note how current-mirror circuit schematics show a diode-connected BJT, rather than a diode. By the way, with some resistors, you can turn a transistor into another two-terminal device, the VBE multiplier (a.k.a "rubber diode"). By varying the resistor values you can make the rubber diode exhibit different voltage drops. The diode-connected BJT can be regarded as a special case of the rubber diode, where one resistor is infinite (because there is no connection from base to emitter) and the other is zero ohms (base is tied to collector). But the question asks, why don't we just use the base-emitter diode in isolation (leaving the collector disconnected). While that will work as a diode, the diode-connected BJT has the advantage that most of the current flows through the collector. In the diode-connected arrangement, the BJT is prevented from saturating, so the current splits between base and collector according to the transistor's beta. If you use only the base and emitter terminals, then you're only pushing base current. Transistors are usually constructed with the assumption that the base current (and hence handling ability) is small compared to collector current. (The diode-connected transistor doesn't saturate because the collector and base diode cannot forward bias. Transistor saturation occurs when both diodes are forward biased.)
H: How to fix my designed calculator circuit using Logisim I am trying to design a calculator circuit that adds 2 four-bit 2's-complement binary numbers as its input and outputs an 8-bit 2's-complement number when the control bits equal 01. Here's what I have done so far using a software called Logisim. I am really stuck when I found out that I cannot put the other 4 output buttons (colored in blue) in my full adder. I am stumped on how to approach this problem now. I have tested a few 2's-complement numbers and got the output I wanted and some 2's-complement numbers that did not go so well like (having 0100 as the first input and 0110 as the second input did not give me 1010 but gave me 1011. I just need help, suggestions and guidance on how to move forward. AI: You have a 4-bit full adder, so far OK. Then you connected a control input to the carry-in of the lowest bit. When you keep that control at 0 you still have your 4-bit adder. When you put it at 1 you will get the addition + 1, just as you described. Putting an inverter after the first output bit will 'solve' this ONLY for additions that had a 0 in the lowest bit (go figure out why). If you want the control = 1 to give you the addition, and control = 0 must give 'something else, does not matter what' you could put the inverter in the control line. BTW a 4-bit added will give you a 5-bit result. If you need an 8-bit 2s-complement result look up 'sign extension'. (This smells of homework, so I won't give away everything.)
H: TTL RS-232 current limiting I'm making software UART (TTL levels) on ATtiny85. Need I connect current-limiting resistor to output (TX) port? If "yes", what value should I use? I plan to connect my device to a UART-USB converter (on PL2303, FT232, etc.). AI: No, you can connect the ATmega directly to the FT232 etc. In general, a TTL or CMOS level output does not need a current limiting resistor when connected to an equivalent input. Reasons to include a current limiting resistor can be damage limitation when the output is accidentally connected to ground, power, or another output damping of oscillations & limiting edge speed, both mainly for relatively long connections (not likely to be needed for the design of average PCBs)
H: How does this LM386 circuit boost bass? I'm just starting out in Electrical Engineering and was wondering if anyone could clarify a question about the following RC circuit regarding the LM386. My question is about the following circuit: How has adding such a small value cap (between pins 1 and 5) in parallel to the internal resistor of the op-amp boosted the bass? I have been reading the data sheet; under gain control it says the following: Additional external components can be placed in parallel with the internal feedback resistors to tailor the gain and frequency response for individual applications. For example, we can compensate poor speaker bass response by frequency shaping the feedback path. This is done with a series RC from pin 1 to 5 (paralleling the internal 15 kΩ resistor). For 6 dB effective bass boost: R . 15 kΩ, the lowest value for good stable operation is R = 10 kΩ if pin 8 is open. But I do not understand how it works, as far as I knew the bigger the cap the less capacitive resistance it has, so wouldn't a small cap (0.033 µf) as in the diagram be more resistive to bass frequencies? I know I have misunderstood something here. All help appreciated. AI: Think of it this way, at low frequencies, the external series RC network is effectively an open circuit so the amplifier behaves as if the network were not present. At high frequencies, the RC network is effectively just the 10k resistance. Looking at the equivalent schematic in the data sheet, note that this 10k resistance is in parallel with the internal 15k feedback resistor. So, instead of a 15k feedback resistor, there is, at high frequencies, effectively just a 6k resistor , i.e., there is more feedback at high frequencies and thus, reduced gain. In fact, rather than boosting the gain at low frequencies, the addition of the RC network actually reduces the gain at high frequencies. The effect on frequency response is equivalent; the bass frequencies are amplified more than the high frequencies.
H: What is the cheapest way of producing audible sounds? I am in need of producing an audible sounds in my circuit, when instructed by a microcontroller which it is attached to. So far, the cheapest way I have found is to use a piezoelectric style buzzer, but want to know if there are even cheaper alternatives. I need the sound to notify the user that the device is on by beeping (relatively quietly) every few second. Therefore, the decibel level of the sound is not a big concern. If piezoelectric buzzers are the best way of doing this, is there a specific type of them which are lowest in cost? Edit: I just thought of using headphone speakers (really cheap ones may do as well) to produce the simple beeping noise. Now I am not sure if I could buy such small speaker modules (don't know if that's the correct word) separately. But I did find this older question and I will look into the method to see if it satisfies my needs. AI: If cheap is what you're looking for (and face it, we all like cheap) and if you're only building one or two of these, look around your house for a noisy item and salvage the components from it. Edit – now I see the volume you need. Check overstock and salvage sites. And remember, if you're making a business case, take shipping cost (and time!) into account, and take 'salvage time' into account. Sometimes it's cheaper to just buy the blasted things at retail prices and move forward. Edit 2 - I assume there is circuitry. Look into having your boards produced for you. That way assembly time is reduced and quality is increased. http://www.expresspcb.com/ExpressPCBHtm/Costs.htm https://www.protoexpress.com/ They might seem a little pricey but someone has to assemble the boards. If this is supposed to be a sustainable business (your question doesn't say why you're asking...) then you can't depend on you or your buddies to produce the boards for free pizza.
H: Automating button presses I'm working on a project which involves automating the pressing of some buttons on a device. There are five push buttons, which are quite stiff and require fast repetitive presses - around about ~7Hz with 50% duty cycle. I also have one toggle switch that needs to be switched at a rate of ~10Hz. My first thought was to use servos, but the ones I have seem to be too slow and weak for the push buttons. They don't quite get the speed I need for the toggle switch, either. I don't want to spend a fortune on expensive servos, so I figured there might be an alternate method using cheap motors and a rack-and-pinion setup. The idea would be to have one fast servo for the toggle, and a bunch of cheap motors with a vertical rack to press the buttons. Are there any alternatives to this approach? Am I missing any obvious methods to automate this? AI: This isn't really an electronics answer, since you can't modify the device to simply replicate the button and switch contact closures electrically. This sounds like consumer products testing to me. You may want to look at what consumer product test houses do to automate the actuation of devices without modifying them. For your application, I would suggest one of two approaches: Solenoids. Use direct acting, spring return solenoids for the button presses. The spring rate will determine the maximum actuation frequency. If you can tune it for resonance, you can reduce current requirements. For the toggle, use two opposing solenoids with series springs - i.e. actuate the toggle through the spring such that you limit the maximum force on the lever and don't have to constantly adjust the assembly. Pneumatics. If you've got compressed air available, going with pneumatic acutation will allow you to actuate each point elastically (air is compressable, so pneumatic actuators have inherent compliance) and with controllable force (vary the air pressure). This would mean that you could use a much smaller power supply, as you'd be driving small solenoid valves rather than potentially large plunger solenoids. Sounds like an interesting project.
H: Question about trace length matching patterns for high speed signals A colleague and I had a discussion and a disagreement about the different ways high speed signals can be length-matched. We were going with an example of a DDR3 layout. All the signals in the picture below are DDR3 data signals, so they are very fast. To give you a sense of the scale, the entire X axis of the picture is 5.3mm and the Y axis is 5.8mm. My argument was that, length matching done as in the middle trace in the picture can be detrimental to signal integrity, although this is just based on an intuition, I have no data to back this up. The traces in the top and bottom sides of the picture should have better signal quality, I thought, but again, I have no data to back this claim. I would like to hear your opinions and especially experiences about this. Is there a rule of thumb for length matching high speed traces? Unfortunately, I could not simulate this in our SI tool because it is having a difficulty in importing the IBIS model for the FPGA that we're using. If I can do that, I'll report back. AI: Your intuition is correct, depending on edge speed and how close those serpentine paths are you can cause your self problems. They absolutely will couple to each other like you're wondering. In fact if it's tight enough the high frequency component may just couple straight through the S curves like they aren't even there. The question then becomes will that coupling be a problem in your application. They look far enough apart in that picture for DDR3 but it's hard to tell. Of course simulation of the path would always be best, but I know we don't all always have access to expensive tools when we need them :) You seem to be on the right path though. Here's Johnson talking a little more about it.
H: Suitable small/fast EEPROM for Atmega328 Looking for recommendation on EEPROM chip, which I can connect to Atmega328. The requirements are: at least 5-10Kbyte fast reading with Atmega. I expect reading one word about 1-5us, please advise if it's possible. I am going to store set of custom data structures and read them in the loop every 200ms. AI: Sounds like you're just looking for nonvolatile storage, not necessarily an EEPROM. Consider FRAM, like the FM25V01. That particular chip stores 16Kb (larger sizes are available), has an expected endurance of one hundred trillion reads and writes, and has an SPI interface that can run at 40 MHz. Your limiting factor here would probably be the ATMega328 speed.
H: Encoding delay of Ethernet and the relation to cable frequency rating I asked a question here called "Speed of electricity (signal propagation?) through copper for communications delay". I wanted to know how long does it take a signal to travel down a length of Cat5e cable (my background is telecomms and networking for this question). In the opening paragraph on this Wikipedia page it states the following about Cat5 cable; "The cable standard provides performance of up to 100 MHz" In my previously referenced question I was pointed to a general rule of thumb for wave propagation which was between 4.9 ns/m and 5.3 ns/m. 100Mbps data transfer over Cat5 cable means 1 bit of data is encoded onto the wire every 1 second / 100,000,000 bits = 0.00000001 ns (that's 1 bit every 10 ns). From this I assume that the receiving device will expect and receive and decode bits at a rate of 1 every 10 nanoseconds. If the delay down the coper wire (between 4.9 and 5.3) is less than the encoding delay though, surely bits will be being received too quickly at recipient end, faster than they can be decoded into a digital stream which could be buffered? Also to tie this all together, I have assumed that cat5 is rated for 100 Mhz because that means in each cycle 1 bit of data is encoded onto the wire. Or does this 100 Mhz represent something else? Cat6 is used for gigabit transfer rates (or cat5e) with a frequency of 250 Mhz. Presumably this is just because fancy encoding methods are used to encode more bits into a single symbol on the wire. So, the 100 Mhz reference above from the wiki article is the reason it is a one to one ratio for encoding data onto the wire so we end up with a 10 ns encoding duration per bit. Is that correct also? AI: If the delay down the copper wire is less than the encoding delay though, surely bits will be being received too quickly at recipient end, faster than they can be decoded into a digital stream which could be buffered? I think the key point you're missing is that it's entirely possible for more than one bit to be "in flight" on the wire at any given time. For example, if the wire is 100 m long, and the velocity is 192 x 106 m/s, and the bit rate is 100 Mb/s, then 52 bits of data will actually be "on the wire" at any given time. The receiver, however will only be aware of the 1 bit that is actually arriving at the receiver at that instant. If the transmitter is sending bits at 100 Mb/s, then the receiver must receive and decode these bits at 100 Mb/s. The length of the wire changes the latency time between these two events, but it has nothing to do with the rate at which the receiver must deal with the incoming data. Usually the receiver doesn't deal with the incoming bits one at a time, doing calculations at 100,000,000 operations per second. Instead it simply queues the bits up into something like a shift register, and then operates on them at a much lower rate, maybe 12.5 million operations per second, but operating on full bytes with each operation (or even at slower rates, but operating on larger data words).
H: AC Voltage source terminal polarity and grounding Ill try to make it as clear as possible. This may seem like a simple question, but it is something that I havent quite figured out. It has to do with polarity on the leads of an AC source. Every book I read, pictures an AC source with two leads such as this: Now, on the books, I see that the + symbol is used on upper lead, and the - at the bottom when they are picturing the positive half of the waveform, and they use a - symbol on the top and + on the bottom when they are picturing the negative half of the waveform. So far so good. Here are the 3 scenarios and the thing that really confuses me: Is only one lead changing voltage while the other stays stationary at 0V, meaning that the upper lead will go from + to - and from - to + and so on while the lower lead stays at 0v? Or For the positive part of the waveform the upper terminal will be + and the lower 0V, and for the negative part of the waveform the lower terminal will be - and the upper 0v? Or The upper terminal will have an alternating current and the lower terminal will have a mirror signal with opposite polarity? in which case, where is my 0v reference? Comparing it to the AC wiring on any house, theres 1 cable which is "Hot" and the other which is the "neutral", I know the neutral doesnt carry any voltage and its the 0v reference, so the HOT cable is the one which changes its polarity. Now, what exactly happens when I ground something? for example what is the difference of having that 0v floating or connected to ground, and what happens when I ground a circuit at something else rather than 0v? For instance say I have the following circuit: An ac source feeding a transformer, there are a couple of resistors across its secondaries and the mid point between the resistors is connected to ground. So let say that the transformer has a 1:1 ratio and both resistors have the same resistance, 100ohms for this example, that means they will form a voltage divider of half the total voltage. I know all that because thats how they thaught it to me, what I dont know is this, if ground potential is 0V, and my transformer's (bottom lead) is at 0v, why will I get a voltage at point B with respect to ground? I get very confused between the diference of 0v and ground reference, and when I see circuits like the previous one which are grounded at some place different from 0V, specially on AC circuits. On DC it makes sense, if I ground the negative side or 0V side, I will have a positive voltage, if I ground the positive, I will get a negative voltage. But on AC it confuses me the fact that I dont know if the only alternating current is on one side of the terminals or if the 2 terminals are switching between each other. It seems like on some cases its only one side (like in a house electrical installation) and on others like in a balanced push pull circuit its both sides. It seems I dont have a clue of how exactly AC works. AI: The key is to realize that there is no such thing as 0 volts in an absolute sense. Voltage is a measurement of difference in potential between two points. You can say that something is 0V with respect to something else, but you can't say that a conductor is at 0V without including a reference. Consider a bird sitting on a high voltage power line. The power line and bird are both at 13,800V relative to the ground, but the bird is at 0V relative to the wire. To answer your question about AC, the AC source provides a potential difference (voltage) between the two conductors. It alternates in the sense that sometimes the first conductor is at the higher potential, and sometimes the second conductor is at the higher potential. "Higher potential" is an absolute concept; current will always flow from the higher potential to the lower potential if you were to connect them with a wire. For a floating AC source like you've depicted (or a transformer), there's simply no concept of 0V until you define one. And you can define that any way you want: call the bottom terminal 0V, then you're in your first scenario. Or call whichever terminal has the lower potential at any instant 0V, and you're in your second scenario. Or define 0V as the "midpoint" when the top and bottom are at the same potential, and now you're in your third scenario. When you use words like "stationary" you need to define what they're in reference to. Certainly the hot line does not stay "stationary" with respect to the neutral line, nor vice versa. In practice, it's common to use the earth ground as the reference point. In a house, it's common to physically connect neutral to the earth ground. Then, it's generally the case (modulo effects like resistance in wires) that the neutral will be at a potential of 0V relative to earth ground. It sounds like you understand the concept of a floating DC supply, where there is no intrinsic reference to ground and you can choose to connect ground to either terminal. Extending this understanding to AC should be straightforward: consider that an AC supply is just like a DC supply where someone's constantly adjusting the knob, except that you can also bring the voltage negative (e.g. bring the black terminal to a higher potential than the red terminal).
H: Reliable secondary storage for Raspberry Pi (or other such single-board computers (SBCs))? Most SD cards have a fairly limited life (as in maximum number of read-write cycles), and in spite of wear-levelling, for relatively frequent disk update applications, would probably fail in a year or so, with reducing effective disk space, due to bad-blocks. What might be some of the other secondary storage solutions, for such disk-update intensive applications, which are relatively inexpensive and not slow-coaches (the USB on Raspberry Pi, isn't very fast, as we know)? Having said that, I am considering a USB hard-disk. Since this is a wall-powered application, power is only a secondary concern. AI: The question is not clear about the volume of data to be stored. If the volume of data actually being written in each cycle is not very high, an USB flash memory device would be a good option: Low power requirement, low cost, and write/erase cycle ratings of 10,000 (consumer grade) to >100,000 (industrial / mil-spec) for multi-level-cell (MLC) flash. A Flash-based SSD typically has the same endurance per MLC as an USB flash drive, but due to a greater amount of spare cell head-room, write optimization using on-board RAM buffers in some models, and better write leveling algorithms, is often rated for 1 million to 5 million write/erase cycles for the device. Downside: More power required, 500 mA will often not cut it. A RAM-based SSD with on-board back-up battery is an option if the application requires even higher write cycles. Very few manufacturers offer pure RAM-based SSDs any more, though that was the primary early SSD technology. Write cycles are essentially infinite in comparison to the above options. Downside: Most RAM SSDs are not USB but PCI or PCIe, so an adapter is needed, as well as external power. Finally, there is of course the conventional magnetic storage external hard drive with USB interface. Lowest cost per gigabyte, and very high write/erase cycles. Downside: External power needed, and they are sensitive to physical shock.
H: How can I get my atmega328 to run for a year on batteries? Scenario I have created a nice electronic door lock for my dorm room. It is currently an Arduino Diecimila with a servo [un]locking the door. It has a numerical keypad with 3x4 buttons and 5 LED's (2 serie pairs and one single LED). It also currently runs on a cellphone charger. I have now redesigned it to run on a standalone Arduino (ATmega328), but would really like to have it run on AA batteries or even a 9V battery. For the software part, I figured I could put sleep calls for certain times inside the loop method to keep the ATmega power consumption as low as possible. And let the LED's "flash" with as long as possible time off. Question 1 When a button is pressed during the few milliseconds which the board sleeps, will it be "remembered"/"held" until it comes out of sleep and then be picked up as a button press? What would be the best way to handle this button press on sleep? Can I code it to wake up upon button activity, or must I just let it sleep for e.g. 10m.s. in every loop? Question 2 How would I approach the math of calculating how many AA batteries are needed to run this device for 10 months? Also, I don't know how to measure the average power usage per minute or so, since it alternates quickly etc. The Device AI: The Atmega328 provides six power saving modes, ordered from minimal to excellent (estimated current consumptions from this forum post): SLEEP_MODE_IDLE: 15 mA SLEEP_MODE_ADC: 6.5 mA SLEEP_MODE_PWR_SAVE: 1.62 mA SLEEP_MODE_EXT_STANDBY: 1.62 mA SLEEP_MODE_STANDBY : 0.84 mA SLEEP_MODE_PWR_DOWN : 0.36 mA Quoting the original question: I figured I could put sleep calls for certain times inside the loop method" You would need to use sleep_cpu() after setting up the sleep mode you require, from the list above. The Arduino Playground has a useful post about this. The application needs to be interrupt driven, use the above sleep modes extensively, and wake the processor up on button push, timer overflow and watchdog timer events to actually execute tasks. Additional power savings can be obtained through the following steps: Use the microcontroller's internal oscillator and a low clock rate (8MHz instead of 16) - but ensure that time and timing related code still works as expected. A different version of the bootloader might be needed for this. Avoid keeping LEDs on for long if the application uses them. Using a rapid double or triple flash of short duration (0.05 second on, 0.5 second off), with gaps of seconds in between, ensures noticeable indication with minimal power consumption Use a switching regulator instead of a linear one, if a regulator is required. Run the microcontroller at lower voltage if supported, 3.0 Volts (e.g. CR2032 Lithium cell, no regulator needed) or 3.3 Volts instead of 5 Volts. Follow recommendations in the datasheet for unused input and output pin settings for minimum power wastage. Incorporating these suggestions allows for running microcontroller applications for weeks or months on a single CR2032 coin cell, and years on a LR123 type lithium cell. Of course, your mileage may vary depending on what sensors, outputs and actual processing your application requires. Some useful references: Hush little microprocessor… AVR and Arduino sleep mode basics Adventures in Low Power Land - Sparkfun tutorial Power saving techniques for microprocessors (forum post)
H: Should I look for Aluminum or plastic enclosure for UPS I am on the process of material selection for the UPS I am prototyping. My plan is to manufacture a product that should finally go to the market. I am relatively new to the manufacturing and I would like to get some advice on the selection of the right enclosure material for electronics equipment like UPS. Should I look for Aluminum or plastic enclosure? Please advise me from both economic and technical sides AI: A quick survey of the half dozen UPS units from 3 different brands sitting around my workroom indicate plastic as the standard UPS casing material. Here are some possible reasons for this choice: Light weight, thereby lower shipping cost, and easier handling during set-up. Safer, as any mess-ups / short circuits are unlikely to expose live power on the casing Safer, as any battery spillage or leaks are less likely to eat through the casing and damage person and place. Cost of manufacture: Besides the initial cost of design and production tooling, recurring and materials costs ought to be lower than for metal fabrication. This one is worth validating specific to the plastic of choice. Less noise, as plastic tends to absorb the humming of various power elements very well, compared to metal. Structural longevity, since metal cases tend to ding and dent more easily than plastics. Now the flip side: Aluminium casing will reduce radiated EMI Better heat dissipation if the casing is suitably used for heat-sinking Lower production cost in small scale: Off the shelf extruded aluminium and metal fittings in a wide variety of profiles and sizes would allow screwdriver technology to produce strong, professional looking casing. Seems to be the casing of choice for at least one brand's large, high capacity UPS, so it isn't unheard of. The unit sure leaves big dents on the wall if rolled around on its casters, though.
H: Speaking words with Pololu 3pi Robot At each instersection I play different music for the compass direction the robot decided to go. Any ideas how to get the robot to speak the words "West", "East", "South", "North"? if (current_direction == 'W') OrangutanBuzzer::play("!T240 L8 a gafaeada"); if (current_direction == 'E') OrangutanBuzzer::play("!T240 L8 a gfgfgfgf"); if (current_direction == 'S') OrangutanBuzzer::play("!T240 L8 a efgefgef"); if (current_direction == 'N') OrangutanBuzzer::play("!T240 L8 a abcabcab"); Full code: // The following libraries will be needed by this demo #include <Pololu3pi.h> #include <PololuQTRSensors.h> #include <OrangutanMotors.h> #include <OrangutanAnalog.h> #include <OrangutanLEDs.h> #include <OrangutanLCD.h> #include <OrangutanPushbuttons.h> #include <OrangutanBuzzer.h> Pololu3pi robot; unsigned int sensors[5]; // an array to hold sensor values int last1 = 0; int last2 = 0; int last3 = 0; int stop_robot = 0; int already_stopped = 0; int use_pattern = 0; char pattern[] = {'S', 'S', 'S', 'S', 'S', 'S', 'S', 'R', 'R', 'S', 'S', 'S', 'S', 'S', 'S', 'S', 'L', 'L', 'S', 'S', 'S', 'S', 'S', 'S', 'S', 'R', 'R', 'S', 'S', 'S', 'S', 'S', 'S', 'S', 'R', 'S', 'S', 'S', 'R'}; int pattern_length = 39; int i = -1; int pattern_loop = 1; // This include file allows data to be stored in program space. The // ATmega168 has 16k of program space compared to 1k of RAM, so large // pieces of static data should be stored in program space. #include <avr/pgmspace.h> // Introductory messages. The "PROGMEM" identifier causes the data to // go into program space. const char welcome_line1[] PROGMEM = "Tim's"; const char welcome_line2[] PROGMEM = "Self"; const char demo_name_line1[] PROGMEM = "Driving"; const char demo_name_line2[] PROGMEM = "Robot"; // A couple of simple tunes, stored in program space. const char welcome[] PROGMEM = ">g32>>c32"; const char go[] PROGMEM = "L16 cdegreg4"; const char melody[] PROGMEM = "!L16 V8 cdefgab>cbagfedc"; int play_intersection_music = 0; int be_random = 1; int speed = 1; int stop_protection = 0; int do_calibration = 0; int variable_speed = 0; int do_compass = 1; char current_direction = 'W'; // Data for generating the characters used in load_custom_characters // and display_readings. By reading levels[] starting at various // offsets, we can generate all of the 7 extra characters needed for a // bargraph. This is also stored in program space. const char levels[] PROGMEM = { 0b00000, 0b00000, 0b00000, 0b00000, 0b00000, 0b00000, 0b00000, 0b11111, 0b11111, 0b11111, 0b11111, 0b11111, 0b11111, 0b11111 }; // This function loads custom characters into the LCD. Up to 8 // characters can be loaded; we use them for 7 levels of a bar graph. void load_custom_characters() { OrangutanLCD::loadCustomCharacter(levels + 0, 0); // no offset, e.g. one bar OrangutanLCD::loadCustomCharacter(levels + 1, 1); // two bars OrangutanLCD::loadCustomCharacter(levels + 2, 2); // etc... OrangutanLCD::loadCustomCharacter(levels + 3, 3); OrangutanLCD::loadCustomCharacter(levels + 4, 4); OrangutanLCD::loadCustomCharacter(levels + 5, 5); OrangutanLCD::loadCustomCharacter(levels + 6, 6); OrangutanLCD::clear(); // the LCD must be cleared for the characters to take effect } // This function displays the sensor readings using a bar graph. void display_readings(const unsigned int *calibrated_values) { unsigned char i; for (i=0;i<5;i++) { // Initialize the array of characters that we will use for the // graph. Using the space, an extra copy of the one-bar // character, and character 255 (a full black box), we get 10 // characters in the array. const char display_characters[10] = { ' ', 0, 0, 1, 2, 3, 4, 5, 6, 255 }; // The variable c will have values from 0 to 9, since // calibrated values are in the range of 0 to 1000, and // 1000/101 is 9 with integer math. char c = display_characters[calibrated_values[i] / 101]; // Display the bar graph character. OrangutanLCD::print(c); } } void no_stopping() { OrangutanLCD::clear(); OrangutanLCD::print("No\nStopping"); delay(1000); } // Initializes the 3pi, displays a welcome message, calibrates, and // plays the initial music. This function is automatically called // by the Arduino framework at the start of program execution. void setup() { unsigned int counter; // used as a simple timer // This must be called at the beginning of 3pi code, to set up the // sensors. We use a value of 2000 for the timeout, which // corresponds to 2000*0.4 us = 0.8 ms on our 20 MHz processor. robot.init(2000); load_custom_characters(); // load the custom characters // Play welcome music and display a message OrangutanLCD::printFromProgramSpace(welcome_line1); OrangutanLCD::gotoXY(0, 1); OrangutanLCD::printFromProgramSpace(welcome_line2); OrangutanBuzzer::playFromProgramSpace(welcome); delay(1000); OrangutanLCD::clear(); OrangutanLCD::printFromProgramSpace(demo_name_line1); OrangutanLCD::gotoXY(0, 1); OrangutanLCD::printFromProgramSpace(demo_name_line2); delay(1000); OrangutanLCD::clear(); int bat = OrangutanAnalog::readBatteryMillivolts(); OrangutanLCD::print(bat); OrangutanLCD::print("mV"); OrangutanLCD::gotoXY(0, 1); delay(2000); OrangutanLCD::clear(); if (!play_intersection_music) { //OrangutanLCD::clear(); OrangutanLCD::print("No"); OrangutanLCD::gotoXY(0, 1); OrangutanLCD::print("Stopping"); } else { //OrangutanLCD::clear(); OrangutanLCD::print("Do"); OrangutanLCD::gotoXY(0, 1); OrangutanLCD::print("Stop"); } // Display battery voltage and wait for button press while (!OrangutanPushbuttons::isPressed(BUTTON_B)) { //delay(100); if (OrangutanPushbuttons::isPressed(BUTTON_A)) { OrangutanPushbuttons::waitForRelease(BUTTON_A); OrangutanLCD::clear(); if (play_intersection_music) { play_intersection_music = 0; //OrangutanLCD::clear(); OrangutanLCD::print("No"); OrangutanLCD::gotoXY(0, 1); OrangutanLCD::print("Stopping"); } else { play_intersection_music = 1; OrangutanLCD::print("Do"); OrangutanLCD::gotoXY(0, 1); OrangutanLCD::print("Stop"); } } } OrangutanPushbuttons::waitForRelease(BUTTON_B); delay(1000); // Always wait for the button to be released so that 3pi doesn't // start moving until your hand is away from it. // Auto-calibration: turn right and left while calibrating the // sensors. for (counter=0; counter<80; counter++) { if (counter < 20 || counter >= 60) OrangutanMotors::setSpeeds(40, -40); else OrangutanMotors::setSpeeds(-40, 40); // This function records a set of sensor readings and keeps // track of the minimum and maximum values encountered. The // IR_EMITTERS_ON argument means that the IR LEDs will be // turned on during the reading, which is usually what you // want. robot.calibrateLineSensors(IR_EMITTERS_ON); // Since our counter runs to 80, the total delay will be // 80*20 = 1600 ms. delay(20); } OrangutanMotors::setSpeeds(0, 0); OrangutanLCD::clear(); OrangutanLCD::print("Go!"); // Play music and wait for it to finish before we start driving. OrangutanBuzzer::playFromProgramSpace(go); while(OrangutanBuzzer::isPlaying()); } // This function, causes the 3pi to follow a segment of the maze until // it detects an intersection, a dead end, or the finish. void follow_segment() { int last_proportional = 0; long integral=0; while(1) { // Normally, we will be following a line. The code below is // similar to the 3pi-linefollower-pid example, but the maximum // speed is turned down to 60 for reliability. // Get the position of the line. unsigned int position = robot.readLine(sensors, IR_EMITTERS_ON); if (!do_compass) display_sensors(); // The "proportional" term should be 0 when we are on the line. int proportional = ((int)position) - 2000; // Compute the derivative (change) and integral (sum) of the // position. int derivative = proportional - last_proportional; integral += proportional; // Remember the last position. last_proportional = proportional; // Compute the difference between the two motor power settings, // m1 - m2. If this is a positive number the robot will turn // to the left. If it is a negative number, the robot will // turn to the right, and the magnitude of the number determines // the sharpness of the turn. int power_difference = proportional/20 + integral/10000 + derivative*3/2; // Compute the actual motor settings. We never set either motor // to a negative value. if (variable_speed) speed = random(1, 7); const int maximum = speed * 30; // the maximum speed if (power_difference > maximum) power_difference = maximum; if (power_difference < -maximum) power_difference = -maximum; if (power_difference < 0) OrangutanMotors::setSpeeds(maximum + power_difference, maximum); else OrangutanMotors::setSpeeds(maximum, maximum - power_difference); // We use the inner three sensors (1, 2, and 3) for // determining whether there is a line straight ahead, and the // sensors 0 and 4 for detecting lines going to the left and // right. //if (sensors[0] > 200 && sensors[1] > 200 && sensors[2] > 200 && sensors[3] > 200 & sensors[4]) { // OrangutanBuzzer::playFromProgramSpace(go); // while(OrangutanBuzzer::isPlaying()); //} if (sensors[1] < 100 && sensors[2] < 100 && sensors[3] < 100) { // There is no line visible ahead, and we didn't see any // intersection. Must be a dead end. return; } else if (sensors[0] > 200 || sensors[4] > 200) { // Found an intersection. return; } } } // Code to perform various types of turns according to the parameter dir, // which should be 'L' (left), 'R' (right), 'S' (straight), or 'B' (back). // The delays here had to be calibrated for the 3pi's motors. void turn(unsigned char dir) { if (play_intersection_music == 1) { OrangutanMotors::setSpeeds(0, 0); OrangutanBuzzer::playFromProgramSpace(melody); while(OrangutanBuzzer::isPlaying()); } switch(dir) { case 'L': // Turn left. OrangutanMotors::setSpeeds(-80, 80); delay(200); if (current_direction == 'W') current_direction = 'S'; else if (current_direction == 'E') current_direction = 'N'; else if (current_direction == 'S') current_direction = 'E'; else if (current_direction == 'N') current_direction = 'W'; break; case 'R': // Turn right. if (current_direction == 'W') current_direction = 'N'; else if (current_direction == 'E') current_direction = 'S'; else if (current_direction == 'S') current_direction = 'W'; else if (current_direction == 'N') current_direction = 'E'; OrangutanMotors::setSpeeds(80, -80); delay(200); if (do_calibration) { int counter; for (counter=0; counter<80; counter++) { if (counter < 20 || counter >= 60) OrangutanMotors::setSpeeds(40, -40); else OrangutanMotors::setSpeeds(-40, 40); // This function records a set of sensor readings and keeps // track of the minimum and maximum values encountered. The // IR_EMITTERS_ON argument means that the IR LEDs will be // turned on during the reading, which is usually what you // want. robot.calibrateLineSensors(IR_EMITTERS_ON); // Since our counter runs to 80, the total delay will be // 80*20 = 1600 ms. delay(20); } } OrangutanMotors::setSpeeds(0, 0); break; case 'B': // Turn around. if (current_direction == 'W') current_direction = 'E'; else if (current_direction == 'E') current_direction = 'W'; else if (current_direction == 'S') current_direction = 'N'; else if (current_direction == 'N') current_direction = 'S'; OrangutanMotors::setSpeeds(80, -80); delay(400); break; case 'S': // Don't do anything! break; } } // The path variable will store the path that the robot has taken. It // is stored as an array of characters, each of which represents the // turn that should be made at one intersection in the sequence: // 'L' for left // 'R' for right // 'S' for straight (going straight through an intersection) // 'B' for back (U-turn) // // Whenever the robot makes a U-turn, the path can be simplified by // removing the dead end. The follow_next_turn() function checks for // this case every time it makes a turn, and it simplifies the path // appropriately. char path[100] = ""; unsigned char path_length = 0; // the length of the path void display_sensors() { unsigned int position = robot.readLine(sensors, IR_EMITTERS_ON); // Display the position measurement, which will go from 0 // (when the leftmost sensor is over the line) to 4000 (when // the rightmost sensor is over the line) on the 3pi, along // with a bar graph of the sensor readings. This allows you // to make sure the robot is ready to go. OrangutanLCD::clear(); OrangutanLCD::print(sensors[0]/10); //OrangutanLCD::print(sensors[1]/10); //OrangutanLCD::print(sensors[2]/10); //OrangutanLCD::print(sensors[3]/10); //OrangutanLCD::print(sensors[4]/10); OrangutanLCD::gotoXY(0, 1); display_readings(sensors); } // Displays the current path on the LCD, using two rows if necessary. void display_path() { // Set the last character of the path to a 0 so that the print() // function can find the end of the string. This is how strings // are normally terminated in C. path[path_length] = 0; OrangutanLCD::clear(); OrangutanLCD::print(path); if (path_length > 8) { OrangutanLCD::gotoXY(0, 1); OrangutanLCD::print(path + 8); } } // This function decides which way to turn during the learning phase of // maze solving. It uses the variables found_left, found_straight, and // found_right, which indicate whether there is an exit in each of the // three directions, applying the "left hand on the wall" strategy. unsigned char select_turn(unsigned char found_left, unsigned char found_straight, unsigned char found_right) { i = i + 1; if (use_pattern) { if (pattern_loop) { return pattern[i % pattern_length]; } else if (i >= pattern_length) { stop_robot = 1; return 'B'; } else { return pattern[i]; } } // Make a decision about how to turn. The following code // implements a left-hand-on-the-wall strategy, where we always // turn as far to the left as possible. if (be_random == 1) { if (found_left && found_straight && found_right) { int picked_choice = random(0, 4); if (picked_choice == 0) return 'B'; if (picked_choice == 1) return 'L'; if (picked_choice == 2) return 'S'; if (picked_choice == 3) return 'R'; } if (found_left && found_straight && !found_right) { int picked_choice = random(0, 3); if (picked_choice == 0) return 'B'; if (picked_choice == 1) return 'L'; if (picked_choice == 2) return 'S'; } if (found_left && !found_straight && found_right) { int picked_choice = random(0, 3); if (picked_choice == 0) return 'B'; if (picked_choice == 1) return 'L'; if (picked_choice == 2) return 'R'; } if (found_left && !found_straight && !found_right) { int picked_choice = random(0, 2); if (picked_choice == 0) return 'B'; if (picked_choice == 1) return 'L'; } if (!found_left && found_straight && found_right) { int picked_choice = random(0, 3); if (picked_choice == 0) return 'B'; if (picked_choice == 1) return 'S'; if (picked_choice == 2) return 'R'; } if (!found_left && found_straight && !found_right) { int picked_choice = random(0, 2); if (picked_choice == 0) return 'B'; if (picked_choice == 1) return 'S'; } if (!found_left && !found_straight && found_right) { int picked_choice = random(0, 2); if (picked_choice == 0) return 'B'; if (picked_choice == 1) return 'R'; } if (last1 == 0) last1 = 1; else if (last2 == 0) last2 = 1; else if (last3 == 0) last3 = 1; else stop_robot = 1; return 'B'; } else { if (found_left) return 'L'; else if (found_straight) return 'S'; else if (found_right) return 'R'; else return 'B'; } } // Path simplification. The strategy is that whenever we encounter a // sequence xBx, we can simplify it by cutting out the dead end. For // example, LBL -> S, because a single S bypasses the dead end // represented by LBL. void simplify_path() { // only simplify the path if the second-to-last turn was a 'B' if (path_length < 3 || path[path_length-2] != 'B') return; int total_angle = 0; int i; for (i = 1; i <= 3; i++) { switch (path[path_length - i]) { case 'R': total_angle += 90; break; case 'L': total_angle += 270; break; case 'B': total_angle += 180; break; } } // Get the angle as a number between 0 and 360 degrees. total_angle = total_angle % 360; // Replace all of those turns with a single one. switch (total_angle) { case 0: path[path_length - 3] = 'S'; break; case 90: path[path_length - 3] = 'R'; break; case 180: path[path_length - 3] = 'B'; break; case 270: path[path_length - 3] = 'L'; break; } // The path is now two steps shorter. path_length -= 2; } // This function comprises the body of the maze-solving program. It is called // repeatedly by the Arduino framework. void loop() { if (!stop_robot || !stop_protection) { follow_segment(); // Drive straight a bit. This helps us in case we entered the // intersection at an angle. // Note that we are slowing down - this prevents the robot // from tipping forward too much. OrangutanMotors::setSpeeds(50, 50); delay(50); if (!do_compass) display_sensors(); // These variables record whether the robot has seen a line to the // left, straight ahead, and right, whil examining the current // intersection. unsigned char found_left = 0; unsigned char found_straight = 0; unsigned char found_right = 0; // Now read the sensors and check the intersection type. unsigned int sensors[5]; robot.readLine(sensors, IR_EMITTERS_ON); // Check for left and right exits. if (sensors[0] > 100) found_left = 1; if (sensors[4] > 100) found_right = 1; // Drive straight a bit more - this is enough to line up our // wheels with the intersection. OrangutanMotors::setSpeeds(40, 40); delay(200); // Check for a straight exit. robot.readLine(sensors, IR_EMITTERS_ON); if (sensors[1] > 200 || sensors[2] > 200 || sensors[3] > 200) found_straight = 1; // Intersection identification is complete. // If the maze has been solved, we can follow the existing // path. Otherwise, we need to learn the solution. unsigned char dir = select_turn(found_left, found_straight, found_right); // Make the turn indicated by the path. turn(dir); if (do_compass) { OrangutanMotors::setSpeeds(0, 0); OrangutanLCD::clear(); OrangutanLCD::print(dir); OrangutanLCD::gotoXY(0, 1); OrangutanLCD::print(current_direction); if (current_direction == 'W') OrangutanBuzzer::play("!T240 L8 a gafaeada"); if (current_direction == 'E') OrangutanBuzzer::play("!T240 L8 a gfgfgfgf"); if (current_direction == 'S') OrangutanBuzzer::play("!T240 L8 a efgefgef"); if (current_direction == 'N') OrangutanBuzzer::play("!T240 L8 a abcabcab"); while(OrangutanBuzzer::isPlaying()); } // Store the intersection in the path variable. path[path_length] = dir; path_length++; // You should check to make sure that the path_length does not // exceed the bounds of the array. We'll ignore that in this // example. // Simplify the learned path. simplify_path(); // Display the path on the LCD. //display_path(); } else { OrangutanMotors::setSpeeds(0, 0); if (!already_stopped) { OrangutanLCD::clear(); OrangutanLCD::print("Stopped"); already_stopped = 1; } } } AI: Microcontroller controlled SD card + sound player modules are available for around $6 (and up). These have a memory card reader, MP3, ADPCM or WAV file deciding, and PCM audio output, with a 0.1" header for connecting to the microcontroller board of choice. Your application can trigger specific files to be played back on events of interest. So simply record the "north", "south", "east", "west" and any other speech into separate files, and play back the appropriate file as needed. At a slightly higher price point, similar modules with a chip amplifier on board can be found, for louder sound output. Some of these modules offer stereo 3W + 3W or higher outputs, but stereo does not seem a requirement for the application described.
H: Voltage divider ambiguity considering the following circuit : R1 |--/\/\/\--------- A | | |+ | (E1) | | | |------/\/\/\----| | R2 | |------/\/\/\---- B R3 Can anyone please explain to me why the voltage V(AB) calculated by the voltage divider rule is equal to Vab=[R2/(R1+R2)]*E1 ? Is it fair to assert that you consider only R1 and R2 because R3 has no current flowing in it therefore has null voltage ? AI: Yes, potential difference is a function of the current flowing and the resistance it is flowing across. V = I * R Thus, since point B is a hypothetical open circuit, current through R3 is zero, hence voltage across R3 is also zero. As an aside, while the ascii-art schematic is better than none, there are a number of simple, and free, schematic drawing tools out there, such as Fritzing, for making a schematic that provides greater clarity to the reader of your question.
H: Class AB or Class D for a home theater amplifier I am planing to assemble a 5.1 channel amplifier. I selected the famous TDA2030 as the basic element and is simple to proceed. But I have a confusion, whether to use some other Class D amplifier for better quality. Please share your experience about these classes of amplifiers in the term of their output quality. I really don't care about the efficiency or the size. AI: Conceptually, a Class D amplifier is considered by some music purists to be less "perfect" in music rendition than a Class AB. This is because at the end of the day, a Class D amplifier generates digital pulses, which are then low-pass filtered to reconstruct the original sound. However, this distinction is perhaps more a preconception than human-discernible reality. Modern Class D amplifiers like the TPA3125D2 work at high enough oscillator frequencies (300 KHz) that the low-pass filter node frequency can be well above the ability of the human ear to perceive - 60 KHz or higher frequency low-pass filters have been used in DIY audio amplifier designs. Class AB too can suffer from distortion, especially if the load impedance is not well matched to the design, or the AB amplifier inherently has poor crossover distortion profiles. This is not so evident in "famous" Class AB chip amps such as the TDA2030 or the LM3886, both of which boast excellent Total Harmonic Distortion figures. Also, Class AB amplifiers can conceivably exhibit distortion at lower frequencies as well, where the human ear is more sensitive to such distortion. Class D distortion is significantly at the top end of the audio band, and beyond. A bigger cause for concern around audible distortion in DIY audio amplifiers is power-rail voltage droop under load. While the power supply could be designed to comfortably provide sufficient current to exceed the RMS power rating of the amplifier design, the actual power requirement rises to much more than a hypothetical Sqrt(2) x RMS wattage + overhead. Even 4 x rated RMS wattage might be momentarily breached in practice, such as during big drums and cymbals clashing at once. If the power supply tops out in those moments, and especially if the voltage regulator's protection circuitry takes time to recover, you have harsh distortion, more discernible than any amplifier chip choice would expose you to. There is no simple answer AFAIK, but if you are interested in personal recommendations, going with multiple Class D amplifiers has several advantages - separate amplification, pass-band and load tuning for each channel and each band, designed to align with the specific characteristics of the speakers you plan to use for each channel and band. The x.1 subwoofer / woofer amplifier can be given special attention, since it tends to be a current hungry part of the design. The low thermal wastage i.e. lower non-utilized power overhead allows for simpler or even no heat sinking, and of course there is less load on the power supply evidently. Knowing what actual power the 5.1 amplifier is being designed to pump out may provide better insights.
H: Robot power supply I'm designing a power supply for a small robot. I will use a 6V NiMH battery pack and I want to deliver 9V at 2A to drive the motors. I will use a step-up regulator to reach 9V but I don't know how to deliver 2A. Can anyone give me some hints about what should I study to project this circuit? AI: What you would be looking for is a boost regulator, e.g. TI's LMR61428 or SemTech's SC4501. An easy way to identify potential parts that meet your requirement is to search for "boost regulator" on a site like DigiKey, then apply filters in the parametric search for the characteristics you require. Also useful is some exploration of online tools for power management design, such as TI's Simple Switcher tools. Each manufacturer who offers such a tool, would propose parts and designs built around their respective product ranges, so it would behoove you to use several such tools to understand the types and prices of parts involved, before making a decision. This exploratory exercise will also help gain some understanding of the simplest ways to implement a boost regulator for your project, if needed. Many of the free design tools go all the way through to providing reference schematics based on your inputs, plus costing for the bill-of-materials involved, and PCB area budget.
H: How will transformer efficiency change if the transformer is connected backwards? Suppose I have a transformer designed to convert 220 volts into 5 volts and when it works in this mode being 95% loaded its efficiency is 97%. Now I connect the secondary winding to a 5 volts power source and connect appropriate 220 volts load to the primary so that the transformer converts 5 volts into 220 volts and is 95% loaded. How will the transformer efficiency change? Will it remain 97%? AI: Efficiency depends on frequency, current and source & load impedance. If you use the same on each winding, it is reversible and similar efficiency can be expected.
H: Class AB power amplifier I have implemented a class AB amplifier. The schematics are below. As you can see, my \$V_{cc}\$ is only 1V. How come I can still suppy 2.8 amp to the 4 ohm speaker/load? Is it a bug in MultiSim, or did the input signal (16V pk AC) made its way to the speaker? As far as I know, the voltage output in the load cannot exceed \$V_{cc}\$. Both transistor appear to be in good placement/direction, but I've seen other configurations in which the transistors are reverted. Here is a link to my schematic. Safety question: Is it ok for my 4 ohm speaker pass the whopping 2.8 amps? Is it common for power amplifiers to do that? AI: That will not work. You cannot drive the the transistors above the collector voltage otherwise the Vbc becomes forward biased.
H: Debugging a PIC16 with MPLAB X I am having problems with the MPLAB X debugger (although the release build works fine). It behaves very weirdly with my PIC16LF1937-based PICKIT3. Specifically: It gets caught in random infinite loops The step over function doesn't work most of the time It only seems to debug the first few instructions Setting a breakpoint on a late instruction will cause the PIC to freeze early What could I be doing wrong? What things should I check? AI: I question the stability of your release build if you cannot debug it at all. Building for debugging adds some extra meat to your HEX file, meaning things aren't always in the same RAM and flash locations they are in a production build. This has (for me) sometimes shown some software bugs that I didn't see in production mode (case in point - I think I found a bug in the XC16 string library where sscanf is throwing address errors when dealing with chars, which only showed up after I started debugging and a char moved to a different RAM location) If you're debugging and you have WDT enabled, disable it - the WDT doesn't play well with the debugger freezing time by stopping the micro. Before you add breakpoints and other stuff, simply run the program as-is in debug mode - no single steps, just execute. The code should just 'work'. For detailed help, you'll need to post a minimum code sample that works fine in production mode but hangs up when debugging. (This exercise may show you some buggy code that you didn't realize you had.)
H: Zener diode forward voltage I'm trying to learn how Zener diodes work and I think I get the overall concept (regulating voltage to the zener voltage level), but there's one thing I don't understand. I'm looking at this diode and see that it's zener voltage is 3.3V, but it's max forward voltage is 0.9V. Why is the forward voltage so much lower than the zener voltage? Is it because the diode is generally never placed in a forward biased direction (i.e. current should only generally travel in a reverse biased direction)? Update I was originally under the assumption that the max forward voltage was the maximum voltage the diode could handle in a forward biased direction. Thanks to @SomeHardwareGuy for setting me straight. The max forward voltage is the voltage required to have current flow through the diode in a forward direction. AI: It's just the basic operating principle of a diode. An ideal diode would allow current to flow in one direction but block current flow in the other direction. This is based on how it's made, with a p-type region, an n-type region, and a depletion zone in between. Like the bottom diode in this picture: When you apply a some voltage, in your case 0.9V then the p-type holes and the n-type electrons move into the depletion region because they are repelled by their respective battery terminal. With enough voltage (0.9V in your case) the free electrons in the depletion region get moving and current begins to flow like this: Now in the ideal case if you were to reverse that battery the opposite will happen and you'll get no current flowing: In the real world though you can only apply so much reverse voltage or push before you hit the breakdown voltage and current begins to flow freely in the reverse direction. Zener diodes take advantage of this fact and are constructed to breakdown at lower voltages such as your 3.3V. Sources: You can read more about how zeners are made here Or see the article I got all the pictures from here
H: Difference between a Power Plane and a Copper Fill? What is the (or is there a) practical difference between designating a layer of a printed circuit board as a power plane as compared making a polygon cover the layer and naming it the same as the power net? I'm thinking of EAGLE when I ask this question, but I think there are analogies in other ECAD tools. I know Sunstone Circuits CAM file seems to think of these concepts differently, but I'm not sure how or why. AI: I don't know Eagle, but in other tools the difference has to do with how the gerbers are generated. For a power plane, the gerbers will be generated as a negative image. The gerber file will indicate features for regions or shapes where copper should be removed. For signal layers, the gerbers will indicte features for shapes where copper should be retained (not etched away). This can have a big effect on the size of the gerber files. For a polygon on a signal layer, the gerber will usually include a long self-overlapping serpentine trace (or mesh of crossing traces) to fill the polygon area. This can lead to a very large gerber file. In the days when gerbers were transferred to vendors over dial-up modems, it made a much bigger difference to reduce the size of the files. There can also be a subtle difference in the actual generated boards, because the features (whether positive features in a polygon, or negative features on a plane layer) must be generated by actual apertures on a photoplotter tool, selected from a limited set of available shapes and sizes.
H: Laptop Adaptor Circuit Elements Can you tell me about this circuit elements' name more specifically? Especially number 1 and 10; what are they? Number 1 text: SCC 068K275V-X2 MPXGMF 40/100/21 AI: I'll bite: X2 capacitor Inductor Fuse Metal oxide varistor Rectifier Capacitor Diode Capacitor Capacitor Transformer Power transistor X1 capacitor Optoisolator Capacitor Power transistor Inductor Capacitor Transistor
H: What happens to the electrons of semiconductors? Take for instance, a diode. It has a region of n type material and a region of p type material. The p type material has a lack of electrons, the n type has an excess of electrons. When it's forward polarized, current will flow through the junction, etc... This is a trick question so I will propose an scenario which best describes what I'm asking. In this scenario I will be using the electron current flow, and I want you to focus on a single specific electron, lets call it electron A. Lets say electron A is on the n material of a diode. When I connect a power source to the diode, in such way that the diode is forward polarized (consider an ideal diode), the voltage source will displace the electrons from the n side to the p side, thus electron A will go from the n material through the p material all the way to the power source. Now lets say that after electron A was displaced from its original position, I take the diode out of circuit. Does that mean that the place in the n type material where electron A was before, has been substituted by the electron injected by the voltage source? Or, in layman words: does it mean that electron A which was once in my diode, will now be "living" in my voltage source, and one of the electrons from my power source will now be "living" in my diode? In which case it could be applied not only to the semiconductors, but any conductor, a cable will now have different electrons than the ones it originally had once a current passed through it. I know however that all electrons are the same particle, no matter where they come from, what I'm asking is from an individual specific electron perspective. AI: Individual electrons move around in semi-random ways, with a bias of moving along the E field lines from negative to positive. "Current" is only predictable because many many electrons are involved, and in the aggregate, their random behavior largely averages out and we are left with just the E field effects on the herd. From this view it should be clear that individual electrons can end up lots of different places after a certain amount of charge goes by. For a sustained current such as you describe, many electrons are moving all along the closed conduction path. Some may indeed swap positions after some amount of charge has flowed. None of this has anything to do with semiconductors. The same thing applies to electrons in a resistor or a copper wire.
H: Step voltage up or step voltage down when using batteries? When using batteries to drive a load via a voltage regulator, is it better to step the voltage up from two batteries in parallel, or step the voltage down from two batteries in series? If there is no absolute answer, is there a general rule (or set of rules) for deciding which is best for a particular situation? Are there any interesting cases where a particular circuit type bucks the trend? (pun not intended) AI: Using a step-up converter offers the advantage of being able to use partially-depleted batteries whose output voltage falls below the operating voltage of your device, but offers the disadvantages of exposing the device to harm if the battery voltage exceeds the expected level (e.g. if your 3.3-volt device operates off two AA batteries and have a 3-volt power-in jack into which someone plugs a 5-volt supply), and of increasing battery draw as the batteries get depleted (which in turn increases the risks that rechargeable batteries will be damaged, or non-rechargeable batteries will "leak" (i.e. ooze corrosive chemicals). It also, for better or for worse, will generally cause devices to continue to work normally as the batteries age, until they suddenly reach a point where they quit altogether. Using a step-down converter offers greater immunity to input overvoltage, and will cause the voltage which is fed to the main circuitry to drop once the battery voltage has sagged too much. In many cases, this will cause the device to start working less well as the batteries age--sometimes a good thing, and sometimes a bad thing. Such behavior may be a bad thing if the device becomes useless as soon as its performance starts to degrade, but may be a good thing if the device remains somewhat useful, and if a user might not want to have to change batteries at unexpected times.
H: Voltage Regulator Issue (TI TLV70012) I'm using this 1.2 V voltage regulator and having some serious problems. Currently have +5 V going to EN and IN pins and GND is connected to GND, seeing ~1.6 V on OUT pin when connecting it to GND through 8k resistor. I have been trying to figure out why the regulator is not outputting 1.2 V for days now and I am completely stumped. Any ideas? AI: These devices need input and output capacitors to keep them stable. Take a look at the datasheet: Without local caps (as close as possible to the pins) these things can and will oscillate, which unless you're looking with a scope can appear as incorrect DC voltage levels. Add caps and try again. If you're still not having any luck post some scope shots of the input and output voltages.
H: Why is there alternating current in my wall socket? Why is the standard of delivering electricity to our homes is via alternating current, and not direct? As far as I know almost every electronic device has an AC»DC converter because their internals use direct current. AI: From Wiki: Transmission loss The advantage of AC for distributing power over a distance is due to the ease of changing voltages using a transformer. Available electric power is the product of current × voltage at the load. For a given amount of power, a low voltage requires a higher current and a higher voltage requires a lower current. Since metal conducting wires have an almost fixed electrical resistance, some power will be wasted as heat in the wires. This power loss is given by Joule's first law and is proportional to the square of the current. Thus, if the overall transmitted power is the same, and given the constraints of practical conductor sizes, high-current, low-voltage transmissions will suffer a much greater power loss than low-current, high-voltage ones. This holds whether DC or AC is used. Converting DC power from one voltage to another requires a large spinning rotary converter or motor-generator set, which was difficult, expensive, inefficient, and required maintenance, whereas with AC the voltage can be changed with simple and efficient transformers that have no moving parts and require very little maintenance. This was the key to the success of the AC system. Modern transmission grids regularly use AC voltages up to 765,000 volts.
H: How does current flow through a voltage source? Im going back to electricity 101 to understand several things Im missing. One of them is exactly how does current flow through a DC source. Heres my understanding: A voltage source is one which has an excess of electrons in one side of its terminals, and a lack of electrons in the other, when connected together via a resistance or cable, electrons will flow from the side with an excess of electrons, to the side with a lack of electrons. Inside the source itself theres no current flow, only "around the supply", meaning if I have say a battery, the only way that electrons will go from one side to the other, is by connecting a cable from its + to - side, the electrons will flow through the cable all the way to the other side. When both sides have reached an equilibrium in which both have the same amount of electrons, theres no voltage potential (dead battery), thus no current flow. Very often a textbook will substitue components for DC sources, for example if we have a voltage source connected to a diode in series with a 2 resistances, the equivalent circuit will substitute a 0.7V DC source for the diode, and add the 2 resistance in series with it such as this: Lets take this circuit: The equivalent circuit is the following, where V2 equals the diode: So the way I understand it, in the circuit above, replacing the diode with say a 0.7V battery or 0.7V DC power supply would be the same as having the diode, yet, how is it possible that current will flow from the positive terminal of V1, through the resistor, THROUGH the 0.7V battery (or dc supply), through the second resistor into the negative terminal? I thought that no current could flow through a battery or dc source. I used a diode to make an example but there are several places in which Ive seen multiple voltage sources in a circuit, yet I dont understand how can current go through them. AI: My favorite educator, Bill Beaty, often rants at the many misconceptions that all too many people have been infected with. One of the many common misconceptions involves batteries. "Frequently-Asked Electricity Questions": "THE LIQUID BETWEEN A BATTERY'S PLATES IS A GOOD CONDUCTOR. SO WHY DOESN'T IT SHORT OUT THE BATTERY?" "Why is electricity so hard to understand?" "...mistaken belief that no charge flows through batteries. ... This leads to the traditional incorrect flashlight-current explanation (current comes out of battery, flows...etc.) It also leads to the misconception that batteries SUPPLY CHARGE, and have a storage place for "used" charge. This might make sense if we believe that there's no path for charge through the battery. But it's wrong, because there is a path, a path provided by flowing charged atoms. Charge must flow around and around a circuit, passing THROUGH the battery over and over." "But how SHOULD we teach kids about 'electricity'?" "A battery is a chemically-fueled charge pump. Like any other pump, a battery takes charges in through one connection and spits them out through the other. A battery is not a source of the "stuff" being pumped. When a battery runs down, it's because its chemical fuel is exhausted, not because any charges have been lost. ... When you "recharge" a battery, you are pumping charges through it backwards, which reverses the chemical reactions and converts the waste products back again into chemical fuel." 'Which way does the "electricity" really flow?' "When you connect a lightbulb to a battery, you form a complete circuit, and the path of the flowing charge is through the inside of the battery, as well as through the light bulb filament. Battery electrolyte is very conductive."
H: Comparators Dragging Each Other Down I've assembled a circuit which uses RC timing compared to the voltage across a potentiometer. It is intended to run the motor in this fashion: ON ----------------------- ----------------------- | | OFF ----- by triggering the comparators like this: ON ------------------ CMP1 | OFF ----------------------------- ON ---------------------- CMP2 | OFF------------------------- However, the circuit operates exactly opposite this behavior. It is on when I intend for it to be off, and off when it needs to be on. I think that one comparator may be dragging the output of the other to ground, but adding diodes doesn't seem to fix this. The comparators in this diagram are on the LM393 chip. I'm very limited in the variety of components that I can choose from, and something that relies mostly on diodes and/or resistors works perfectly. AI: The LM393 has open collector outputs. That means they can pull down, but not pull up (That's probably why you need the pull-up R16). The open collector output means you can produce a wired AND connection by tying two outputs together. You can't create a wired OR with typical comparators. You will need some kind of added gate or a couple of transistors to create the OR function you want. If you want to create the OR function using diodes, you will need a separate pull-up for each of the two comparator's outputs.
H: How do I control speed using servo.h? I have an Arduino mega 2560 attached to a 4 wheeled robot (similar to this: http://www.youtube.com/watch?v=gPqZQsKHJ9s&feature=related) . Pin 9 on the Arduino is connected to the front wheels of the robot to move either left or right. Pin 10 on the Arduino is connected to the back wheels for forward movement. I have successfully sent "LEFT" and "RIGHT" signals to the arduino and have gotten the robot to turn left and right respectively. However, I am struggling to have control on the pin 10 which controls forward/backward movement. When I send any signal to over pin 10 the robot moves the wheels in forward direction at maximum speed. I cannot let the robot sit on a table for testing because it goes out of control. I have to physically lift it from the table so the wheels do not touch the ground when testing pin 10. Here is the code that works correctly for left and right signals: #include <Servo.h> Servo myservo; // create servo object to control a servo void setup() { Serial.begin(9600); Serial.println("Hello Pi"); Serial.println("attaching to pin 9"); myservo.attach(9); // attaches the servo on pin 9 to the servo object } void loop() { if (Serial.available()) { char command = Serial.read(); if (command=='L'){ turn_left(); delay(5000); } else if (command=='R'){ turn_right(); delay(5000); } } } void turn_left(){ myservo.write(500); } void turn_right(){ myservo.write(0); } And here is the code for moving forward that does not work #include <Servo.h> Servo myservo; // create servo object to control a servo void setup() { Serial.begin(9600); Serial.println("Hello Pi"); Serial.println("attaching to pin 10"); myservo.writeMicroseconds(544); // im confused what this does.. myservo.attach(10); // attaches the servo on pin 10 to the servo object } void loop() { if (Serial.available()) { char command = Serial.read(); if (command=='L'){ move_forward(); // right now does the same thing is move_backward() delay(5000); } else if (command=='R'){ move_backward(); // right now does the same thing as move_forward() delay(5000); } } } void turn_left(){ myservo.write(500); } void turn_right(){ myservo.write(0); } // as soon as either of the two functions below is invoked // the robot goes at MAXIMUM speed forward. I have no clue how to slow it down. void move_forward(){ myservo.write(0); } void move_backward(){ myservo.write(0); } AI: I'm really just guessing here, but according to the documentation, "write() ... Writes a value to the servo... On a continuous rotation servo, this will set the speed of the servo (with 0 being full-speed in one direction, 180 being full speed in the other, and a value near 90 being no movement)." Have you tried maybe doing a myservo.write(90); which according to that documentation should be slow or stopped?
H: Connect TSOP to prolifc serial I have a prolifc USB to serial cable that I want to use to recieve infrared signals coming from a TSOP Sensor I saw it is possible to connect a classic rs232 connector with TSOP here. How can I connect it without damaging something ? AI: You most probably can't do that. The standard software for a TSOP-RS232 combo relies on the ability to read the hardware serial port very fast. An usb-to-serial cable does not offfer this option, it only offers a windows serial port interface, not the serial port hardware (register level) interface. One option is to have a microcontroller read out the TSOP and send the decoded information to the PC, like shown here.
H: Why do mobile phone transmissions come in pulses? We are all familiar with the phenomenon that mobile phones induce in amplifiers and loudspeakers. The bip bip-da-bip bip-da-bip which happens just before you get a call, or if the phone is just feeling chatty. I understand how the sound is produced, I don't understand why it has that particular pattern. Why a series of pulses? I thought at first it might be an attempt to avoid interference, but of course that's nonsense: two x-millisecond transmissions are just as likely to become corrupted as one 2x-millisecond transmission. So why the pule? Why not send the packet all at once? (Or send several packets in succession without a gap? Same difference -- the expected number of resends is surely the same.) AI: Most digital cellphone systems use time division multiple access. They transmit their packets in short bursts so that other phones in the same cell coverage area can also use the frequency to transmit their own packets. Also, transmitting in short bursts helps with managing the energy consumpution of the phone overall, for better battery life. The phone only has a certain amount of data to send per second, and by using the radio channel at its maximum rate for a short time saves power relative to sending at a slower rate continuously.
H: Why do most RFiD tags use hexadecimal numbers? RFID tags store one 24-digit hexadecimal number. Why use a single 24-digit hexadecimal number? AI: They don't. They store a number which is internally represented as binary and transmitted as binary. There is no hexadecimal here. Humans have a hard time grasping numbers with large number of digits. We therefore often represent large binary numbers in hexadecimal when intended for human understanding. We have gone so far as to make the tools we interface directly to, like assemblers and compilers, interpret hexadecimal numbers for us. However, none of this has anything to do with the representation inside the RFID chip, which is purely binary. The following numbers are all equal: 15F4B3D2 hex 368358354 decimal 00010101111101001011001111010010 binary What do you think the chance of human error is in manipulating the last one compared to the first one?
H: Don't have a momentary switch, what else can I use? Hi everyone and apologies if this is a really dumb question. I'm following this to control the GPIO on a raspberry PI: I bought a starter kit which has 2 mini push buttons, but I've no idea if they can be used? If not there's nowhere round here I can buy a switch so it'll be a day or two, is there any way to DIY a suitable switch? Any help would be great and sorry about the question. You're probably sick of raspberry pi questions but I have no one to ask. AI: It should work. They have 4 pins for structural strength, since they are meant to be soldered on a pcb. It has two pairs of pins, where each pin in a pair is electrically connected to the other, as illustrated in the following diagram (taken from google images): As you can see, pins 1 & 2 are connected, and so are 3 & 4. If it is normally closed instead of normally open, you can still make it work as expected by tweaking the software (may be as simple as inverting the logic).
H: How to keep the arduino uno up on serial connections? Each time I open a Serial connection to my arduino it restarts. Is there a way to unactivate this ? Cheers. AI: The reason for the reset is that Arduino Uno boards use the DTR signal line as a reset input, for automatic "rebooting" of the board for loading fresh code from the Arduino IDE. One solution suggested (for Arduino Uno boards) is to connect a 10 μF capacitor between the Reset pin and Ground. This should prevent the auto-reset. Another, more permanent solution is to cut the RESET-EN trace on the Uno board with a sharp knife. Re-enabling serial port based reset involves creating a solder bridge on the cut trace to reconnect it. With either of the above solutions you will need to press the Reset button each time just before the IDE begins uploading code to the board. Getting this manual reset timing right may need a bit of practice.
H: I2C - Where's the ACK I'm working on I2C master driver for interfacing a particular peripheral. The problem I have, is that when the 9th clock arrives, the slave device doesn't pull down the SDA line. I checked the signals with a scope, and everything looks like fine. the address is fine. I'm not using external pull-up resistors, I'm using the internal pullup capability of my MCU (EFM32GG). I'm not an electrical engineer, and my experience is from the software side, so this question may be silly, but is there a chance that the device can't pull down the line because the pull up drive is too high ? Can there be another explanation for this problem (except for the obvious one, that the slave chip is dead)? AI: With the scope, you should see some sort of effect on the data line, even if the line is being pulled up too strongly. It may drop only half a volt or something, not enough to be read as a zero. There's also the possibility of the slave address being wrong. Sometimes the address is specified as 7-bit and sometimes as 8-bit. The latter will be 2x the former. Free advice: Write a loop to try all the addresses and stop if it finds one that responds.
H: Peak detector is not working when voltage is changed I am trying to design a peak detector in Multisim simulation tool. I have designed buffered peak detector to get peak voltage of sine signal. The designed circuit is working when signal voltage is constant, for example when signal voltage changes from 1V to 0.5V then it is giving 2V as peak detector output. The designed circuit as shown below. In the above circuit I am using switch to change the voltage of sine wave from 1V to 0.5V. I am using one more switch to clip negative cycle of sine wave, then i am using buffered peak detector to get maximum voltage. When i apply 1V sine wave it is working perfectly and giving peak voltage as DC. The problem is when I change signal voltage from 1V to 0.5V then also it is giving 1V as peak. ANy one suggest me what mistake i am doing. I want to design peak detector that will give max voltage even there is voltage variations. I am trying to attach Multisim file but it is not possible for me. I don't know how to attach file so i have added image. AI: So let me see if I understand this. You give it a peak of 1.0v and it detects it correctly. Then you back it off to 0.5v and it still reports a 1.0v peak. What's the problem? 0.5v is not the peak if the voltage also goes up to 1.0v. I suspect that what you want is to detect a peak "over some amount of time", and not a peak "over an infinite amount of time". If I am following your schematics correctly, you need some way to discharge C1 so that it can detect the next pulse. There are several ways to do that. One way is to have a transistor/MOSFET/relay actually short C1 to GND. Then have some circuit that will periodically trip that. Another way is to simply put a resistor in parallel with C1. This resistor would cause the peak value to decay over time. Change the value of the resistor to change how fast it decays. If the resistor is connected to GND then the decay will be a somewhat inverse-square curve. Use a constant current source to make it more linear.
H: Finding a proper Book or a Internet Source on Combinational Logic I am having trouble finding a book on Combinational Logic. For those who do not know what Combinational Logic is, that area of study talks about digital logic such as six logic gates(and, or, xor, not, etc) along with ALU, Multiplexer, full adders and half adders, k-map, controlled inverters(you get the idea). I did run into many book entitled Computer Organization and Assembly Language at my college library but all the books already explain only the BASICS IDEAS of the topics (ie: truth values of logic gates, truth values of full adders which I already know)in the appendixes and does not intuitively explain how these things come together to create something useful. The Class I am taking is Computer Organization and Assembly Language. It is not a Computer Architecture Class. I am surprised even the internet has a lack of resources in explaining how these things work and come together. I got an 82 on the first exam. However I feel incompetent on the topics covered after the first exam(which are the topics I mentioned before in this post. The only internet source I could find is this one : http://www.allaboutcircuits.com/vol_4/chpt_9/1.html But again it's not all that helpful because I already know what they are saying and did not learning anything new. Any links you have used when taking a similar class as mine when learning this material would greatly be appreciated! AI: One of my favorite references, even though my copy is a couple editions old. I would imagine you could find some older versions if you look around. Lots of practical information.
H: What lamps are out there that don't flicker and give off warm light (like incandescent)? In the past few years several countries stopped producing 100W incandescent lamps, and in a few years they may disappear to be succeeded by fluorescent lamps. I really don't like the flicker and the color most common fluorescent lamps produce. Are there any other kinds of lamps that do not flicker and produce about the same warm light as incandescent lamps (that might not be banned from production in the nearest future)? AI: LEDs that are powered from DC or even semi-filtered AC can provide a warm color without noticeable (or any) flicker. LED-based lighting will only become more available and more affordable in the future, as their efficiency makes them highly attractive for illumination applications.
H: I need to sense if a rope has been touched, what is a safe way to do this? I was thinking of attaching a sensor to the rope but there are so many types I'm not sure which one to use. Pizeoelectric, rolling ball, vibration, tilt and tension sensors could all work. I need the lowest cost, most durable solution. Anyone have any ideas here? AI: I'd recommend an opposed-beam optical sensor. PCB-mount varieties can be purchased for around $0.25 in low volumes. Use an extension spring in series with one end of the rope to provide a little compliance (to make it kid proof, keep a length of rope in parallel with the spring so that the spring can only be stretched so far until the rope takes the load). Use a "flag" or other object attached to the spring to block the sensor when the rope isn't being touched/pulled, and not block the sensor when the spring is stretched a little bit due to rope tension. You'll need to work out a mechanical solution so that the spring doesn't rotate, which would prevent the flag from returning to its position in the middle of the sensor when the rope isn't being touched.
H: Interface a LCD to RS232 Is it possible to connect this LCD display. Directly to the PC serial port using a prolific usb 2 serial converter ? AI: If the prolific usb to serial converter outputs "TTL-level" signals (that is Transistor-Transistor Logic) and not rs-232 levels, then yes. Looking around for the prolific adapter you're referencing (this one?) it appears that it outputs between 1.8V and 3.3V, which should be able to communicate to the LCD backpack you're looking at. You really want a chip which outputs from 0 to +5V for communicating with that model, but they also sell the 3.3V model. I personally use the FTDI ft232rl as my go-to chip of choice for usb to serial converters. But I digress, if you're only wondering if the display functions taking input from a computer, then the answer is yes. I did that to test one of those LCDs years ago when I first got it. Good luck! Hope that helps.
H: Which books should I read to gather practical and useful electronic design skills? I need some guideance from the experienced users here, I need to know where to focus my studies: Ive been reading several electronic books, and they are quite different, I decided I want to re-learn from scratch most about semiconductors, so I have 3 books: "Electronic Design" by Savant, Roden and Carpenter, "Electronic Devices" by Floyd, and the classic "Electronic devices and Circuit Theory" by Boylestad. Floyd's book is very easy to read and understand but sometimes I think it lacks going deeper into the subject, yet its very practical. Savant's book is more math/theory oriented similar to Sedra/Smith but a bit lighter, and Boylestad's is somewhere in the middle. While im very fond of math, some math/theory or physicist oriented books like Savant "Electronic Design" or Sedra/Smith "Microelectronic devices" lack the practicality of Floyds book, and focus mostly on stuff that I find to be completely useless (at least so far). For example, Ive been reading about the diode, and both books give a lengthy explanation on how the diode works, and all the math around it. They end up presenting the following formula (among many others derived from it): I have no doubt in my mind that the formula above is a great model to describe the exponential behavior of a diode. The only problem is that any way I try to apply it to a real world scenario I find it to be completely useless and completely far off from the aproximate value calculated by just stating that Vf=0.7V. Also, a lot of the excercises in such books are also very abstract, for instance they'll use instantenous voltage equations to represent an AC signal, in which the results are expressed in sine or cosine equations rather than round numbers. Are any of the before mentioned equations useful in a daily life scenario? So my question is: Should I dump the heavy theory books and focus mainly on the ones which give practical applications? and is it worth knowing those sort of ideal mathematical model equations, or should I keep on doing what im doing now, which is basically reading the same chapters from all the books trying to get out whats best from each one of them? my only fear is that by using this method I will only get more confused, since some books use slightly different methods, name the same variable with different names, etc... Several engineers have told me I need to know a lot of theory if i want to be a good designer, and some others tell me I should focus on the stuff that works. AI: The Art of Electronics by Paul Horowitz, Winfield Hill is very readable.
H: Why is the negative contact in a battery bay always the side with some sort of spring? Is this just purely convention, or is there some kind of technical reason behind it? AI: Assuming you're talking about round-type (cylindrical) batteries, such as D, AA and AAA, it's to ensure maximum contact with the flat end of the battery, which is the "negative" terminal as described in the ANSI standard. You'll commonly see leaf-spring contacts as well as coils. The side with the "nub" will automatically provide a solid contact if enough pressure is provided by the contact on the flat side, so no second spring is needed. I can only assume that the flat and "nub" design that the ANSI standard describes for round-type batteries was chosen because it provides a clean contact mechanism as well as a clear indicator of polarity to consumers.
H: Dropping voltage for red channel on RGB LED I'm looking at a Multicomp OSW-8349 RGB LED, which has a Vf of 3V min / 4V max for the green and blue channels, and a Vf of 1.8V min to 2.8V max for the red channel, at 350mA. I'm planning on regulating 3.3V to drive the green and blue channels, but would like to avoid using another regulator just for the red one. Is there a cheap way to cut the voltage for the red LED? I'm considering using the forward voltage drop of a diode to bring it down to 2.6V, but I'm not sure how well this would work, especially with the temperature varying between ~16°C and ~38°C. AI: Yes, use a 2Ω resistor in series.
H: 50 volts regulated power supply What is the best way to make a 50 volts regulated power supply? I was thinking to incorporate the LM78xx IC only to find out the maximum voltage they support is around 24 V and 1 amperes. Another possible solution is to stack/cascade Zener diodes until the equivalent voltage is around 50 V. What solution is the best and reliable, assuming we can consider cost and performance also. PS: I will use the regulator to audio power amplifier which will draw around 1-3 A. Input: AC 220 volts 60 Hz Output: Pre amplifier and Power Amplifier (Audio) ripple - 5% tolerance AI: While there are adjustable linear voltage regulators which can deliver up to 50 Volts, that is probably not what you are looking for. At the voltage and current ratings required, a linear regulator would need to dissipate a lot of power as heat, since presumably the regulator would be fed off a bridge-rectified output from a transformer, and efficiency for a linear regulator is not very high. This drives the linear regulator approach out of the realms of practicality. A better option is a switched mode / buck regulator. These generate less wasted energy or heat, due to their very high efficiency, typically between 80 and 95%. A few suitable parts do come up on a product search. Taking this approach a step further, switched mode power boards for 50 Volts / 3 Amperes can be designed using free online tools such as TI's WeBench. This would use a buck controller (e.g. LM5116, adjustable up to 80 Volts) rather than a regulator, external MOSFETs, and other components for a complete device such as below: Even so, the solution remains sub-optimal as you would require a fairly large and heavy step-down transformer to bring your mains voltage down to the required levels, and to isolate the output from the power lines for safety. Next option, an SMPS: Mains-powered SMPS units of voltages and currents close to your requirements are available off the shelf from vendors specializing in industrial power supplies. Failing this, SMPS manufacturers can custom-build an SMPS to your required rating. I have recently had an SMPS somewhat like in the question custom built by a local manufacturer, and it worked out not nearly as expensive as I had expected. On another note: Many DIY audio amplifiers use unregulated power supplies, consisting of a step-down transformer, a full bridge rectifier and large reservoir capacitors, for driving the power amplification stage in balanced / dual rail mode. This will typically cost much less than a custom built SMPS, and might serve the purpose with some constraints. From a cursory search on digikey.com it appears that regulators and buck controllers for the required voltage and current ratings in your question, are all surface mount packages. Assumption: You are comfortable using SMD components in your design.
H: Fast opto-isolation with open collector output without VCC I have a two wire communication channel, with a data line and a ground line, with the data line being pulled high via a resistor on the receiving end. I am supposed to send information on this line by connecting the data line to the ground. There are also other devices on the bus which may be transmitting at other times, so the data line is not always high. The data line normally has 5V, but I don't have a separate VCC output line. I am allowed to leak 30 µA to the ground when I'm not sending and I need to sink atleast 15 mA to the ground when I am sending. Communicating on the line should be done by some isolated circuit. A simple phototransistor output opto-coupler fits the bill perfectly. One combined with a suitably selected base resistor will reach 1-2 µS switching times. However, there are a few things I do not like in this solution: If I need to sink 15 mA and still stay fast, I need to use a lot of current to achieve that: opto couplers with a high CTR tend to be slower and requiring a high CTR is problematic if one wants to have equipment that will still work in 10 years without problems. All the parts need to be selected just right to meet the specifications. If an input or output voltage is suddenly different (because a manufacturer does not adhere to specifications), it is likely that some resistor is too large or too small. It is hard to get wide enough margins for everything to deal with such events. The switching time is adequate, but I'd love to get a solution that would be really fast. Getting under 1 µs would be great, 100 ns would be splendid! So, I am wondering if there is some combination of simple components that would allow me to achieve faster, lower supply current and a more robust solution. All the faster opto isolators tend to require the VCC input or simply do not work with open collector outputs. There are some with fast switching times and supply power requirements in the µA range, so I have been toying with the idea of just pulling VCC from the data line and keeping a capacitor to tide over the times some other device is pulling the line low. This would be kind of like 1-wire bus. However, such couplers would need to be coupled with a transistor or FET to achieve the needed sink current and I am guessing that might negate all my speed advantage and make the design difficult. I also toyed with the idea of using ADuM5201, which provides isolated power as well as a high speed data link. That combined with a suitable FET might do the trick. However, such chips are somewhat complex beasts, requiring bypass capacitors, extended pads as heat sinks, large supply current at start up, and EM emission considerations. So, I am wondering if anyone has a cool solution, maybe something with modern components as I believe most of the advanced opto coupler stuff was done when many things were a bit more primitive. Thank you in advance. AI: A couple of thoughts: To make an opto's output transistor switch on hard, quickly, you need to put a lot of current into the LED briefly, but I don't know that you'd have to keep it on that hard. I would think that driving the LED briefly with a higher current and then using a lower current to hold it might be helpful; if the time between cutting back on the holding current and switching it off altogether was sufficient, that reduced holding current could help the transistor switch off more quickly. It might be helpful to add some circuitry on the output side of your opto. You may have to switch 15mA, but that doesn't mean the opto has to do so. If you will only have to start asserting the output when it's high (meaning you won't have to do things like stretch pulses which originate with other devices) and won't have to hold it too long, you could perhaps use an NFET, a diode, a small cap, and two optos. One opto would connect the gate of the NFET to the drain via diode. The other would connect it to the source. The drain would have a small cap to the source to maintain the gate voltage while the NFET is on. To start asserting the output, one would pulse the opto connecting the gate to the drain. To stop asserting it, one would pulse the opto connecting the gate to the source. When the device is idle, one should drive the latter opto just enough to overcome any possible leakage through the former. There are many possible variations on this circuit; having a "supply" capacitor may be better than having a capacitor on the gate, but putting the capacitor on the gate would probably yield more consistent behavior (since the capacitor would always start discharged when one started to assert the output, and since releasing the output would not require charging the cap). Depending upon how much voltage drop you can tolerate, other approaches may be workable as well. For example, you might be able to use an opto together with a BJT to form a Darlington arrangement, but use a second opto to accelerate the turn-off behavior. Such an approach would have a much higher voltage drop than the MOSFET-based approach, but would eliminate any need for a capacitor.
H: Can't set to Fast PWM OCRA mode Trying to have Fast PWM mode when TOP == ORCA. Works fine with OCA toggle (measuring correct frequency), but doesn't work in non-inverting mode. cli(); // Fast PWM Mode TCCR2A = 0; TCCR2A |= _BV(WGM20) | _BV(WGM21) | _BV(COM2A0) | _BV(COM2A1); // Inverting mode fails //TCCR2A |= _BV(WGM20) | _BV(WGM21) | _BV(COM2A1); // Non-Inverting mode fails //TCCR2A |= _BV(WGM20) | _BV(WGM21) | _BV(COM2A0); // Toggle mode OK // Prescaler set to 1024 (p.162) TCCR2B = 0; TCCR2B |= _BV(CS20) | _BV(CS21) | _BV(CS22) | _BV(WGM22); // Enable interrupt on counter match TIMSK2 |= _BV(OCIE2A); OCR2A = 127; sei(); Update with more information: MCU=Atmega328. In non-inverting mode I just got steady 1 on output and inverting mode gives logical 0. I was expecting to see the frequency $$F = 16*10^6 / (1024 * 127) = 123Hz$$ AI: I will answer myself. OC2A pin is not generating frequency, because OCR2A is busy holding TOP value. It can hold either TOP value or output compare value. So I should use OCR2B.
H: 10A power suply, high frequency An EL wire consume ~10mA/m, and need a 1800Hz, close to main voltage, sinusoid supply. (The noise is not a matter as the EL wire itself will cut off the frequency >2kHz). for an installation I would like to power 1km of wire. Therefore I would need a 10A supply to power in order to do that. What is the simpliest way to do such high-power sinusoid power supply ? I thought of : amplifying a low-power sinusoid signal. using a H bridge controlled in a way it will get a noisy sinusoid. I'm trying to see if it is easy to do, or if it would be cheaper to just buy a bunch of 5 to 10 meter EL wire driver... AI: For the frequency and power you are looking for, a off the shelf audio power amplifier should do it nicely. It would be best if you can use parallel/serial combinations of this wire to get around 8 Ω impedance, since that is what the audio amp will be able to drive well. Too low a impedance, and the amp will not work well, be inefficient, and possibly even shut down. To high impedance won't hurt anything, but it will be hard to push significant power into it.
H: "low current", "high efficiency", "high intensity" LED's "low current" "high efficiency" "high intensity" ... ? I read these terms in various places and every single time the LED's are just used as a signaling LED in a small circuit, requiring only a few milliamps to light up. What is the difference? Or is it just marketing speech from different manufacturers? AI: The terms listed do have relevance, albeit limited: There are no globally mandated benchmarks, I believe, for what constitutes low current, or high intensity in an LED. In general, "middle-of-the-road" LEDs are usually specified at 20 to 25 mA. Thus, an LED that glows at nominally "full" intensity at 5 mA (maybe even 10) would be considered low current. Over successive generations of LED technology, the luminosity per Watt for LEDs has increased steadily - to the extent that "Haitz's law" observes that light generated per LED in each color increases by a factor of 20 per decade. Some manufacturers market their 100 Lumen/Watt and better LEDs (post 2010) as "High intensity", but that too is clearly a moving target. High efficiency in LEDs - (warning, moving fully into speculation-space) would be a measure of the light generated in ratio to wasted heat - Of special significance for large high-current LEDs as used in lighting fixtures, where significant design effort goes into cooling / heat-sinking design for the LEDs. Higher the efficiency, lower would be the cooling cost per lumen of light. Where does one draw the border on this? The marketing folks would have to say. In summary: Until global standardization of these terms, and compliance with such standards, this is essentially marketing-speak.
H: Options of Button Labeling I've made a few electronic devices, and most of them had buttons or switches, but I had to rely on my memory to remember which button did what. What kind of hardware options are out there for labeling switches and buttons other than masking tape and ink pen? Do they make switches with text on them? What about those silicon cover masks? AI: I've always found the modern-day label makers to be very useful for this for prototypes. There are a variety of color options by changing relatively inexpensive tapes. You can also make front panels with the text cut right into it, if you want to spend the time and money, like at frontpanelexpress.com. Of course, you can buy switches with whatever label you want on them, if you're buying large quantities, but I imagine that's not cost effective for prototyping. You can buy switches with programmable displays that use LCDs or OLEDs! As an aside, good for you concerning yourself with usability issues! Every engineer should read The Design of Everyday Things and think about their human interfaces!
H: rotary switch / turn knob? how to call it? Im looking for a switch-like rotary knob, that i can turn left and right. Its outputs a simple 'pulse'. You find these in selecting/setting numbers on assorted electronics. You can keep turning them (both directions), there is no absolute '0' point. But i need to know, if you turn left or right. Its for a simple Arduino project, i want this rotating know/switch to increase the number on a LCD (turning right) and decrease the number when turning left. But whats the name ?? Thanks. AI: (Incremental) Rotary encoder switch, aka "quadrature encoder". It has two outputs that are 90 degrees out of phase. Due to the phase difference you can figure out both direction and number of steps. Same principle is used in a mechanical computer mouse. Rotary encoder on Wikipedia
H: What potentiometer should I choose? I want to create a sound amplifier with the LM386 and I need a potentiometer. I don't have a clue what I'm doing (:P) but I've printed out the datasheet (for the LM386) and had a look at it. So I need a potentiometer, with a knob since I'm going to create a casing for it all :) Also, I'm planning in stereo, so that's 2x LM386 but I don't want two volume controls. How can I hook that up? AI: There are many kinds of potentiometers. As a rule of thumb, for audio, pots generally range from a resistance of about 10K to around 1 megohm. I.e. where a pot is going to be needed, you design that part of the circuit for some higher impedance like that. Controlling two signals with one control is done with a "dual ganged" potentiometer. This is actually two completely separate potentiometers of the same value which are assembled onto one shaft, so that they turn to the same position at the same time. Pots can be linear (resistance proportional to turn angle or slider distance) or have a nonlinear response for audio. What this means is that as you increase the volume, the resistance builds slowly at first and then faster: the resistance curve is not a straight line but a curve which dips below the straight line. If the resistance is linear with respect to potentiometer motion, then the volume swell appears nonlinear as the potentiometer is moved. Most of the volume increase occurs in the early part of the pot travel and then slows down. Nevertheless, if you're designing the entire circuit (not just replacing a pot in existing equipment), it's best to stick with linear pots. Nonlinear pots tend to be inaccurate, especially the cheaper ones. An approximation of audio response can easily be obtained by choosing the impedances of surrounding parts, in conjunction with a linear pot. If you drop the audio signal across a 10K pot, and then from the wiper of that pot, you go into a 10K impedance (1:1 ratio), that pot will have a mild dip in its curve, like a mild audio taper. This design violates the rule that a source impedance should be at least 10X smaller than the load, but deliberately so, to obtain this effect. For a deeper audio taper, try a 20K pot facing into a 10K impedance (or any 2:1 ratio). Scroll to the bottom of the answer, where there are some images made with GNUPlot which show the effect on the potentiometer curve of different impedance ratios. Pots are made from different materials. The common, cheap pots have carbon elements, but even among those, the quality varies. Better, more expensive pots use conductive plastic or "cermet". Carbon pots made by Bourns are rated for a lifetime of 15,000 turns, whereas their conductive plastic and cermet ones are typically specified as 100,000 turns. Pots have attributes which make a difference when you're assembling your circuit into a chassis. Some pots are designed to be soldered onto circuit boards. They can be panel-mounted, but it is somewhat difficult to solder hookup wires to these: you want pots with solder lugs: flat legs with donuts on the ends into which hookup wire can be inserted. Shaft length can be a nuisance. When you mount a pot you may find that the knob isn't flush with the panel because the shaft is too long, requiring it to be cut to length with a hacksaw. If you order pots online you can select all these attributes, but if you want a pot today, the selection in your local electronic shop may not be that great. The pot in the value you want might have PCB pins only, or a shaft that is too long. Select the knobs together with the pots and fit them together before paying. The LM386 is a very low quality part in terms of noise and distortion,so I wouldn't spend more than a dollar on a no-name-brand potentiometer. There is little sense in getting a Bourns (carbon or otherwise) to go with the LM386. A non-name carbon unit from the random part bin of your local electronics store, or something pulled from discarded equipment. Okay, here are some images related to pot impedance. The horizontal axis is the position of the potentiometer wiper, from 0 to 1 (all the way). The input signal is assumed to dropped to ground across the full resistance of the pot, and the output of the pot is taken from the wiper. The Z axis (receding into the page) shows the load fraction of the impedance that the wiper faces, divided by the impedance of the pot. The first image shows ratios from zero to 1. So it shows what the curve is like for small loads, all the way up to 1:1 (like the 10K pot going into 10K situation). At 1:1, the curve is quite straight already: the dip is very mild. This second image extends the scale, showing increasing load impedances all the way up to 10X the pot impedance:
H: Multiple clients listening the UART TX line I'm building a DMX device and am thinking about paralleling the workload amongst several microcontrollers. The device has to support 24 PWM channels and I'm afraid, I won't be able to service all 24 channels (software bit angle modulated) in one atmega MCU. Is it possible/right to hook up several Atmegas to listen on the TX line after RS485 receiver or must I put a separate RS485 receiver on every MCU? My idea is that the first MCU will have an address DIP switch and set addresses to later MCUs via SPI or I2C, then all of them will listen to the same TX line comming from one RS485 receiver and act as they should when they receive their own addresses. (On DMX bus values for all the 512 channels are repeated over and over again) Is this doable? I think I would have no more than 3 parallel MCUs listening to the same line. AI: If we look at the MAX485 specifically, the datasheet says that the receiver short-circuit current is up to 95 mA. I think we can take this to be an estimate of the driving ability from the RO pin (receive output). If you have three devices listening on this, it's just a matter of the resulting input impedance being high enough so the RO pin isn't overloaded. According to the Atmega datasheet ( http://www.atmel.com/Images/doc2503.pdf -- am I looking at the right thing?), the port pins have programmable pull-up resistors, so that if they are used as inputs, they source current when pulled low. This pull-up resistor should be turned off for the pins that are obtaining the receive signal, so that they are in the "Tri-State/High-Z" state (table 20). How high "High-Z" goes isn't specified, but since this is a CMOS chip, that is likely so high that you don't have to worry about bogging down the receiver.
H: Does calibration involve fixing electronics or mechanical part? My question is not 100% related to electronics design but it might be because I don't know the answer. I'm writing a simple research on anemometer calibration. The thing is all the resources I found are explaining the procedure as measurement setup and comparing with a reference but not fixing. For the sake of clarity I posed my question with the following scenario: Let's say I followed the setup procedure, collected all the data and measured the anemometer's speed changes with respect to a reference and drew a regression line for the anemometer. But how will then actually fix this anemometer mechanically or electrically? The papers don't mention it. Is measurement and data acquisition enough for calibration? How will the anemometer function in a different (proper) way after these steps if there is no mechanical or electronic adjustment? Will the adjustment (fixing) be on software or electronics circuitry? I mean: What will be the actual adjustment for an anemometer after collecting the data with respect to a reference? I'm really confused. Any ideas? AI: One way to use the calibration is to make no physical adjustments to the device. Simply do a mathematical adjustment to all the measurements you take with the device. For example, an anemometer measures windspeed. Say you have a 5 mph reference flow and a 10 mph reference flow. Say in the calibration measurement, the 5 mph flow measures as 6.5 mph and the 10 mph flow measures as 12 mph. You then determine that the measured speed (I'll call it vm) is related to the real speed (v) by \$v_m = 1.1v + 1\$ For your "live" measurements you'll reverse this formula to get the real speed in terms of the raw measurement: \$v = (v_m - 1) / 1.1\$ So if you get a raw measurement of 8 mph, you use your calibration to estimate that the real speed was about 6.4 mph. Of course the correction I described is based on a very simple, linear model of the instrument errors. In the real world, you might need a more complex model to get a correction formula that gives really accurate measurements.
H: Giving device variable input/setting capabilities I am working on a device which allows the user to set a certain variable value. So instead of turning something on or off, the user can set a value at some point on a continuum. For example, suppose I have a microcontroller that blinks an LED every x number of seconds. The user can select any value between 1 and 10 seconds, simply by turning a knob of some sort. The microcontroller would interpret the 'position' of the knob, and accordingly set a value for the delay. So I looked around at electronics I own which posses a similar capability (things like radios, speakers, fans, etc.). I noticed that some of them use what I now know as a potentiometer. Sorry if this is really beginner level stuff. I know I can use the potentiometer to retrieve an analog value, and I can confirm that this satisfies my objective perfectly. So what I want to know now is if there are other ways to achieve the same result, or are potentiometers the best and most economical way of doing this? My preference would be to have a knob like mechanism, or sliding mechanism. AI: You could use a potentiometer (pot) for this, but they are typically continuous in their output where it sounds like what you want is discrete values. To use a pot you would need to use it in a voltage divider and set bins (voltage ranges) for the various values you want to set to, and read in the output of the divider with an ADC. To set this you would adjust the pot until value of the output falls in to one of the bins. This person made a pretty neat feedback system for this idea. You can also buy pots with detents, detents are mechanically set positions through the turn. Alternatively you can use a rotary encoder, they're those knobs that spin forever in either direction and "click" in to set positions along the way, also by use of a detent. There is a wide variation in encoders. I've recently used these ones. Basically you can continue turning these around and around and they send pulses to your microcontroller letting it know which way they are turning (this is a slide set explaining how they work). By counting these turns in the respective directions your microcontroller can set values. For instance turning right increments the value while left decrements. This is nice when you want to use one knob to set variable ranges, a solution you can drop in to most projects that need a knob.
H: pre amplifier voltage clipping the input voltage is from mp3 player. Now, why is that when the input voltage is around 5 mv pk, there are no clipping issues but if we change the input voltage to around 400 mv pk(which is common in every mp3 player including mobile phones), there is severe clipping as described below in the picture. here, we can see there are no clipping issues but here, we start to inject the mp3 player as the voltage input (400mV) AI: The R1-R2 voltage divider biases the base of Q1 at about 1.17 V. A 0.4 V excursion below that puts it at 0.77V, which would normally keep it in forward active mode. But the 100 uF capacitor is preventing the emitter voltage from changing, keeping that node at about 0.4 V. That means you only have 0.3 V across Q1's b-e junction at the peak of your input signal, which will pretty effectively put the BJT in cutoff mode. Having the BJT in cutoff mode will put the Q1 collector at about 10 V, not sensitive to the exact level of the base voltage. And that flat top at 10 V (after a shift going through the C2(?) capacitor, is what you're seeing as clipping. It might be slightly clearer what's going on if you remove C2 and just directly connect your virtual oscilloscope to the Q1 collector. Then you'll see the actual level where clipping occurs is about 10 V, making it slightly easier to diagnose the problem. (I'm assuming the virtual oscilloscope has a "perfect" input and doesn't cause any loading on the circuit) You can probably reduce or eliminate the clipping by removing Cb. This will allow the circuit to behave like an "emitter-degenerate" amplifier at the frequency you're running it, reducing the gain as suggested by Anindo, and increasing the input impedance as a side benefit. You would still expect to see clipping if you increased the input amplitude to about 0.5 V (1 V peak-peak).
H: How to properly set up a multimeter to measure the power consumption of a computer? From what I understand, a multimeter can be used to measure the resistance in in a circuit. Multiplied by the voltage, measured in the same circuit, I would get the total power consumption. Is this correct? I want to use an inexpensive multimeter to measure the average power consumption in an appliance (computer). I was thinking that it should be possible to achieve this by connecting the "measuring hands" of the meter to the connectors in the power socket, and then over a couple of minutes measure first the average voltage and then the average resistance. Then, multiplying these values would give me an approximation of how many Watts a device is using in a given time period. AI: A computer or other appliance power supply is not a resistive load, it is a reactive load. It has a phase relationship to the incoming voltage, which is itself an alternating (AC) voltage. AC voltages inherently show an "average" of essentially zero. What is measured for power computation is an "effective" or "Root Mean Square" (RMS) voltage across, and current through, the appliance power feed. Therefore measuring the resistance across its power supply leads will not provide meaningful results. At a simplistic level, Voltage measurement could be done with a RMS voltmeter across the supply leads. See this EE.SE answer for more details. Current measurement would need an RMS current meter either inserted into the power line in series, or using a clamp-type non-invasive current sensor. Low cost AC power line meters use a basic rectifier circuit and internal computation to indicate power consumption. These are designed for specific power line types (e.g. 110V 60 Hz, or 230V 50 Hz), and will deviate from precision if used on a different line frequency, if they work at all. The above does not take into account Power Factor calculations, another element impacting actual power consumption calculations. The proposed multimeter approach will yield nothing except possibly a damaged multimeter and the risk of electrocution if you are not qualified to work with mains voltages. There are commercially available power meter devices that plug into your wall socket, with the appliance plugged into the device, and log or display power consumption. That would be the recommended way to go.
H: Driving P-MOSFET with Netduino I've read quite a lot of threads here about P-MOSFETS and how to drive them properly from IC but still have some questions. Here's the schematic: Some useful values from MOSFET datasheet Vgs(th) -2..-4 V Rds(on) ~0.07 Ohm C ~1.5 nF Schematic will be used to control a lot of common-anode RGB LEDs and current will be around 1A, so 60V/28A(max) MOSFET may be an overhead but that's what I got. Can you please help me with the following 1. Will the schematic work as it is without NPN transistor controlling MOSFET gate? 2. Do I actually need current-limiting resistor to control Vgs or just the pull-up will do it? 3. Will MOSFET saturate on Vgs ~ -5V? 4. Will MOSFET close on Vgs ~ Vd - Vs = -1.7V? 5. How does the value of Pull-Up resistor affect how quickly I can switch MOSFET on/off (is 100Hz achievable?) AI: In general, simulating your design should answer that. Free tools like LTSpice or Qucs can be used for the simulation. The limiting resistor is good practice. The pull-up resistor does not limit current drawn from the microcontroller pin to the Gate. This current may spike beyond the MCU's pin maximum if directly connected, for charging the 1.4 nF input capacitance of the FET. A 180 Ohm resistor will be sufficient to limit pin current to under 28 mA, safe enough for many MCUs. No. The Transfer Characteristics graph indicates a Vgs of around -6 volts required to saturate this FET, for Vds = -30 Volts. For Vds = -5 Volts and Vgs = -4 Volts (not -5V, see next point), the On-Region Characteristics graph indicates a current of well under 2 Amperes. It should, as the rated minimum Vgs.th is -2 Volts, while the voltage divider formed by the 2 kOhm pull-up and the 500 Ohm current limiting resistor gives Vgs values of -1.36 Volts and -4 Volts respectively for MCU pin high and low. The problem you will face is at the pin=low part. Yes. The maximum switching cycle (turn-on + turn-off) for FQP27P06 is (45+380+70+190)=**685 nS**. Thus worst-case switching frequency is around 1.46 MHz (Vdd = 30 Volts, Rg = 25 Ohms). Allowing a hefty margin for the much lower Vdd = 5V and the 500 Ohm current limiting resistor, 15 KHz switching is definitely safe to aim for, much higher than the target of 100 Hz.
H: Switching speakers between multiple audio sources I have a xbox and a PC, and I want to connect them both to the same speaker set (Logitech 2.1). Guessing I need a switch and found this one. But I have no clue if it's any good for audio (regarding the contact rating). Could anyone comment if this is a good switch? What do I need to consider? AI: Audio outputs accepting stereo 3.5mm TRS connectors will have 2 separate channels - the tip for left signal channel and the ring for right channel. Thus on a minimum, you need a dual pole (two channels) double throw (two devices) switch to toggle between the Xbox and PC. For the safety of the circuits in the devices, one output device must be disconnected first from the speaker before the other will be connected. To do that you need to specify a "break before make"/BBM switch. The sleeves of both devices will share the same ground going to the speakers. The switch that you found is a DPDT (dual pole double throw) and from its datasheet (model STA 206 P) has an on-off-on contact pattern or 3 positions (device one, none, device two) which satisfies the BBM requirement. You can use that switch and ignore contact ratings - the current of the audio signal is magnitudes smaller than the typical capacity of miniature toggle switches.
H: Role of current source in comparator I have this schematic of a quarter of the internals of an LM339 from this site I want to know what the purpose of the four current sources are in this circuit, and how might they be implemented? I know current sources can be implemented as the following; op-amps (not useful to this particular circuit or we would end up nesting opamps within opamps within opamps); a JFET "constant current diode" (also unlikely, as the LM339 is bipolar); a BJT current source, which I believe to be the most likely candidate in this device. What happens to the circuit if the current sources are not present, or the supply isn't able to source enough current? I've tried simulating the circuit - warning, the simulation runs very slowly and fails when you make adjustments to the input voltages, which is either a bug in the simulator or I don't understand what I'm doing (most likely the latter) I intend to implement this circuit using discrete components for learning purposes. AI: Q1 and Q4 are voltage followers. The function of the 3.5-µA current sources on their emitters is simply to provide their operating current. Keeping the current constant improves their speed. Q2 and Q3 are a differential pair, also called a "long-tailed pair". Both the differential gain and the CMRR increase with the value of the shared emitter impedance. A current source has very high equivalent impedance (ideally infinite), which is why it is used here. Q7 is a simple common-emitter amplifier. Again, its gain is directly related to the collector load impedance, so a current source is used here for high gain. As far as implementation, the IC designer has more flexibility than you'll have with discrete parts. Usually, a bipolar current-mirror circuit is used (similar to the Q5-Q6 pair shown above), with one "master" transistor setting a reference current used by several "slave" devices. The current sources you see are all slave devices, and the different currents are set by designing those transistors with different sizes (emitter areas). The ratio of the slave emitter area to the master emitter area determines the slave output current relative to the reference current.
H: Using a TLC5940 to control LEDs with different forward voltages I am trying to build an LED matrix (64x32) of RGB LEDs using a TLC5940 current sink LED driver. The forward voltages of the LED components for each RGB LED are: R: 1.8V G: 2.8V B: 2.8V The driver maintains a specified current which helps because I can supply 3.3V to all LEDs. This however means the TLC5940 has to dissipate the extra power. Can I provide the R and GB components with 1.8V / 2.8V respectively (regulated down with a more efficient switching circuit) and still have it go to the constant current source driver? In other words, can the supply voltages to the R and GB components be different if they are being sunk into the same current source? AI: The TLC5940 requires a minimum headroom (anode voltage applied to LED) of about 0.7 Volts greater than the LED's Vfwd for driving 60 mA, and 1.2 Volts for 120 mA. If the headroom is lower than this, the channel is detected as an open LED. Actually, "open" is detected at 0.4 Volts or lower headroom, but that's a minor detail. In discussions on TI's E2E forum, it has been confirmed from time to time that individual channels (LEDs) can be sourced by differing voltages, as long as the headroom requirement is met. Another suggested method of reducing the surplus voltage across the TLC5940 driving transistors, is to use an external resistor for each LED, calculated to reduce the maximum current (if the TLC5940 were replaced with a short circuit to ground), to a bit over 10 mA more than the intended LED drive current. That way, the excess voltage is dissipated across each resistor, rather than across the LED driver IC.
H: Inaccuracy of a RS-232 baudrate I write a simple software implementation of UART for my ATtiny. My CPU isn't fast, so I should choose low baudrate. Nevertheless I want to use as high baudrate as possible. And I can estimate the inaccuracy of a baudrate in the my implementation. What is the maximum possible relative inaccuracy of a RS-232 baudrate for correct communication with other devices? Does the RS-232 standard define it? AI: I don't know if there is a formal definition. But consider this: An RS232 character is about 10 symbols long (start, 8 bits, stop ). If you start decoding halfway through a symbol, and your clock is 5% off, after 10 symbols you will have drifted off target by 50% of a symbol width; i.e. 5% is the maximum possible tolerable error. And that assumes the other end is clocked correctly; if it had an error in the other direction, you would decode it incorrectly. So a 2.5% error in opposite directions at each end would also be on the edge of failing. Signal integrity problems caused by cable length will only make this worse. So practically, an error below 5% will work with a "good" clock at the other end and a very short cable; for robust communications you want a clock error below 2%, and better than that to support long cables. Now find out what your ATTiny is capable of, at different baud rates and CPU clocks...
H: How to amplify MCU port output? Having the following diagram, how can I amplify output from pin 3&4 to speaker, using BC547 transistor? (source: elm-chan.org) AI: Based on the comments and responses, your requirement seems to be: Create a 2-bit DAC using 2 digital outputs of the ATTiny45 Produce an audio-frequency output by varying the 2 bits suitably Hear this audio signal on the 8-ohm speaker What you need is an "R-2R" network driven by the two pins. From the diagram you posted: Connect R15 to Vcc, and R7, R8 and R16 exactly as shown. Keep the values as per the diagram as well, 10k and 20k. Leave out the other resistors in the schematic. The junction of R16 and R8 will be the DAC output. This resultant output voltage needs current amplification to drive the speaker: An 8 ohm speaker with a 5 volt peak-to-peak signal will generate over half a watt of output, which is pretty loud - but will require anywhere from 100 to 300 mA of drive current. The MCU's pins cannot deliver that kind of current (this is with reference to your original schematic), and even the BC547 is rated only to 100 mA. If distortion of output on the speaker is not a show-stopper, you could make a Common Collector unity gain voltage buffer with your BC547 to generate the speaker output you are expecting. Your speaker will be the load resistor, so no separate resistor is needed there. Your power rail must be able to supply sufficient current for this. The output will not be a perfect 4-level (i.e. 2-bit) DAC output since we have ignored biasing, but will generate recognizable sound as per the MCU pin values generated.
H: Calculating run time for a device with variable current draw I recently built a small microcontroller-based project for a friend that consumed different amounts of current at different times. I wanted to calculate the run time for a given battery type (but discovered the area of my brain that used to know algebra seems to have gone missing). The device draws 2mA of current for 2s, then draws 20mA as it sequentially lights LEDs for 500ms. I originally tried to calculate the average draw: In 3 seconds it consumes (2 + 2 + (20 * 0.5)) 14mA or an average of 4.67mA per second. Therefore, a battery with 2400mAh should be able to power the device for (2400/4.67) ~514 hours or 21.4 days. This math seems incorrect to me, though I am not sure why. I didn't expect the run time to be over a few days. Whether my calculations are correct or not, can you explain a simpler or better method to calculate run time for circuits with variable current draw? AI: Your calculations are slightly off, as the duration you averaged over was 3 seconds, not (2 + 0.5): (2 * 2 + 20 * 0.5) / (2 + 0.5) = 5.6 mA average current draw 2400 / 5.6 = ~ 428.6 hours = 17.86 days running time This is a good enough method of estimating run time. Actual results will vary due to battery condition, charge status, temperature changes, and of course whether your current measurements are reliable and repeatable.
H: LED current limiting resistor and Ohm's Law Yesterday I was trying to figure out how many ohms of resistor should I be using for my LED, and found this post right here in the forum. The formula states that one should subtract the voltage drop of the LED from Vcc, and then divide it by the target current (A), in the example, it was (5-3.4)/0.005 = 320 ohms resistor should be used. My question is this: why the resistance is calculated not with whole 5V but only fraction of it? Suppose the resistance of entire circuit would be at the lowest level of 320 ohms if LED is 0 ohms, and if I used Ohm's Law on this circuit: 5/320 = 0.015625 (A), which is way off the target current I was hoping for. It's like a mystery for me, and I hope someone could really explain it to me. EDIT: Another way to put it: If one imagine a blackbox payload consumes 5V, in order to supply 5mA through the circuit, the blackbox needs to be 5/0.005 = 1000 ohms. And I know the blackbox is composed of 2 components: the LED and resistor, and the sum of their resistance must be 1000 ohms. Let R of LED is x, and R of resistor is y, they have the relationship x+y = 1000. That means whatever resistor I put in it, the R of LED automatically changes to a fitting value so their sum is 1000, is that possible? Doesn't one need to know the resistance of LED, or the LED's resistance is really dynamic? AI: All LEDs can be modelled as zener diodes with a colour/substrate specific forward voltage Vf and a series resistive Rs, where they combine both to give the Vf at rated current. Rs tends to be small so you can neglect it for approximations of adding current limiting series resistors. (see below) Therefore the current is non-linear and proportional to the voltage difference between the supply and the Vf drop at desired current. Batteries with low voltage variation are ideal such as Lithium primary cells. Most White flashlights using 3V per LED use these without series resistors as the Li cell is also 3V. However they may be specify a sorted bin of LED's to achieve this. My Rule of Thumb is to string arrays of LED's such that the voltage difference is ~1V for the current limiting Resistor for a fixed regulator. If the supply range has a wide range, e.g. 10 ~15V then a constant current sink circuit is best. Additional Info For more accuracy over a wider range of currents, you can determine the Rs value from the specsheets for a given temperature. The Vf forward voltage also is a function of temperature which affects the results slightly. THe Rs of LED's is much lower than the dynamic Rs of Zeners using silicon junctions. 20mA HB devices are <20 ohms. 300mA HB devices are < 2 ohms. 1Amp power modules are ~ 0.3 ohm. Rs for LED arrays , add in series, and divide in parallel. Old technology LEDs were much higher Rs values. Rs will reduce as the current increases but you can approximate it at the 10% of rated current value and extrapolate if the device stays at constant temp. Because of the Shockley effect with voltage variationmyou can actually calculate the junction temperature from the voltage drop of a calibrated LED.
H: 4 Digit LED Display usage I have a 4 digit LED display that I would like to integrate into my project, but only has 12 total pins when there are 4 digits. I am a beginner so I do not know how or which pins to power in order to display the required digits. Here are a few images of the LED Display. The number on the side is LD-5461BS. If there is a configuration manual for this particular LED display, that would help as well. AI: From some Googling this seems like a commonly produced module based around the CA-5461BS chip. It might have many manufacturers like the HD44780-based LCD module. To summarise it's behaviour, it consists of four separate digits with a separate anode per digit and shared cathodes for each digit. See page 3 of the PDF.
H: Data transfer between FFs in a CPU I was in computer organization lecture and when we wrote what the CPU does during an add instruction (like micro instructions) something got me thinking. I didn't understand how we let one of the FFs output to the internal bus and tell other FF to latch the data in. If we send the control signals at the same cycle how is the latter one latches the data in at the same time? Isn't it violating the setup and hold time? AI: Not necessarily. Bonus points for knowing that an input to an FF has as setup and hold time specification, by the way. But for many designs of FF the hold time can be 0 ns, i.e. you don't need to hold the data for ANY time after the clock edge. (When designing the FF, you can guarantee this - just make sure you use slower transistors or longer wires on the input, and faster on the clock!) Now the clock latches the data, but that process takes some time - called propagation delay, or clock-output delay - and then the wire to the next FF adds some delay of its own. So the next FF doesn't see its input changing until AFTER this time, certainly greater than 0 ns, so this is safe. (If it isn't greater than the actual hold time you ARE in trouble!) The setup time is less important at this stage; since the previous FF output changes just after the clock edge, it has almost a whole cycle to get here. Calculate clock cycle time - clock-output delay - wire delay - setup time and if the number is positive, that's safe too. Setup time matters when you start adding gates or long wires between FFs; these add more delay. So when that sum becomes zero, the clock is too fast! (There is another aspect; clock pulses arrive at different FFs at different times; for an accurate calculation you need to account for this "clock skew" in both setup and hold time calculations). So you're not wrong; these are real issues but they have solutions. And chip design involves a LOT of these calculations (mostly automated by the tools, in FPGA design) - called "static timing analysis".
H: Can I half the current rating when moving from 100-240V to just 230V? I am repairing a failed ATX computer power supply (PSU). It is rated 100-240V 9A input, 620W max output. Its 10 A bridge rectifier is dead, and I am able to get at most 8 A bridge rectifier as a replacement. 8 A is not 10 A, of course, but I live in Europe, we have got 230 V in mains, so my idea is simple: If the PSU is designed to work in a wide range of voltages from 100 V to 240 V without a manual switch, its 10 A circuitry is probably needed only for 100 V, but not for 230 V we use here in Europe. So I think I can safely put there 8 A rectifier bridge, or even go as low to 5 A or possibly even to 4 A without any problems. Is my idea correct? I also replaced the blown 10 A glass fuse by a 4 A ceramic one, it should be just enough for the PSU and also can help to protect my 8 A replacement bridge from possible overcurrent. My math: Originally 100 V, 10 A => 1000 VA. Now 230V, 4A fuse => 920 VA. I tried it in praxis, it seems to be fine and working (under normal conditions, not fully loaded). So this is rather a theoretic question, I'd like to understand it. Update: If somebody is interested, it is Seasonic SS-620GB (S212II Bronze) ATX PSU. Also, there is a fuse information on its printed board saying that 200-230V variants should be fitted with a 5A "H"-rated fast blow (T) fuse. I used the correct H T type. Original bridge was GBU 1006: reverse current 5 microA, forward surge current 220 A. The replacement is KBU 805: reverse current 10 microA, forward surge current 300 A. AI: You might get away with the 8A rectifier but you have to match other specs as well. There is one (ISSm on some datasheets) which is effectively a short pulse inrush current rating. For the 10A rectifier it's probably 200A, possibly more. When you switch on, the reservoir cap acts as a short circuit across the mains for a moment; no transformer to soften the blow like the good old days - and this inrush current is probably worse at 230V, not better... I'd pay the extra for a 10A bridge.
H: What are these on power supply cables? Possible Duplicate: Name of this component I've noticed that on many home electronics there are sometimes power supplies that have a bulky unit attached to the cable. I don't even know what these are called to be able to search for them. What are these called? What purpose are these for and why do some gadgets have them and other not? Below are are some examples highlighted in red AI: These "Common mode chokes" are better described as ferrite cable cores. Ferrite beads are more commonly used with single wire. Even though the cores have evolved into larger cores one still sees the old desscription as "beads". These are the most widely used materials in EMI solutions. They serve to reduce egress as well as ingress on cables to isolate high frequency noise from interference. Since cables contain both paths the net current is zero for DC and low frequncy but at high frequency the common mode impedance of the cable is increased much higher than the differential impedance which is mostly unaffected. For this reason they are mandatory on all VGA video cables in order to pass the FCC/CE standard noise emission tests and used on SMPS power supply charger cables to reduce (but not eliminate) common mode hum causing interference with high impedance inputs. (mics) Ferrite beads come in many different forumations with relative permeability ranging from 100 to 10k using Zn, Mg, & Fe oxides that can be formulated to be high Q low loss (more like ideal inductors) or very lossy high impedance 1~5k) broad spectrum or low u, high current or microwave absorbers from radar.
H: avrdude -B 3 parameter I'm new to AVR programming, I got this atmega8A chip and I use avrdude with a USBasp that I made myself, for programming it. For some reason the chip won't answer if I don't use the -B 3 parameter with avrdude, although I have reset the chip's fuse bits to factory defaults. Now my question is what is this -B 3 parameter and how can I fix this. AI: From the documentation: -B bitclock Specify the bit clock period for the JTAG interface or the ISP clock (JTAG ICE only). The value is a floating-point number in microseconds. The default value of the JTAG ICE results in about 1 microsecond bit clock period, suitable for target MCUs running at 4 MHz clock and above. Unlike certain parameters in the STK500, the JTAG ICE resets all its parameters to default values when the programming software signs off from the ICE, so for MCUs running at lower clock speeds, this parameter must be specified on the command-line. You can use the 'default_bitclock' keyword in your ${HOME}/.avrduderc file to assign a default value to keep from having to specify this option on every invocation. In my opinion this means it is not so much a 'fix', but regular setting to adjust the clock of the programmer to the clock of the receiving controller. If my memory serves me right, a factory default ATmega8 runs at 1MHz, whereas avrdude is set for 4MHz by default and thus your programmer is just too fast for your controller to keep up. This implies that when you change the clock fuses of your controller, a different -B is required for programming it.
H: Quartus II: Pin incompatible with a bank it is not on I am using the pin planner of Quartus II to place my I/O signals on my Cyclone IV pins. I am stuck on the following fitter error: Error (169029): Pin adc0_in[0] is incompatible with I/O bank 3. Pin uses I/O standard LVDS, which has a VCCIO requirement incompatible with that bank's VCCIO setting or its other pins that use VCCIO 3.3V. The Cyclone IV is organised in banks that should have the same VCCIO. The strange thing about this error message is that the pin adc0_in[0] has been placed on bank 8, not bank 3, so there should not be any contention. (Figure 6-10 from the datasheet shows that bank 8 and bank 3 use VCCIO8 and VCCIO3 respectively.) I am also getting the error Error (171169): Previous compilation results are reused as part of this compilation and may cause the error on this compilation. but I have made sure that incremental compilation is not enabled (as suggested here) and that the database folders have been deleted (as suggested here). AI: It turned out to be that the configuration device (a Max II) had pins on both bank 3 and bank 8, and was implicitly enforcing the restriction that bank 3 and bank 8 must have the same VCCIO. This was fixed by going to Settings > Device > Device and Pin Options... > Configuration > Configuration device and unchecking the box "Force VCCIO to be compatible with configuration I/O voltage".
H: DMX512 Remote controlled LED I'm having a problem with this circuit. I am trying to get an LED wash light circuit to be remote controlled via DMX512. The problem is, after I designed the circuit for the RS485 (which will deliver the DMX signal to my LED circuit) my professor told me that there's no time to make it and that I should just buy it. I couldn't find a descent one to buy. I am also not sure if I should connect the LEDs with parallels or using a darlington pair? I have attached the circuitry for the RS485. Also, the options I have to connect the LEDs, not even sure which microcontroller is the best for them. Any help? It's also 5 - 9 LEDs. AI: Be sure to terminate RS485 at both ends. 54 to 100 ohm range. To switch LEDs on, Choose the number of LEDs by forward voltage at rated current to add up like zener diodes and allow ~1V for current limiting resistor for fixed regulator (use 2V drop, if using battery, say 13V with +/-1V tolerance. Vf of LED depends on colour and current. LEDs must have a good heatsink. You can choose any transistor that has enough current gain from logic level to LED. Choose MOSFET or BJTs (Darlingtons is more current gain needed as single stage BJT gain is only 10~30x typ saturated.) Alternatively use constant current sink which regulates well but less efficient than <1V Rs current limiter. Typ >2V drop min. on MOSFET) If= 0.7/Rs If fixed regulator, I would go with <1V drop power resistor for each string. For more info on LEDs see my other links. "low current", "high efficiency", "high intensity" LED's LED current limiting resistor and Ohm's Law
H: amplifier quality waveform for different transistors I have tested two transistors in multisim, the first is the default(more of generic) and the second is the 2N3904 here is the first picture with default transistor in placed and here is the corresponding waveform as you can see, its smooth, but if we use the 2N3904 (available in my local electronic store) the waveform looks like below the waveform looks heavily distorted. What should we change in the circuit so that the waveform is the same as the original transistor placed. Thanks Also, as a side note, what modifications are needed, so that the waveform is not inverted. Thanks AI: Transistors are inherently nonlinear. The local feedback from the emitter resistor in a single stage is not enough to fix this, particularly if its value is low. If you substitute one transistor for another, the load line will change. (And by the way, you have to consider the AC load line separately from the DC one, because AC sees different impedances, both through the base of the transistor and through the surrounding components, such as obviously the capacitor bypass on the emitter). Although the first trace might look like it is undistorted, looks can be deceiving. A spectrum analysis will show you the distortion products. You will not get low distortion out of a single stage, unless you keep the signal swing very small, far away from the the voltage rails. Perhaps the ultimate example of "cleanliness" in a single BJT stage would be an emitter follower, with a reasonably small input signal. If you want a virtually distortion-free amplifier, the usual approach is to combine several stages which have modest gain to produce a high overall gain, and then tame that gain with global negative feedback. Global feedback will correct for all kinds of distortion, such as nonlinearities in the individual stages. It can even nearly eliminate crossover distortion from a class B output stage, so that only a small kink or discontinuity is seen on the waveform.
H: Use USB as an on-off switch I'm looking for a way to build a zero(ish) cost intervalometer for my Canon SLR using only stuff that I have or can get very cheaply (my budget is about $4). I've already managed to "build" a wired remote for the camera, which is basically two wires connected to the ground and shutter release pins of the Canon remote connector. Touching the two wires (manually or via a switch) causes the camera to click. I also have an old Android phone lying about that I'd like to repurpose for this project, since the phone is fully programmable. A requirement for this project is that neither the camera nor the phone can be modified in hardware (i.e., no soldering to or dismantling either). Since the only wired interface in and out of the phone is USB (mini-USB on the phone, if that matters), I was wondering if a modified USB cable could be built that can be controlled via the phone's software, such that the circuit with the camera is completed or broken. Mutilating or otherwise modifying the USB cable itself is OK. I'm willing to modify the software on the phone, so if this is possible, but the software doesn't support it, I'll figure it out. Can this even be done? If not, is there an alternative way of doing this without buying a microcontroller, board and other associated stuff? I'm not a hardware guy, so please be gentle ;). AI: There's pretty much no chance you'll get all this for $4, it is not a realistic budget for this. But that's not to say it's not possible. You do need a microcontroller with USB functionality (or have it bit-banged, but USB ones are cheap enough) to talk to the Android phone. Then the Android phone could use its USB API in the SDK to talk to it and issue a command. When the USB microcontroller recognizes the 'take picture' command or whatever, it could flip a transistor on/off to toggle those wires you have and tell the camera to take a picture. But you mentioned an 'old' Android phone, that could be a problem because only newer ones running Android OS 3.0 and up have the ability to expose the USB API to talk to it. If your target phones don't run that, this isn't going to work. In that case, to accomodate most Android phones, even older ones, you could do this over Bluetooth. But that's going to raise your costs even more because you'll need a bluetooth module and power source for the Bluetooth, probably a battery, on top of the micro. But Bluetooth modules can be very cheap, here's one for $5.50 USD and they're even less in larger quantities: http://imall.iteadstudio.com/prototyping/basic-module/im120723010.html Otherwise an even simpler approach with no micro could be making a circuit with a photosensor such that it triggers the camera wires to cross when it detects some amount of light, you could vary that with a pot/resistor. Then tape/connect the photosensor somehow to your phone and program it to light up the LCD or the flash on the back (if it has one) when it wants to trigger the photo. That might be do-able for under $4 but it's not very elegant. Good luck!
H: How to inflate/deflate to create artificial lungs I'm trying to create lungs for a project I'm working on that can inflate and deflate. I'm quite new to EE and using the Arduino, so I don't have much experience to know what would be the best way to mimick lungs. I saw this video and wanted to do something almost identical to create the lungs. (Weird video, I know.) Around 1:34 he shows how he created it. I did some searching to figure out how he did it, and I found something called "pneumatic actuated muscles". I'm not really sure how this is done though, I just saw what it looks like once it's done. I'll be using a Lilypad Arduino to control the lungs since I'll be sewing it onto a shirt. That said, it would be great if the hardware to inflate/deflate the lungs could be light so as not to stretch the shirt when one is wearing it. Suggestions? It could be a really small amount of air, too. I don't mind as long as it can slightly mimic a pair of lungs. AI: You could just use a couple of servos and have them inside a bellows like structure. The servo movement would expand and contract the bellows. It would look like the bellows/lungs are inflating/deflating. No need for complex air seals.
H: signal clipped despite q point is middle Why is that the output signal is clipped despite the fact that the transistor's q point is located halfway of Vcc??? here is the schematic and clipping here From my analysis, as you can see, supply Vcc is around 40 volts and the multimeter reading of the collector voltage is around 20 volts (half of 40 so the q point / quiescent point is in the middle to avoid cut off and saturation) Finally, you can also see that the output voltage swing is around 12 Volts rms (so that translates to 34 volts peak to peak, way far from the 40 volts of DC supply voltage) Ref. http://www.mediafire.com/download.php?htnopk49oj1y9sj multisim AI: Don't forget that there is a quiescent (no-signal) DC voltage on the emitter bypass capacitor which should be roughly 6.7V if the quiescent DC voltage on the collector is roughly 20V. The negative swing for AC signals is then roughly limited to the difference, 13.3V. Since the positive swing should be 20V, this would give a maximum peak to peak of roughly 33.3V. For this circuit, if you want roughly symmetric clipping, you'll want the quiescent collector voltage halfway between 40V and the quiescent emitter voltage.
H: Multiple xbees on same network I have been looking at xbees recently but can't seem to find a tutorial on configuring and programming for 3 xbees on the same network - 1 to act as a master the other 2 respond as slaves, but the slaves will do separate functions such as one could be a device for turning on a light the other could be a sensor. So here are a couple of questions: Is this possible? What terminology should I be using when searching for this as i feel that this where my research is going wrong. How are the 2 slaves addressed across the network? AI: My answer here may help: The appropriate code (Arduino) of Xbee Once you have one master and one slave like in that answer, repeat the slave configuration steps for the second slave. Then: To send from slave to master, just send the data. To send from master to a slave, set the master's DH and DL to the slave's SH and SL respectively, then exit command mode (ATCN) and send the data. To send to the second slave, do the same but using the second slave's SH/SL. Note that when you use AT mode and the slaves send simultaneously, the bytes may become mixed at the master. E.g Slave1 sends "hello", Slave2 sends "there", master gets something like "hethelrloe" (painful own experience. :) At some point you will end up needing API mode, but AT mode is a very good, simple, way to start. The tools and tutorials I found useful on XBee, I gathered them here: http://erion.elmasllari.com/2012/06/in-the-trenches-with-xbee-resources-and-tips/ Good luck!
H: Arduino: why does Serial.println(int, HEX) display 4 bytes? An int is 2 bytes but Serial.print with HEX or BIN formatting outputs 4 bytes: int x = 0x9876; Serial.println(x, HEX); // output is FFFF9876 Why? (and what is a good way to print out only 2 bytes) AI: The Arduino print / println function casts the int to a long, which is 4 bytes long for Arduinos. See here: https://github.com/arduino/Arduino/blob/master/hardware/arduino/cores/arduino/Print.cpp To have more control over printing check out the C++ sprintf function. For example, int x = 0x9876; char buf[9]; sprintf(buf, "%04x", x); Serial.println(buf); Will print it out correctly. sprintf - http://www.cplusplus.com/reference/clibrary/cstdio/sprintf/ format string reference - http://www.cplusplus.com/reference/clibrary/cstdio/printf/ Some implementations of the Print class, include printf (Like Adafruit's, see here). In that case, you just do Serial.printf("%04X", x).
H: Lower Vcc of power amplifier and still provides 30 watts The above circuit is a power amplifier delivering roughly 30 watts (11.7V times 2.9A) in the 4 ohm load (assuming its a speaker). When we look at \$V_{cc}\$, it looks huge when compared to electronics books providing only 9, 12 \$V_{cc}\$. Can we lower the \$V_{cc}\$ so that it still delivers the same amount of power? I'm planning to use voltage regulator ICs like LMxxx18 which regulate 18 V DC so I'm planning to make \$V_{cc}\$ equal to 18V also. For the speakers, is the current flowing through the speakers that determine its loudness? We can still get 30 watts of power across the speaker but the sound generated might be miniature, so is it the voltage or current that determines loudness? AI: The problem of achieving higher peak to peak voltage than the voltage available on the rails is common in audio amplifiers, especially in car audio. The simplest solution is to configure two identical amplifiers like your schematic, in a Bridge Tied Load configuration. Put simply: Connect your speaker between the outputs of two such amplifiers, with no ground reference, and feed the two amplifiers with signals that mirror each other. (from Wikipedia) A brief description of BTL amplifiers is here. Below is a less brief explanation of my own, if you want one. Also, this question has some additional information and links that may be useful. A Bridge Tied Load (BTL) amplifier consists of two identical amplifier blocks, fed by an input signal in antiphase, and with the load (speaker, transducer etc) connected between the two amplifier outputs. Since the signals at the outputs of the two amplifier blocks are mirror images of each other (180 degrees out of phase), the effective signal seen by the load is twice the signal each amplifier produces. This is specially useful when the supply rail voltage(s) available for the amplifiers is too low to provide sufficient peak-to-peak voltage for the output power desired. A common such situation applies to car audio amplifiers, where a 12 or 14 volt supply is available, and the desired output power requires a higher peak to peak voltage than that. Another application of bridge tied load amplifiers is when the load impedance is higher than that supported by the individual amplifier blocks. Since the effective impedance seen by each of the matched amplifier blocks is half of the actual load impedance, such an amplifier configuration allows use of loads up to twice the supported output impedance per amplifier. As noted in Wikipedia, one common fallacy with Bridge Tied Loads is the assertion that the resultant power of a BTL amplifier is 4 times the power output of each amplifier. This is incorrect: While the voltage across the load doubles, the current remains the same. Thus, for P = V x I, while V' = 2 x V, P' = 2 x P. Another way of looking at this is that the doubled voltage is developed across an effective load twice the load impedance seen by each amplifier. Thus, power delivered by a BTL amplifier is merely double that of a single amplifier. However, this 4 x power myth has been propagated widely in audio DIY circles, to the extent that an opposing assertion is likely to be received with disbelief or derision. It is an old chestnut best left undisturbed when addressing a "believer".
H: RS232 to UCB using cp2102 chip Long times ago I bought on the ebay a cheap rs232->usb converter, today I wanted to use but I realized that I don't have the pinout. This is the converter how can I figure it out the pinouts, does anybody has experience with this? AI: Since USB does not have negative voltages, I think it's probably unsafe to assume that pin one is ground. I would guess that the pin you say has -3.3V is actually ground. You can confirm this by measuring the resistance between the pins and the USB ground pin (you may need to cut up a USB cable. Alternatively, the USB shield may be grounded, so try just probing with one lead on the USB connector metal casing). Going from there, I would write a little script that outputs a continuous serial stream, and poke around with an oscilloscope until I found the TX line. Then, I would take a device (an arduino, for example), and set the arduino up to output a continuous stream of serial bytes. Then, with a 10K resistor in series with the arduino TX, you poke around on the pins until you see that you are receiving data from the USB-serial interface. That will tell you where the RX line is. The alternative option is simply to trace out the PCB traces. The CP2102 datasheet is freely available, and I doubt that board is more then two layers. It shouldn't be too much work to follow the traces back from the connector. You may need to probe some of the IC pins to verify the path of any traces that run under the IC, use a needle in a clip-lead for that (probing the pins on a QFN is fiddly - the pins are tiny).
H: State Machine using Case getting unexpected result I am trying to write a very simple state machine that implements a combinational lock. The code is: Switch1 -> Switch2 -> Switch3 -> Switch4 I realize that it is Switch 7, 6, 5, 4 accordingly in the code. If it is not done in that order then it gives the error(incorrect) state. The problem I am having is that even though state is state_start (as I see it on the LEDs) it will not change to state_1_right and instead will just pump out the error_state. I know it does go into that if statement because I changed the else to state <= "00001010"; and it displays that. What am I doing wrong? I do not see any error in my logic (unless there is some weird switch bounce). Here is the code I am trying now: entity CombinationLockFSM is Port( Switches: in std_logic_vector(7 downto 0); LEDs: out std_logic_vector(7 downto 0) ); end CombinationLockFSM; architecture Behavioral of CombinationLockFSM is constant state_start: std_logic_vector(7 downto 0) := "10000000"; constant state_1_right: std_logic_vector(7 downto 0) := "01000000"; constant state_2_right: std_logic_vector(7 downto 0) := "00100000"; constant state_3_right: std_logic_vector(7 downto 0) := "00010000"; constant state_error: std_logic_vector(7 downto 0) := "00001111"; signal state: std_logic_vector(7 downto 0) := (others => '0'); begin LEDs <= state; process(Switches) begin case Switches is when "00000000" => state <= state_start; when "10000000" => if state = state_start then state <= state_1_right; else state <= state_error; end if; when "11000000" => if state = state_1_right then state <= state_2_right; else state <= state_error; end if; when "11100000" => if state = state_2_right then state <= state_3_right; else state <= state_error; end if; when "11110000" => if state = state_3_right then state <= "11110000"; else state <= state_error; end if; when others => state <= state_error; end case; end process; end Behavioral; Thank you to Brian Drummond for finding the error in my logic and suggestion of a clock. I had to add some extra logic in the if statements since the clock cycles through the case block rapidly and the state could stay the same. Here is the updated code that solves the issue: entity CombinationLockFSM is Port( mclk: in std_logic; sw: in std_logic_vector(7 downto 0); Led: out std_logic_vector(7 downto 0) ); end CombinationLockFSM; architecture Behavioral of CombinationLockFSM is constant state_start: std_logic_vector(7 downto 0) := "10000000"; constant state_1_right: std_logic_vector(7 downto 0) := "01000000"; constant state_2_right: std_logic_vector(7 downto 0) := "00100000"; constant state_3_right: std_logic_vector(7 downto 0) := "00010000"; constant state_4_right: std_logic_vector(7 downto 0) := "11110000"; constant state_error: std_logic_vector(7 downto 0) := "00001111"; signal state: std_logic_vector(7 downto 0) := (others => '0'); begin Led <= state; process(mclk) begin if rising_edge(mclk) then case sw is when "00000000" => state <= state_start; when "10000000" => if state = state_start or state = state_1_right then state <= state_1_right; else state <= state_error; end if; when "11000000" => if state = state_1_right or state = state_2_right then state <= state_2_right; else state <= state_error; end if; when "11100000" => if state = state_2_right or state = state_3_right then state <= state_3_right; else state <= state_error; end if; when "11110000" => if state = state_3_right or state = state_4_right then state <= state_4_right; else state <= state_error; end if; when others => state <= state_error; end case; end if; end process; end Behavioral; AI: The other response is correct about needing a clock. But ignore the two-process example he linked to : search in the usual places for "VHDL single process state machine" for a better solution. http://www.openhdl.com/vhdl/664-vhdl-tip-single-process-vhdl-state-machine-design.html for one.