Difference between revisions of "Got a Technical Question?"

From OpenCircuits
Jump to navigation Jump to search
(/ Transmission of an analog signal/)
 
(9 intermediate revisions by 4 users not shown)
Line 25: Line 25:
  
 
<!-- ____________________ -->
 
<!-- ____________________ -->
 +
==Question 8 ==
 +
==USB Modem run on Arduino ==
 +
29th August 2012<br />
 +
I have a Huewai E160E USB Modem which I want to use to send sms messages from an Arduino board  all operating as a stand alone system.
 +
When these devices are used in computers a program called "modeswitch" is used to switch the modem between its three states .<br />
 +
Those states are :-<br />
 +
1/ The SD Storage memory card facility<br />
 +
2/ The CD area that hold installation programs and<br />
 +
3/ The modem proper.<br />
 +
The arduino chip does not have the memory resources to hold the "modeswitch" program and hold my program. I am able to switch off the CD area by sending the right command to it and it stays off permanently but I don't seem to be able to disable the SD card memory area  permanently so that only the modem is available on power up.<br />
 +
Does anybody know if this can be done and if so how?<br />
 +
Additionally does anyone know how I could address the SD card memory from the Arduino and perhaps hold the "modeswitch" program there and run it from there when needed by the Arduino . What would the C++ code be or look like to address this area?<br />
  
 +
== Question 7 ==
 +
== accelerometers on a wheel ==
  
== Question 7 ==
 
 
Hello,
 
Hello,
 
I'm building a small machine that includes a wheel mounted on an axle.  Four accelerometers will be attached to the wheel; equally spaced around the perimeter and diametrically opposite.  The object is to sum the analog output signals to cancel out gravity but to measure simply the acceleration/decelaration of the speed of rotation.  My main concern is how do I wire up the accelerometers?  I would like to avoid slip rings if possible (the axle is 6mm diameter).  Is there a simple RF emmitter/receiver available in an IC package capable of tramitting the analog output (+/-3v) from the accelerometer?
 
I'm building a small machine that includes a wheel mounted on an axle.  Four accelerometers will be attached to the wheel; equally spaced around the perimeter and diametrically opposite.  The object is to sum the analog output signals to cancel out gravity but to measure simply the acceleration/decelaration of the speed of rotation.  My main concern is how do I wire up the accelerometers?  I would like to avoid slip rings if possible (the axle is 6mm diameter).  Is there a simple RF emmitter/receiver available in an IC package capable of tramitting the analog output (+/-3v) from the accelerometer?
 
Thanks for any suggestions offered.
 
Thanks for any suggestions offered.
 
Vielle568
 
Vielle568
 +
 +
EDIT:
 +
 +
Thanks for all the feedback; very useful. 
 +
In reference to answer 2 and concerning my project:
 +
What am I trying to do exactly?  Well I am an instrument maker and I've been experimenting with electric hurdy-gurdies.  The instrument functions by turning a crank and a wooden wheel rubs against the stings like a circular bow.  One sting creates a rythmn when the crank is accelerated and I want to replace this string with electronics.  In other words I want some kind of sensor that'll capture the acceleration pulses of the wheel that correspond to the rythmn.  I want to use this signal to activate either an analog swith or an envelope follower to control an effect for the rythmn. 
 +
The wheel is about 7" diameter and mounted on a steel axle in the heart of the instrument; it is not too easy to access but it is removable and sensors can be attached to the side faces without any problem.  Use of slip rings makes installation difficult and transmission by radio would be a better solution.  The receiver can be housed in the instrument's body beside the wheel with the other electronics. 
 +
Maybe a gyro would be a better idea than two or more accelerometers but I remember reading on the spec sheet that gyros had a limited range of degrees.  Maybe this isn't always the case?  Could a gyro continuously monitor rotational speed on a rotating wheel or would this be impossible? 
 +
 +
[[File:VIELLE9.JPG]]
 +
 +
The current system uses a series of small holes around the wheel rim and a small laser; a frequency to voltage converter sets a voltage level for the wheel speed and a comparator trips when the voltage passes a reference level; the output then triggers the analog switch.  It works OK but the circuit response is too slow for fast passages of music.
 +
 +
 +
Vielle568
 +
 +
=== Answer 1 ===
 +
 +
Literal answer:
 +
 +
There are several ways to power electronic devices while they are spinning.
 +
The most popular are "slip rings" and "mount a battery so it spins with the rest of the electronics".
 +
