Jump to content

enl

Members
  • Content Count

    341
  • Joined

  • Last visited

  • Days Won

    22

Reputation Activity

  1. Like
    enl got a reaction from jpnorair in Why is MSP430's Stack Poniter(SP) always alligned to even address?   
    As @@spirilis said, a quirk of the architecture. It is actually a good feature, as it greatly simplifies the memory hardware. If it were not for this, then either two memory accesses would be needed to access a 16bit word (like in the8085, Z80, etc) with a bit more logic to handle it, or a LOT more real estate would be needed for memory access logic, taking away space for other options and reducing the manufacturing yield, raising cost for the device.
  2. Like
    enl got a reaction from jean28 in Making a stepper motor move fast?   
    As mentioned in previous thread, you need to ramp up the step rate. The initial step rate that you can get away with goes down as the inertia of the load goes up. The maximum step rate goes down as the friction loss goes up.
     
    Warning: Gross oversimplification to follow:
     
    For example, the bare motor will probably go faster than you have it now by reducing the delay a little at a time, but, with no load, it isn't likely to go a lot faster. The unloaded rate is limited by the inductance of the coils, which limits the rate of change of the current -- ie: the maximum switching speed -- and friction in the motor. You might get twice the speed you have now. You might get almost no increase. Depends on what is limiting things now: friction or inductance.
     
    If you put a good size flywheel on the shaft, the motor probably won't run at all with your current code. You will need to lengthen the delay a good bit. Every few steps, the delay gets shortened a little (by a constant is not the best way, as it is reciprocal to rotational speed, but it does work within limits) until you reach the desired speed. When stopping, if you want to maintain the step synchronization, you reverse the process. If you don't care about maintaining step sync, just stop driving the thing and it will coast down, but it will take longer than a controlled stop.
     
     
    As to your code.... I would use a decent delay tool. An empty loop is difficult to reproduce. delay_cycles() is tied to the CPU clock. Better, use a timer interrupt. Build an array for your output states, and on each timer interrupt, increment or decrement a counter, and use the counter low order  bits to pick the output state. This has the added benefit of giving a natural count of position. To speed up, you make the interrupt more frequent, to slow down, less so. A state variable of -1, 0, or 1 determine direction or stop.
  3. Like
    enl got a reaction from bluehash in Making a stepper motor move fast?   
    As mentioned in previous thread, you need to ramp up the step rate. The initial step rate that you can get away with goes down as the inertia of the load goes up. The maximum step rate goes down as the friction loss goes up.
     
    Warning: Gross oversimplification to follow:
     
    For example, the bare motor will probably go faster than you have it now by reducing the delay a little at a time, but, with no load, it isn't likely to go a lot faster. The unloaded rate is limited by the inductance of the coils, which limits the rate of change of the current -- ie: the maximum switching speed -- and friction in the motor. You might get twice the speed you have now. You might get almost no increase. Depends on what is limiting things now: friction or inductance.
     
    If you put a good size flywheel on the shaft, the motor probably won't run at all with your current code. You will need to lengthen the delay a good bit. Every few steps, the delay gets shortened a little (by a constant is not the best way, as it is reciprocal to rotational speed, but it does work within limits) until you reach the desired speed. When stopping, if you want to maintain the step synchronization, you reverse the process. If you don't care about maintaining step sync, just stop driving the thing and it will coast down, but it will take longer than a controlled stop.
     
     
    As to your code.... I would use a decent delay tool. An empty loop is difficult to reproduce. delay_cycles() is tied to the CPU clock. Better, use a timer interrupt. Build an array for your output states, and on each timer interrupt, increment or decrement a counter, and use the counter low order  bits to pick the output state. This has the added benefit of giving a natural count of position. To speed up, you make the interrupt more frequent, to slow down, less so. A state variable of -1, 0, or 1 determine direction or stop.
  4. Like
    enl got a reaction from Eptick in MSP430G2553 help   
    Unless I need to, I NEVER use a float. I would store the raw data and process it after pulling it from the MSP430. If you can trim the raw data to a byte rather than a 16-bit word, more space is available, as well. If you use float, you will have space for 48 readings (or 64 if you lose the factory calibration data). This is less than the 5 min you want, so is a bad move. When you pull the data from the device, then convert to actual voltage readings.
     
    If you are certain about the range you need, and you don't need other features of the INA219 than voltage (I was figuring that you might also be monitoring current or needed full 12 bit resolution), the MSP430 10bit A/D will do the job. You might need the op amp, depending on supply voltage for the MSP430 and how you use the internal reference. If using the internal flash, you will need to maintain the minimum voltage needed to write, which is more than sufficient for the A/D and internal reference. The internal ref set to 1.5V gives a count of about 0x220 for 0.8V, which won't make it into a single byte. With it set to 2.5V, 0.8V gives a count of about 0x148, which is closer, but still misses, with a resolution of about 2.5mV. Divide the result by two and the resolution is just under 5mV. If this is good enough, I'd do that. Conversion from A/D count to voltage would need to be done as postprocessing, but you cound get 192 readings into the flash, for a time of 960sec (16 min) max at one reading per 5 seconds.
     
    Is 4mV a hard requirement, or will a bit better than 5mV do it for you? If you must have 4mV resolution, than an external op amp would be my choice, with a gain of about 1.6, so that the resolution of the internal 10bit unit will be about 3.9mV. Then, just store the low order byte and you're good with a little margin for greater than 0.8V. If cutting off or shifting the readings to save memory, I would ABSOLUTELY test the data before, and if it is overrange, save the max legal value instead (0xFF) to avoid a step in scale. Or, if you are confident that the voltage won't change too much over the time scale, the step can actually extend the range -- a step from near max to near min indicates going to the next count on the high order byte... I have used this when monitoring armature speed for large motors, where the readings are close enough that a change in speed that could be confused for the scale shift would be easy to identify, as the machine would be damaged beyond oprertion by anything that could do it... you don't stop a 200kW DC prime mover tied to 2 or 300 tons of load in 100ms and not know it.
     
    Just remember that, no matter what, you DO NOT want the input to have an applied potential greater than the supply of the MSP430.
     
    The op amp lets you do a little scaling if needed to stretch the resolution or the range.
  5. Like
    enl got a reaction from Eptick in MSP430G2553 help   
    Flash will be retained after power down. You will also want to build in to you software the ability to read the flash data later. Simplest way is send it via serial.
     
    I might structure things this way:
     
    Initialize (clear) flash triggered by a pushbutton on one input. I would halt after this, so as to require reset before collecting data. This allows clear at the bench and autostartup in the field.
     
    Default to monitoring on power up. Insure that the clear value can never be a valid data written to the flash (not a big deal.. the ina219 is 12 bit. you can easily insure that at least one bit of every 16 bits of used flash is set to 0) so that the powerup can scan memory to find the first unused memory cell for storing the readings. This protects against power failure to the device, allows stopping and restarting monitoring easily, and allows monitoring to go if the device is not properly cleared initially, as long as there is sufficient unused memory. This also insures that reconnecting to suck the data out won't start by overwriting. The monitoring routine should be careful not to overwrite the block used for calibration data, unless you - dont need the calibration, and b- are willing to recreate it if needed later if the processor is reused.
     
    A different button press triggers data dump, or the software can monitor other means for data dump, such as a serial input line.
     
     
    If you are planning on running for a long time and gathering more data (60 readings is 120 bytes.... can be stored onboard in two blocks of the flash '256 byte information memory', but not a lot more than that will fit), SD cards are a viable option. Search the archives for info. THere is a tutorial, and there is a lot of other info, as well. A bit more code to do it, but well withing the practical.
  6. Like
    enl reacted to KatiePier in Interrupts from Timer CCR1   
    Not quite - it does actually clear the single TBxCCRn flag that corresponds to the value currently in TBxIV (the highest priority interrupt), as well as clearing TBxIV and setting it to the next priority pending interrupt, but it only does this when your code actually reads out the register TBxIV, not just as soon as the ISR is entered.
     
    You can observe this happening by adding a _no_operation(); before your switch inside your ISR, and put a breakpoint there. Open the register view in your debugger and take note of the state of the CCIFG bits in the TBxCCTLn registers, and the value in TBxIV. You'll see that the CCIFG and TBxIV values are still set on entry to the ISR. Now, single step over the switch statement (where it reads TBxIV) and you'll see that this is the time when the TBxIV and the CCIFG value are cleared. But since your switch is what read TBxIV, it already has the value to jump to the correct case.
     
    I think the easiest way to understand it is probably to run it on a part and step through it and watch what the flags and registers do.
     
    Regards,
    Katie
  7. Like
    enl got a reaction from Fred in Oscilloscope or logic analyser?   
    @@Fred I just popped the $$$ for the 2000 series Rigol analog only. For many things, you don't need the full logic analyser. But I looked very hard at the 1052D. Very hard. I thought about my needs, desires, and what I currently have on hand. Then I went for the 2000series without logic. My needs are not the same as yours.
     
    Some questions to ask are:
    How many channels of logic are you likely to need? Do you need the ability to trigger on complex logic signals or do boolean operations for triggering? Do you need a deep memory for logic monitoring? Do you have a need for analog?
     
    For me, the answers were not many, sometimes, rarely, and yes This said maximize the return for analog, and keep using the computer connected device for complex digital.
     
    I happen to have old machines around that I can dedicate to various things (just ended up with another.... had to upgrade the shop computer to WIN8 (extortionary upgrade: software disabled itself until upgrade, but win8 only.... Won't mention the software, but at about $2K with no term on the license, I found it to be unconscionable), and I found it cheaper and easier to just pop the $$$ for the least expensive I could get that would do the job than to resystem the existing machine), so it isn't a handicap to me to use the computer for logic, UNLESS I end up with a situation where I need to do triggering for analog based on logic, or vise-versa. I don't expect to, but if I do, I can find a way to force the data grab and match things on the computer after the fact. Won't be able to do it real time.... at 2GHz, a few microseconds of latency for com between the devices is a good bit of any but a real deep buffer.
     
    You may find it cheaper to go with the analog option and dedicate an old or cheap computer to logic so as to free up your main machine. You'd be amazed what you can do with a $50 yard sale computer that is a few years old. Not top of the line, but for dedicated tasks, often can't be beat.
     
    Or, for some sets of answers, the Rigol analog units, and some other makes, do have logic options for I2C, etc. that will monitor, decode, and do fairly impressive triggering. Pretty much tied to a single input for these things, so no triggering on a memory bus address, but if you don't need that, then might be worthwhile. Comes as a time-limited freebee with some models. Costs some $$$ for permanent, though I would be surprised if no one has figured a hack for it. I neither encourage nor discourage hacking it.... It is between you and your concisece.
  8. Like
    enl reacted to RobG in WS2812B LEDs   
    WS2812D, an 8mm RGB LED with integrated WS2811, will be available in my store next week.
     
     
     

  9. Like
    enl reacted to rockets4kids in AY-3-8910A sound generator   
    You may enjoy this, too:
     

  10. Like
    enl got a reaction from Fred in Relying on internal pull-up resistors   
    I have had no prob with the internal pullups on 2452. Make sure that all control bits are correct, and don't count on the pullup being any particular value. They are spec'd 20 to 50Kohm (slas722e, p20,) , and I wouldn't be surprised to see them outside this range in some conditions. If you need a lower pullup or a tighter value, then an external resistor is it.
  11. Like
    enl got a reaction from abecedarian in 3.3 PWM to 0-5v   
    @jpnorair: yup. Simple, reliable, and buildable from pretty much any junk box. My first thought was to get the appropriate transistor based solution up since that is where it started.
     
    Second sol'n was based on what I have in my junk box and would figure likely at hand for many, and what I pick for the task when I need moderate to low output impedance. Fast enough, reliable, and easy.
     
    For the straight digital lines, I would definitely go with a level shifter IC, since it looks like several lines involved. For the analog, I'd probably stick to the op-amp, since due to the spec'd 5mA or so, if the frequency is low enough. An RC filter is going to have a pretty high output impedance or a substantial electrolytic cap.  At a minimum, if a max of about 4.2 to 4.4V is ok, an emitter follower after the RC filter to source current.
     
    If the PWM freq is high enough that the filter isn't really needed for the application-- it isn't always, especially if what is being fed has a filter on the input or is a mechanical device-- then the level shifter IC is ideal as well.
  12. Like
    enl got a reaction from jpnorair in 3.3 PWM to 0-5v   
    Attached is an image (MSPaint... Sorry. Not at a good machine right now) with two options. There are a ton of others.
     
    First: NPN transistor. Resistor on base maybe 100K, collector maybe 100K or 20K, depending on what you are driving for a filter/current amp.
     
    This will invert the PWM, and will not go full to ground. Gets to about 0.2V with a 2n3904 and 100K collector resistor. For full high output, leave microcontroller pin at low. For closest to low it will do, microcontroller pin is high.
     
    Second: select your favorite rail to rail 5V capable (or powered from a bipoler supply) op-amp. Lots of options. This amplifies 3.3V to 5V. For lower speed applications.
     
    If you put your low pass filter ahead of this, it will amplify your 0-3.3V filtered PWM to a 0-5V output.
     
    Option 2 is my preference, in general. Simple RC low pass does the job for many applications.
     
    If you need more info, just ask.

  13. Like
    enl got a reaction from jpnorair in 3.3 PWM to 0-5v   
    For 5mA, you will likely need a buffer of some type. Full rail to rail an op-amp is best. If you can lose a little, an emmitter follower  will do.
     
    If you can go with an op-amp, the filter on the new sketch is set using t=RC for the time constant. For example, for 1KHz  PWM rate set RC<1/1000sec, maybe at 1/500, so R=100K and C=0.022uF.
     
    What are you driving? What freq of PWM? What other constraints? That will help figure out what is best and easiest

  14. Like
    enl got a reaction from abecedarian in 3.3 PWM to 0-5v   
    For 5mA, you will likely need a buffer of some type. Full rail to rail an op-amp is best. If you can lose a little, an emmitter follower  will do.
     
    If you can go with an op-amp, the filter on the new sketch is set using t=RC for the time constant. For example, for 1KHz  PWM rate set RC<1/1000sec, maybe at 1/500, so R=100K and C=0.022uF.
     
    What are you driving? What freq of PWM? What other constraints? That will help figure out what is best and easiest

  15. Like
    enl got a reaction from abecedarian in 3.3 PWM to 0-5v   
    Not as you have it sketched.
     
    Your sketch will short your 5V supply to ground until the I/O or the processor fry from a connection to the 5V supply through a diode.
     
    Background: The base-emmitter junction of a bipolar junction transistor acts like (and actually is) a diode. The base current sets a limit, based on the gain of the transistor, for the collector current. If the external circuit limits the current, then the transistor acts as a switch. If the external circuit doesn't limit the current, then the transistor does and it operates in linear mode. These rules are approximations. Good ones, but still only approximations.
     
    The circuit you sketched will have the diode (base-emmitter junction) between your 5V supply and the I/O. Diodes do not limit current. (Ok, they do, but not like a resistor.) They act more like a constant voltage drop of about 0.6 to 0.7V when current flows. This means that you will be essentially applying 4.3V with no current limiting to the output of the microcontroller.
     
    Also, you show hte collector tied to ground. This will both prevent the collector from changing voltage, defeating your goal of PWM, and also shorting the power supply to ground through the transistor when there is a base current.
     
    I'll follow up in a few minutes with a circuit that may do it for you, but I would recommend doing some reading about transistors. If you don't have it, I strongly recommend Horowitz and Hill's _The_Art_of_Electronics_... It has been in print for about 30 years and is still about the best text out there for serious students that are not going to be electrical engineers, adn for those that are, as it is practical. It has the reputation of being a technicians text, but it is really a lab/research physicists text. Some things are a little out of date, but still quite relevant.
  16. Like
    enl reacted to bluehash in Post a pic of your home work bench, get a ..   
    This is not safe for work!
    ...Awesome desk and writeup @@enl.
  17. Like
    enl got a reaction from bluehash in Post a pic of your home work bench, get a ..   
    Since it came up again, and since, until recently, my space was too much in flux to even photograph (old house with 100 years of mistreatment needing some TLC), I will now add my little part of paradise to this thread
     
    Without trying to pin the pics into the text, this is the best it gets....
     
    first: the old setup. Bench is a BenchWorks I bought (stole?) from a neighbor when his daughter got out of college and moved back home. Into his shop (selling a couple of the bikes to make space is what killed him)..... 
     
    HP130C is the scope. Over 50 and still going strong. Original owner bought the lifetime plan, so I had it calibrated about 20 years ago. Then, things changed at HP, and I've done it myself since then. Fluke 8000 series digital VOM and Fluke freq counter to the left. Also visible: one of the magnifiers (ring light type), parts bins with caps, carbon resistors up to 5W, high voltage caps, and assorted relics like microwave detector diodes. A couple variacs, a spark transformer, a few random analog and digital handheld VOM and clamp on meters, a bucketload of sockets (solder and wire wrap) in tubes, one of the wiremold strips mounted to the joists, and Schrodinger, the cat.
     
    Next is the current setup. Old shop machine went belly up, so new bottom end dell, New Rigol scope for it to talk to, next revision of my home monitoring system burning in, a few assorted other things
     
    Next is another shop view. Lathe and two of the drill presses are visible, as well as some of the machinist storage, a peek in the bottom left of the welder case, and a workbench covered with wood flooring waiting to be laid
     
    Next, one of the random drawers of small parts. Several of them, as well as a few cardboard boxes, some fibrebuilt cases, and loose stuff. Anyone want a half dozen keyboards? AppleII, Comodore, and what else? Maybe a few Honeywell or Argus digital temp controls (K-couple or platinum)? Or an HP130C scope? I need the space....
     
    Last two are a few of my storage solutions for regular use wood tools. Other tools get similar treatment. As much as I can, the things that don't get hot go in the joists.
     
    Walls and ceiling are a variety of wonderful colors, legacy and my pick. Mine are the white and light grey. I won't take the blame for the others.
     
    Lighting is 32W T8 fluorescent, approx 35000 lumens over 200 sq ft, with 18" T5 for additional lighting over the benches, drill presses, and lathe, and several 100W equivalent photoflood for task lighting. My vision is aging faster than I am.






  18. Like
    enl got a reaction from tushki7 in What is your workplace wall colour?   
    My spaces are a mix: Upstairs, in the office, layout table and drafting table require a lot of light, so walls, ceiling, all medium white semigloss. Good north light (this room is why I bought the  house)
     
    Basement is a mix of white, tan, brown, blu, and whatever, much left from the previous owner. I have repainted as I feel like it, starting with the exposed rafters. Repaint is leftover white from upstairs, ahere appropriate, and white/light grey drylok on the concrete. That space is used for electronics, woodwork, and machine work lathe/drill press/etc) so needs a lot of light. Small, but not boxy
  19. Like
    enl got a reaction from jean28 in Hard to interface with Stepper Motors?   
    Longer answer than the others here, but what the hey... Waiting for a several gig software update to come through (Net neutrality is not in the vocabulary of Verizon....)
     
    Driving steppers is pretty straightforward from the software end. The processor isn't an issue. The key issue is, as mentioned, that virtually no processor can drive even the smallest, lowest power stepper directly. There are a few processors that are designed for such tasks, but they are not likely relevant to you.
     
    For any substantial stepper (or DC motor) you will need a driver interface. The setup depends on the stepper used. There are several flavors, but they can be, broadly, labeled as unipolar and bipolar.
     
    Unipolar are those that operate with current of only one polarity. Each phase has two opposite sense coils to provide the opposite sense magnetic fields required. These devices have a minimum of five wires, generally six or eight. Five wire units are treated the same as six wire units as the common for the two phases are tied internally. The six wire units are wound as center tapped coils for each phase, and to drive, you pull one of the two end taps low with the common connected high (or vise-versa, but it is usually easier to pull low). The eight wire units have two independant coils for each phase, and you can tie the appropriate leads together externally for a common to use them as unipolar, or tie pairs together to use them as bipolar. You can use a driver IC or individual transistors.
     
    Bipolar use only two lead per phase (one coil, or two parallel coils is 8 lead units in bipolar mode) and to provide the two senses of mag field for each phase, you need to be able to reverse the current. This can be done two ways: Bipolar power supply or H-bridge. H-bridge is cheaper and easier, usually, and IC's are available off the shelf.
     
    ANY inductive load (stepper, DC motor, etc) will need protection for the driver against inductive flyback and other issues. Minimally, this consists of diodes to channel flyback current to the power supply. It is also a good idea, if possible, to isolate the drivers and the power for the motors from the control processor. Opto-isolators are an easy way to do this. Allows total isolation, so you can do silly things like use 48V steppers powered by a bank of lead acid truck batteries without worrying about a transistor shorting (they do) and taking your control with it. Many people don't bother, and most commercial products don't, but for a student project, it provides insurance and eases debugging. For my own projects, I tend to isolate. Just makes  life easier.
     
     
    If DC motors come into it, the drivers are the same as for bipolar steppers.
     
     
    Exactly what you will need depends on the required drive current and voltage for the stepper, and the voltage and drive capability of the processor..
     
    Hardest part about driving steppers, especially with large loads, is getting the required torque without missing steps. This can take some planning. If you have manufacturers data available, there may be info as to torque vs current vs step rate. This will help you plan step rate ramp up and down. You can also work it out experimentally. For large loads, it is rare that you can just start stepping at full speed. Typically ramp up is needed to prevent missed steps or, worse, the 'it's just sitting there and vibrating' syndrome.
     
    I have avoided giving any part numbers or real specifics, as a little looking at the IC manufacturers web sites will lead you to many driver IC's, and the stepper manufacturers have a ton of information on their web sites, as well. I am old. I generally build my own drivers rather than use ICs, but I don't do commercial products at this point. The majority of what I do is for myself or for teaching.
  20. Like
    enl got a reaction from GeekDoc in Photodiode as proximity sensor   
    Excellent. that will do the job. Better linearity will come with constant potential across the photodiode. You can do this in your configuration using a PNP transistor, with the photodiode to ground, Or by putting the current-to-voltage conversion resistor on the collector of the NPN transistor and grounding the emmitter. Not worth it if what you have is doing the job.
  21. Like
    enl got a reaction from GeekDoc in Photodiode as proximity sensor   
    Vr is the reverse potential applied during the test. To classify the photodiode, a constant reverse voltage is applied, the light is varied, and the photocurrent is measured.
     
    I will suggest that you do NOT use 5V. Use your microcontroller supply This will protect the microcontroller from overvoltage on the input.
     
    I think that your problem is more likely the resistor you are using to convert current to potential, and the low output of photodiodes. The max classified current is less than 100 microamps. With your resistor, this will give 1V. This is at approximately 1mW/cm^2. This is a pretty high intensity. At high noon on a bright day in the desert, the intensity of solar flux is of the order 1000W/m^2, which is 100mW/cm^2. I would guess that you are working at intensity much, much less than that. Typical bright interior lighting is about 1/100th of that, and reflected light from even a bright IR LED will be much lower yet. At 100microamps, you would see 1V across your resistor. You are likely several factors of ten less. Photodiodes are generally used when high linearity and sensitivity are needed, such as in precision measurement, or high speed is required, such as high speed optical communication. Other devices are usually used for low precision/low speed  tasks like proximity.
     
    Typically, with a photodiode, you need to amplify the output. Several techniques are common, including using the photocurrent to drive the base of a transistor, using an op-amp circuit designed for photodiode amplification (not complicated, but needs to be right to get good performance), or using an op-amp circuit that keeps the photodiode operating in photovoltage mode.
     
     
    For your application, I would use a phototransistor, which can be described as a transistor where the base-emmitter junction acts as a photodiode. Cheap, high output, easy.
     
    Or, go to an amplified sensor like the OPT101 or similar (there are a lot of options. This is just what came to mind first)
     
    Edit: fixed intensity value and spelling
  22. Like
    enl got a reaction from jelledebock in Photodiode as proximity sensor   
    Excellent. that will do the job. Better linearity will come with constant potential across the photodiode. You can do this in your configuration using a PNP transistor, with the photodiode to ground, Or by putting the current-to-voltage conversion resistor on the collector of the NPN transistor and grounding the emmitter. Not worth it if what you have is doing the job.
  23. Like
    enl got a reaction from jelledebock in Photodiode as proximity sensor   
    Vr is the reverse potential applied during the test. To classify the photodiode, a constant reverse voltage is applied, the light is varied, and the photocurrent is measured.
     
    I will suggest that you do NOT use 5V. Use your microcontroller supply This will protect the microcontroller from overvoltage on the input.
     
    I think that your problem is more likely the resistor you are using to convert current to potential, and the low output of photodiodes. The max classified current is less than 100 microamps. With your resistor, this will give 1V. This is at approximately 1mW/cm^2. This is a pretty high intensity. At high noon on a bright day in the desert, the intensity of solar flux is of the order 1000W/m^2, which is 100mW/cm^2. I would guess that you are working at intensity much, much less than that. Typical bright interior lighting is about 1/100th of that, and reflected light from even a bright IR LED will be much lower yet. At 100microamps, you would see 1V across your resistor. You are likely several factors of ten less. Photodiodes are generally used when high linearity and sensitivity are needed, such as in precision measurement, or high speed is required, such as high speed optical communication. Other devices are usually used for low precision/low speed  tasks like proximity.
     
    Typically, with a photodiode, you need to amplify the output. Several techniques are common, including using the photocurrent to drive the base of a transistor, using an op-amp circuit designed for photodiode amplification (not complicated, but needs to be right to get good performance), or using an op-amp circuit that keeps the photodiode operating in photovoltage mode.
     
     
    For your application, I would use a phototransistor, which can be described as a transistor where the base-emmitter junction acts as a photodiode. Cheap, high output, easy.
     
    Or, go to an amplified sensor like the OPT101 or similar (there are a lot of options. This is just what came to mind first)
     
    Edit: fixed intensity value and spelling
  24. Like
    enl got a reaction from joro1881 in MSP430 university project   
    Also, please do go to the new users forum and let us know something about you.
  25. Like
    enl got a reaction from joro1881 in MSP430 university project   
    See my post in projects for an example using ds18B20. Not the most beautiful code, but does the job. The portions that deal with reading/controlling the ds18B20 will hopefully give you some guidance. I DO NOT recommend copying as presented. The types are not ideal, the low level functions should be inlined, and, for a single sensor, things can be streamlined by eliminating the channel bitmask.
     
    I would also question how you connected the keypad. What are the resistors for? With your row and column connections sharing pins, what will happen if you press the '1' key?
     
    If you borrow code or schematics, don't neglect to reference the source clearly. It is for your benefit, so you will know where to go if you need more information later, as well as good moral practice.
×
×
  • Create New...