See "[[POV display]]" and [http://electronics.stackexchange.com/questions/12704/electrified-vertical-mounted-rotary-joint-questions "Electrified Vertical mounted rotary joint questions"]
 +
for some examples.
 +
Perhaps someone will write a "[[spinning electronics]]" page someday to list other ways to transfer power.
 +
 +
Once you have power to your rotating platform,
 +
I'm pretty sure you can power the accelerometers using the standard circuit in the data sheet for that particular accelerometer.
 +
 +
Once your accelerometers have power and are driving their output pin,
 +
there's a simple, low-cost circuit called a "op-amp summer" to sum the signals from two opposing accelerometers, to get the radial acceleration with gravity canceled out.
 +
There's a [http://en.wikibooks.org/wiki/Electronics/Op-Amps#Quick_Design_Process op-amp quick design process].
 +
I suppose if you were curious you could plow through the "summer" section of the "[[OpAmp Links]]" page, although they generally make it sound far more complicated than it really is.
 +
You're going to have various mis-matches from: accelerometers positioned not quite opposite the center of rotation; positioned not quite the same distances from the center of rotation; the accelerometers may have slightly different offset/scale errors; the resistors used to build the summer have small resistance errors; all of the above may vary with temperature, so even if you calibrate and cancel them all out at one temperature, they may no longer cancel out at a different temperature, etc.
 +
 +
So gravity won't be completely cancelled out, but I think you'll be able to get close enough -- perhaps after a bit of tweaking and tuning.
 +
 +
Since I don't know much about transmitting analog values directly,
 +
I might consider feeding the analog sum signal into a microcontroller (either directly, with a microcontroller with a built-in ADC, or indirectly through a peripheral ADC chip), then somehow transmit that digital data through visible light, infrared light, or radio.
 +
 +
There are many small, low-power microcontrollers that can easily be mounted on a rotating platform and powered by a small coin cell.
 +
Perhaps a [http://jeelabs.com/products/jeenode JeeNode] mounted on the rotating platform, to digitize the signal and transmit it wirelessly, then use a [http://jeelabs.com/products/jeelink JeeLink] to receive that wireless signal and pipe it into the USB port of a PC.
 +
Or perhaps a couple of [[Arduino Links | Arduino]] boards, each one with an XBee wireless board plugged into a [http://www.arduino.cc/playground/Shields/Xbee01 XBee Shield].
 +
Or perhaps another [http://www.glacialwanderer.com/hobbyrobotics/?p=291 "Cheap Arduino Wireless Communications"] approach.
 +
[http://www.seeedstudio.com/wiki/index.php?title=RFbee_V1.1_-_Wireless_Arduino_compatible_node RFbee] apparently has a (Arduino-compatible) microcontroller and all the wireless communication stuff on a single board.
 +
Various other wireless and infrared communication techniques [http://www.arduino.cc/playground/Main/InterfacingWithHardware#wireless have Arduino libraries available].
 +
 +
=== Answer 2 ===
 +
 +
Less literal answer:
 +
What exactly is it you are trying to do?
 +
If you want to measure the acceleration due to the spinning at some point a distance R away from the center of rotation,
 +
perhaps a simpler and cheaper approach would be:
 +
* install a single gyro. (There's some low-cost gyros mentioned on the [[Multi-rotor]] page. You can mount it anywhere on the spinning platform; it doesn't have to be exactly R from the center of rotation.
 +
* Use the gyro to measure the rotation rate "w" in radians/second. (You might have to convert from revolutions/minute, revolutions/second, or whatever weird units that particular gyro uses).
 +
* Assume that a few "laws of physics" supported by centuries of experiments will continue to hold, and calculate the acceleration due to spinning as R*w^2. That acceleration is sometimes called a "[http://en.wikipedia.org/wiki/Centrifugal_force_%28rotating_reference_frame%29 centrifugal force]".
 +
 +
== Question 6 ==
 +
Hello I have a problem with a temperature sensor it has 1 Mohm of resistance at ambient temperature and according with the specification the value has to be 2 Kohm, I think that the circuit is open but I do not why, do you Know any reason for open circuits, or for the sensors failure.
 +
 +
Measuring 1 Mohm or more on a 2 pin temperature sensor such as a [http://en.wikipedia.org/wiki/Thermistor thermistor] or a [http://en.wikipedia.org/wiki/Resistance_thermometer resistance temperature detector]?
 +
Then it's probably permanently destroyed.
 +
Sorry.
 +
I usually destroy things by putting too high voltage -- now I know 120 V is too high :-).
 +
I suppose it's also possible it failed from over-temperature or other stress.
 +
--[[User:DavidCary|DavidCary]] 17:05, 30 August 2008 (PDT)
  
 
== Question 5 ==
 
== Question 5 ==
Line 236: Line 315:
  
 
[[russ_hensel]], --[[User:DavidCary|DavidCary]] 12:51, 20 March 2009 (UTC)
 
[[russ_hensel]], --[[User:DavidCary|DavidCary]] 12:51, 20 March 2009 (UTC)
 +
 +
[[Category:Community]]

Latest revision as of 15:59, 28 August 2012

Ask Technical Questions Here ( research them first, if Google answers it, use Google, Not Us )

You may get an answer, you may not. Please Date Your question. Put the most recent questions at the top of the question list. Put plenty of detail in the question. Your problem may be clear to you, but not so to the rest of us.

Question 8[edit]

USB Modem run on Arduino[edit]

29th August 2012
I have a Huewai E160E USB Modem which I want to use to send sms messages from an Arduino board all operating as a stand alone system. When these devices are used in computers a program called "modeswitch" is used to switch the modem between its three states .
Those states are :-
1/ The SD Storage memory card facility
2/ The CD area that hold installation programs and
3/ The modem proper.
The arduino chip does not have the memory resources to hold the "modeswitch" program and hold my program. I am able to switch off the CD area by sending the right command to it and it stays off permanently but I don't seem to be able to disable the SD card memory area permanently so that only the modem is available on power up.
Does anybody know if this can be done and if so how?
Additionally does anyone know how I could address the SD card memory from the Arduino and perhaps hold the "modeswitch" program there and run it from there when needed by the Arduino . What would the C++ code be or look like to address this area?

Question 7[edit]

accelerometers on a wheel[edit]

Hello, I'm building a small machine that includes a wheel mounted on an axle. Four accelerometers will be attached to the wheel; equally spaced around the perimeter and diametrically opposite. The object is to sum the analog output signals to cancel out gravity but to measure simply the acceleration/decelaration of the speed of rotation. My main concern is how do I wire up the accelerometers? I would like to avoid slip rings if possible (the axle is 6mm diameter). Is there a simple RF emmitter/receiver available in an IC package capable of tramitting the analog output (+/-3v) from the accelerometer? Thanks for any suggestions offered. Vielle568

EDIT:

Thanks for all the feedback; very useful. In reference to answer 2 and concerning my project: What am I trying to do exactly? Well I am an instrument maker and I've been experimenting with electric hurdy-gurdies. The instrument functions by turning a crank and a wooden wheel rubs against the stings like a circular bow. One sting creates a rythmn when the crank is accelerated and I want to replace this string with electronics. In other words I want some kind of sensor that'll capture the acceleration pulses of the wheel that correspond to the rythmn. I want to use this signal to activate either an analog swith or an envelope follower to control an effect for the rythmn. The wheel is about 7" diameter and mounted on a steel axle in the heart of the instrument; it is not too easy to access but it is removable and sensors can be attached to the side faces without any problem. Use of slip rings makes installation difficult and transmission by radio would be a better solution. The receiver can be housed in the instrument's body beside the wheel with the other electronics. Maybe a gyro would be a better idea than two or more accelerometers but I remember reading on the spec sheet that gyros had a limited range of degrees. Maybe this isn't always the case? Could a gyro continuously monitor rotational speed on a rotating wheel or would this be impossible?

VIELLE9.JPG

The current system uses a series of small holes around the wheel rim and a small laser; a frequency to voltage converter sets a voltage level for the wheel speed and a comparator trips when the voltage passes a reference level; the output then triggers the analog switch. It works OK but the circuit response is too slow for fast passages of music.


Vielle568

Answer 1[edit]

Literal answer:

There are several ways to power electronic devices while they are spinning. The most popular are "slip rings" and "mount a battery so it spins with the rest of the electronics". See "POV display" and "Electrified Vertical mounted rotary joint questions" for some examples. Perhaps someone will write a "spinning electronics" page someday to list other ways to transfer power.

Once you have power to your rotating platform, I'm pretty sure you can power the accelerometers using the standard circuit in the data sheet for that particular accelerometer.

Once your accelerometers have power and are driving their output pin, there's a simple, low-cost circuit called a "op-amp summer" to sum the signals from two opposing accelerometers, to get the radial acceleration with gravity canceled out. There's a op-amp quick design process. I suppose if you were curious you could plow through the "summer" section of the "OpAmp Links" page, although they generally make it sound far more complicated than it really is. You're going to have various mis-matches from: accelerometers positioned not quite opposite the center of rotation; positioned not quite the same distances from the center of rotation; the accelerometers may have slightly different offset/scale errors; the resistors used to build the summer have small resistance errors; all of the above may vary with temperature, so even if you calibrate and cancel them all out at one temperature, they may no longer cancel out at a different temperature, etc.

So gravity won't be completely cancelled out, but I think you'll be able to get close enough -- perhaps after a bit of tweaking and tuning.

Since I don't know much about transmitting analog values directly, I might consider feeding the analog sum signal into a microcontroller (either directly, with a microcontroller with a built-in ADC, or indirectly through a peripheral ADC chip), then somehow transmit that digital data through visible light, infrared light, or radio.

There are many small, low-power microcontrollers that can easily be mounted on a rotating platform and powered by a small coin cell. Perhaps a JeeNode mounted on the rotating platform, to digitize the signal and transmit it wirelessly, then use a JeeLink to receive that wireless signal and pipe it into the USB port of a PC. Or perhaps a couple of Arduino boards, each one with an XBee wireless board plugged into a XBee Shield. Or perhaps another "Cheap Arduino Wireless Communications" approach. RFbee apparently has a (Arduino-compatible) microcontroller and all the wireless communication stuff on a single board. Various other wireless and infrared communication techniques have Arduino libraries available.

Answer 2[edit]

Less literal answer: What exactly is it you are trying to do? If you want to measure the acceleration due to the spinning at some point a distance R away from the center of rotation, perhaps a simpler and cheaper approach would be:

  • install a single gyro. (There's some low-cost gyros mentioned on the Multi-rotor page. You can mount it anywhere on the spinning platform; it doesn't have to be exactly R from the center of rotation.
  • Use the gyro to measure the rotation rate "w" in radians/second. (You might have to convert from revolutions/minute, revolutions/second, or whatever weird units that particular gyro uses).
  • Assume that a few "laws of physics" supported by centuries of experiments will continue to hold, and calculate the acceleration due to spinning as R*w^2. That acceleration is sometimes called a "centrifugal force".

Question 6[edit]

Hello I have a problem with a temperature sensor it has 1 Mohm of resistance at ambient temperature and according with the specification the value has to be 2 Kohm, I think that the circuit is open but I do not why, do you Know any reason for open circuits, or for the sensors failure.

Measuring 1 Mohm or more on a 2 pin temperature sensor such as a thermistor or a resistance temperature detector? Then it's probably permanently destroyed. Sorry. I usually destroy things by putting too high voltage -- now I know 120 V is too high :-). I suppose it's also possible it failed from over-temperature or other stress. --DavidCary 17:05, 30 August 2008 (PDT)

Question 5[edit]

Recommendation for mains powered voltage regulator to power a CPU?[edit]

Date: 2010-01-10

Does anyone have a recommended high voltage AC/DC input DC output regulator? Something for powering MCU devices off the primary mains (115/1/60 US, 200/1/50 EU, ect), that supplies an output voltage of around 3.3V to 7.5V much like a low cost MCU based product might have.

I'm looking for a better design of what might be called an universal off-line regulator. I found this ref, but those 1/2 watt resistors for a 100ma output don't sit well with me. http://www.discovercircuits.com/DJ-Circuits/images/offline5v.jpg

I also found this linear non-isolated regulator, but I'm not happy with it because it's again wasteful, and it can't offer an isolated output if so desired. http://focus.ti.com/docs/prod/folders/print/tl783.html

I'm thinking the solution will look something like this, perhaps with a switching frequency around 1kHz, or 10kHz what ever the low FCC limit is. http://i324.photobucket.com/albums/k352/kb1gtt/OFFLINE_REG.jpg

The general theory in my above sketch is that the high side drive will buck you down to what ever voltage the chip is looking for. Current capabilities would be driven by the high side drive, and bulk caps. Something in the 100ma to 5 amp range would be nice for a broad range of applications.

Answers[edit]

You have a high voltage power source, and you need to drive a microcontroller at 5 V (or maybe 3.3 V). Lots of common low-cost equipment needs to do the same thing (alarm clock, microwave oven, UPS, battery charger, etc.). So you would think there would be a simple, common, low-cost, off-the-shelf way to do this.

You also want it to be efficient (and therefore a switching rather than a linear regulator).

Is this what the professionals call "Underestimating Complexity of Power Supply Design"?

Practical answer 1:

Don't be put off by the 1/2 W resistors. When a tiny little resistor is dissipating 0.001 W, and you substitute a big, scary looking 1/2 W resistor (of the same resistance), how much does that big resistor now dissipate? That's right, it's still dissipating 0.001 W. Many line-powered electronic devices use huge 1/2 W or 1 W resistors in places where they normally dissipate only tiny amounts of power, and so most of the time a much smaller resistor would be adequate. But the designers stick in those huge resistors anyway, because when you plug in the device, you *might* have a big surge of current through the input capacitor. (a) You don't want the capacitor to blow up, so you add a resistor to limit the current, and (b) You don't want the resistor to blow up, so you make it big enough to handle that brief surge of current, even though 99% of the time it handles orders of magnitude less power.

Practical answer 2:

Use a step-down transformer to convert 120 VAC or 240 VAC to a lower AC voltage, then -- assuming this is less than 6 W -- use a rectifier and a bulk cap to convert to DC. Pick the turns ratio so that you get anywhere in the range of 6 VDC to 40 VDC at the bulk cap. There are dozens of $10 transformers with a 6 VA rating that would be adequate. Then use any one of dozens of DC-DC regulators to convert that voltage to the desired voltage, 5 VDC or 3.3 VDC or whatever.

There are detailed schematics and parts lists at:

all of which begin with a step-down transformer to convert mains power to a more convenient intermediate voltage.

Practical answer 3:

Buy one off the shelf. A used (or even a new) desktop computer power supply is relatively low cost; and some people know how to modify them for whatever voltage you want.

If that's too big, mini-box, and Newark, and several other suppliers all sells plug-in adapters that produce 5 VDC for under $10. --DavidCary 06:12, 5 February 2010 (UTC)


Theoretical answer 1:

Why do we need that step-down transformer? To someone familiar with low-voltage DC-DC regulators, it seems like (theoretically) we should be able to leave it out ... Use a bridge rectifier to convert the AC to DC, then use a single-chip switching regulator (perhaps with external high-voltage buck transistor) to convert the resulting 170 Vpeak or 340 Vpeak signal to the desired 5 VDC or 3.3 VDC.

Also, most switching power supplies I've seen above 30 W or so include power factor correction in order to meet IEC/EN61000-3-2 regulations. I'm pretty sure that an appropriate power factor corrector input stage can be built with a TL494 switching regulator.

Alas, lots of plausible-sounding searches return switching power supply chips or circuits with a maximum input voltage no more than 50 VDC or 100 VDC.

In particular, the National Semiconductor WEBENCH Power Designer refuses to design a switching power supply with an input voltage higher than 100 VDC. The Analog Devices ADIsimPower Design Tools refuses to design a switching power supply with an input voltage higher than 70 VDC. Rohm, Texas Instruments, etc. also have a similar mystifying limitation.

Why?

Am I just not looking in the right section of their website?

Is it because of "extra-low voltage" liability laws and regulations? "When equipment is human-accessible, voltage and power limits of < 42.5 V and 8.0 A limit apply for UL, CSA, VDE approval." -- Wikipedia: Switched-mode power supply.

Is it because the UL approval people (CE, etc.) are familiar with transformers, and because they are unfamiliar with anything else, it's too much hassle to get them to approve "new" power supplies no matter how much safer and more efficient and less noisy they are than the traditional power supplies?

My understanding is that the low FCC frequency is just under 9 kHz. The PCB Layout Wikibook has some more information on EMI FCC testing. However, most switching power supplies I've seen run at 40 KHz, I'm guessing because it's well above human hearing (20 KHz) and so the annoying audio whine only annoys our non-human neighbors.

Does the design in the Zetex "AN54 Energy Star® V2.0 compliant flyback converter using the ZXGD3101 synchronous MOSFET controller" do what you want?

The Massmind: Power page has a bunch of links to circuits that allegedly do what you want.

Power Supply Design blog allegedly has some tips for power supply design.

Does the "The 3-transistor Black regulator" do what you want, if you follow the design notes for adapting it to high voltage use?

"AN98091: CFL 13W demo PCB with UBA2021 for integrated lamp-ballast designs" includes schematic and PCB layout and parts list for the mains-powered CFL driver circuit. Can this be modified to generate 5 VDC ?

International Rectifier "AN-1069: Electronic Transformer Applications - practical product designs based around the IR2161" shows has a detailed schematic with 220 VAC input at one end and a PIC16F628 at the other end. After you delete the stuff you don't need, is what's left what you want? Does the circuit in International Rectifier "AN-1131: Universal-input (90- 265 VAC) LED driver using IRS2541" do what you want? Does the circuit in the National Semiconductor "LM5021: AC-DC Current Mode PWM Controller" datasheet do what you want?

Does the circuit in the FAN6754: Highly Integrated Green-Mode PWM Controller datasheet do what you want? Or one of the other circuit diagram schematics in the Fairchild "Power Solutions Design Guide"?

The circuits at "Versatility of the LM5030 PWM Push-Pull Controller" by L.H. Mweene & David Pace, or "200W ATX PC POWER SUPPLY" seem to do what you want -- but it seems unnecessarily complicated compared to the above circuits. Is there a way to simplify this circuit if you "simply" want to power a small microprocessor and few LEDs?

Question 5[edit]

Question[edit]

Date: 2009-10-16

Hi. I'm looking to design and build a PLL controlled 33 cm ATV downconverter. The purpose is to have a PLL controlled LO of somewhere around 850 MHz - shifting down from whatever frequency the user selects (via the DIP switches) in the 902-928 MHz band to 60 MHz (TV channel 3). A channel step of 1 MHz is sufficient, but it would be really convenient if the device had enough bandwidth to cover the entire 902-928 MHz span (users with computer tuners would pick 848 MHz to have 902-928 MHz go from 54-80 MHz and would be able to tell their computer tuners exactly where to look. Users using actual TV sets would have to change the LO to alter the tuning since TV sets are not as agile). You can check out my blog for more details.

Where I'm at so far is that it appears that the combination of the MC145151 PLL, SA620 LNA/Mixer/VCO and the MC12080 prescaler together might do exactly what I want. But I'm not really an expert at such things. Is there an easier, cheaper, or easier to get set of components that can work together to achieve the goal?

Is it just as easy as just breadboarding the example circuits from the datasheets? Will breadboarding actually work for UHF RF circuitry?

Answers[edit]

Question 4[edit]

Question[edit]

Date: 2009-10-08

Does anyone have a simple circuit for Power over Ethernet (PoE) power supply? I have found a number of ICs that are supposed to help (e.g. MAX5940 .. MAX5943, LTC4257, TPS23750, ...) but most of the example circuits suggest output transformer and optocouplers. That would make my ~$20 design too complex and expensive. Do you know of any cheap and easy way to get 5V or 3.3V from PoE? Thanks!

Answers[edit]

I really like National's LM5071 chip. Look at the non isolated example circuit on page 17 of the datasheet. It doesn't need a transformer or opto, but you have to be careful as the 5V RTN is NOT common.

Question 3[edit]

Question[edit]

I am looking for a CEF04N6 transistor for an Acer monitor. China wants to sell me 2 at $10 each plus $50 shipping. The monitor isn't worth more than $100. Please advise. Date: 6/23/08

Answers[edit]

Aww really? thats just a cheap MOSFET. Go buy something that is 600v 6a rated and drop it in! Any mosfet will work. the pins should be GDS.

Question 2[edit]

Question[edit]

hello i am looking for a inline and paralel messuring tools ,and was wondering if i can do it with a gyroscoop Date:23-2-2008 more or less

Answers[edit]

Could you clarify the question a bit? What specifically are you trying to do?

Question 1[edit]

how do I add my c code to this wiki?[edit]

Feb '08: how do I add my c code so it will be colored in this wiki? I can have it export to a html file and rtf

Answers[edit]

Currently the fastest way to add c code to the Open Circuits wiki is to copy and paste the plain text, then add a "code" tag before and after the code. Like so:

#include <stdio.h>
int main(void){
    printf( "%s", "Hello, world." );
}

We can also discuss the main() function.

(hit the "edit" button to see how that is done). Is that what you wanted?

Many IDEs colorize C code; that makes it a little easier to understand. If you want to see those pretty colors, some options we've seen so far:

  • copy-and-paste the source into your favorite IDE. Then it will colorize the code in the way you are used to (which may be different colors than what people with a different favorite IDE see).
  • Perhaps you could try exporting HTML from your IDE (or some other off line colorizer tool or script) and pasting it in. The OpenCircuits wiki accepts some html.
  • Other wiki use a "source" tag that colorizes C code automatically[1]. Should we install that here at Open Circuits?

russ_hensel, --DavidCary 12:51, 20 March 2009 (UTC)