|
Scarboy posted:Assuming you have your prescaler set to 1x, 1/20MHz * 40 = 2us. So your timer overflow interrupt should (theoretically) be run every 2us. I don't program PIC, but I assume interrupts are disabled when an interrupt is serviced. So, if your ISR takes longer than 2us you will constantly miss your interrupt. I'm not 100% sure if the interrupt is simply discarded or if it's buffered (my guess is discarded). If this is the case you can see how those artifacts occur. Are you accounting for PICs using four clock cycles per instruction? Also you have to call the ISR 128 times to get one full PWM dimming cycle. And I want my strobing effects to be as fast as 1,000 strobes per second, which is actually 2,000 * 128 (just a bit more than your 200,000 number) ISR calls per second. Luckily I just found a PIC with the same I/O configuration as the 16F88 that can be clocked to 32MHz, which I think will solve the problem. And it's CHEAP! http://www.microchip.com/wwwproducts/Devices.aspx?dDocName=en538963
|
# ? Mar 24, 2010 00:52 |
|
|
# ? May 21, 2024 21:30 |
|
Personal Video Project I'm working on a project to make something very similar to this: http://www.lightinthebox.com/2-4GHZ-Four-Channel-MP4-Baby-Monitor-Kit-with-High-Power-Wireless-Camera-SZQ378-_p37714.html I want to add a few things though) 1) On the camera I want a distance sensing later, and a directional microphone (cuz im bilding kewl spy sh!t). 2) A text overlay on the video that displays the distance given by the laser. Kind of like this, except I don't care about shading: I was thinking I would just buy a video camera, possiby with audio already built in so I can integrate my directional-mic more easily, an A/V Tx/Rx combo, an LCD to display my data. I would also need a micro controller to write the text as an overlay. Interfacing the video signal to the MCU to write the text scares me, lots. Let's say I use composite video. I would have to decode the video, lock onto the sync information, and send pulses with the chroma signal to write the text, recode everything into composite, convert it to digital to be displayed on a small LCD. Arghhh, does anyone know of an easy way to accomplish that? Should I even be using composite video for this?
|
# ? Mar 24, 2010 01:06 |
|
RivensBitch posted:Are you accounting for PICs using four clock cycles per instruction? Also you have to call the ISR 128 times to get one full PWM dimming cycle. And I want my strobing effects to be as fast as 1,000 strobes per second, which is actually 2,000 * 128 (just a bit more than your 200,000 number) ISR calls per second. That's one of the new "enhanced mid-range" PICs. They can address more memory and have added CPU features to make them more C-friendly but they're still just polished turds. Program memory is still paged and I/O registers are now spread out across more banks than ever before. If you wish to use a new part you may as well use a PIC18 to benefit from an even higher clock speed and access-banked I/O registers, among numerous other improvements.
|
# ? Mar 24, 2010 01:38 |
|
Ms Jewish Anime posted:Interfacing the video signal to the MCU to write the text scares me, lots. First thought I had: Why not convert the video to digital right off the bat? Output that to the LCD and just overwrite it with the text you want.
|
# ? Mar 24, 2010 03:47 |
|
RivensBitch posted:This might be more of a programming question, but I was wondering if anyone might have some advice on programming interrupts in a PIC 16F88. Yeah, ditch this retarded chip and use something with 3 PWM channels, and do this all in hardware. One interrupt call per switching cycle... What are you doing that needs a 1 kHz strobe?
|
# ? Mar 24, 2010 11:02 |
|
Ditching the chip is easier said than done, the PCBs are already printed and I've already built 50 units, half of which are sold and shipped. This is a sourcecode update. Now if need be I can ship existing customers new chips, as long as the pins line up (and they're able to change the crystal now that I'm speeding things up). The problem is that in the 18-pin PDIP package, MicroChip likes to move around which pins are the uart TX/RX, as well as the ADC etc. Luckily the 16F1827 can be programmed to match the 16F88, but the only 18F chips I found that meet my needs and are in the 18 pin package (18F1320 and 18F1330) won't work with the current PCB. This whole project has been a learning process, and using a better chip is definitely something I will do the next time I'm designing something from the ground up. The 1kHz strobe is absolutely vital. This isn't television, it's LED lighting effects marketed to musicians and hallucinogenic drug users. People have compared my lights to this: http://en.wikipedia.org/wiki/Dreamachine 8-13 pulses per second is 76-125ms, a pulse being a whole on/off cycle. So not only do we need to be at least as fast as 38ms, but we want to be able to fine tune it to any individuals alpha brainwaves, so 1000kHz is actually the bare minimum. Right now with my old, non interrupt driven sourcecode, I can adjust the strobing from 0-127, and value 22 is very different from 21 and 23. This is my website which has video of the assembled product, although the video wont convey the strobing effects: http://www.colorsynth.com RivensBitch fucked around with this message at 18:07 on Mar 24, 2010 |
# ? Mar 24, 2010 17:59 |
|
That's pretty cool. Also, you should change your first name to Master. Also, if you post relevant code snippets on pastebin, we can help you out a lot more. Also, doesn't PIC assembly have SEI or a similar opcode to disable interrupts? That way you won't have interrupts interrupting your interrupts and stuff
|
# ? Mar 25, 2010 03:11 |
|
ante posted:That's pretty cool. No need, interrupts are disabled automatically when the PIC jumps to the interrupt vector, and restored by the return from interrupt instruction. However, if for some reason you actually do want interrupts to be able to nest, you can manually set the interrupt enable bit at the start of the interrupt routine. Edit: Though it's important to mention that if an interrupt is requested during the interrupt routine and interrupts are disabled (as per the default behaviour mentioned above), the CPU won't do anything until interrupts are re-enabled. However, it will immediately jump to the interrupt vector following the RETFIE instruction. This can completely deadlock the main program if the interrupt routine takes too long to execute and a peripheral continuously interrupts before the CPU is finished. BattleMaster fucked around with this message at 04:19 on Mar 25, 2010 |
# ? Mar 25, 2010 04:08 |
|
RivensBitch posted:Ditching the chip is easier said than done, the PCBs are already printed and I've already built 50 units, half of which are sold and shipped. You could use the old boards with a new CPU but you are going to need to make an adapter board. Which shouldn't be too hard. You could make it single sided most likely and just have the uC sit upside down with straight header pins coming off the board. Its a bit of a kludge but would let you use whatever you think is the best uC regardless of its pinout.
|
# ? Mar 25, 2010 08:22 |
|
Hillridge posted:First thought I had: How easily could it be converted and overwritten without the use of a computer?
|
# ? Mar 25, 2010 15:46 |
|
Ms Jewish Anime posted:Personal Video Project http://www.sparkfun.com/commerce/product_info.php?products_id=9168 Connect it with an AVR or Arduino.
|
# ? Mar 25, 2010 19:50 |
|
ante posted:Also, if you post relevant code snippets on pastebin, we can help you out a lot more. The entire sourcecode is available at http://sourceforge.net/projects/colorsynth/. The interrupt routine is "CS_Interrupt.inc" in the include directory. I went out of my way to make the source as clean as possible, so each section of code is in a separate include file, called within the main CS.ASM file, which is only about 20 lines of code itself, mostly calling the different include files. Also I'm pretty sure I commented every-single-line of code. I've been told that as far as open source releases go, it's very easy to follow. quote:Also, doesn't PIC assembly have SEI or a similar opcode to disable interrupts? That way you won't have interrupts interrupting your interrupts and stuff One of the problems is that in order to make the LEDs dim as cleanly as possible, and in as linear a fashion as possible, the timing has to be as perfect and consistent as possible. Disabling the interrupt to allow the handler to run longer than the interrupt period would result in uneven timing between PWM cycles. Yes this is all happening very fast, but the results are absolutely perceptible, especially when I'm using arrays of a few dozen lights alternating between synchronized and syncopated sequences. ValhallaSmith posted:You could use the old boards with a new CPU but you are going to need to make an adapter board. Which shouldn't be too hard. You could make it single sided most likely and just have the uC sit upside down with straight header pins coming off the board. Its a bit of a kludge but would let you use whatever you think is the best uC regardless of its pinout. Switching to the 16F1827 is the simplest and most cost effective solution. Yes it would be nice to upgrade to a way better CPU, but designing and then printing an adapter board will take time and will increase my per unit cost, as well as the time needed up upgrade existing units. Switching to the 16F1827 will let me increase my interrupt call by 60%, which will give me plenty of time to expand my code and clear up the errors I'm seeing in the color sequences. RivensBitch fucked around with this message at 21:04 on Mar 25, 2010 |
# ? Mar 25, 2010 20:56 |
|
RivensBitch posted:Are you accounting for PICs using four clock cycles per instruction? Also you have to call the ISR 128 times to get one full PWM dimming cycle. And I want my strobing effects to be as fast as 1,000 strobes per second, which is actually 2,000 * 128 (just a bit more than your 200,000 number) ISR calls per second. if you need 256,000 interrupts, 20MHz gets you 79 cycles for each of them. At 4 cycles an instruction (god, that's awful. I designed better in college...), that gives you enough time for 19 instructions. What you've got now is nowhere close to that. RivensBitch posted:Switching to the 16F1827 is the simplest and most cost effective solution. Yes it would be nice to upgrade to a way better CPU, but designing and then printing an adapter board will take time and will increase my per unit cost, as well as the time needed up upgrade existing units. Switching to the 16F1827 will let me increase my interrupt call by 60%, which will give me plenty of time to expand my code and clear up the errors I'm seeing in the color sequences. Even with the 32mhz processor with 60% longer, you're only getting about 30 instructions. It is at least possible for your interrupt to complete in 30 instructions in the best case, but not the average one; it's hardly 'plenty'. Even if you get really clever with the assembly and manage to seriously trim down the interrupt and fit it in there, you're not going to have any time to do anything else. Without a more extreme CPU upgrade, you're going to have to back down on your requirements. Since you're dead set on the 1khz, you have to back down on the PWM, and just do every other step. That's still not a lot of breathing room, but at least that will get it into the feasible range.
|
# ? Mar 26, 2010 02:31 |
|
Ok I have a really dumb question to ask; I'm only asking this because as I'm learning EE lately a lot of conventions I knew turned out to be completely wrong. I need to install a simple on/off toggle switch to my PID temp controller, can I put the toggle switch basically in line on the positive (black) wire going to the controller? Like an old knife switch on a science project. I'm also worried about the switch rating and fuses, I'm not sure how many amps are running through the thing and I'm a little scared to test on my radioshack voltmeter. Any ideas on how to approach this? The data sheet on the controller isn't too descriptive.
|
# ? Mar 26, 2010 18:24 |
|
Does your PID temp controller have a heatsink? I doubt it. If it doesn't have special cooling requirements, then it can't be pulling very much power. It's in the low milli-amps (probably somwhere in 50-100mA, though it could be a bit more).
|
# ? Mar 26, 2010 18:52 |
|
Shazzner posted:Ok I have a really dumb question to ask; I'm only asking this because as I'm learning EE lately a lot of conventions I knew turned out to be completely wrong. If you're lucky, your controller will have a nameplate that gives either VA (volt-amps) or Watts somewhere on it. Size your fuse at 25-50% over that, and your switch interrupt rating at 2x your fuse, and you'll be good. I bet a 5A fuse and a standard residential toggle switch ("light switch") will be fine. Knife switches are usually rated in the hundreds of amps, even for small ones, so that'd work, too. I saw some fused knife switches at the supply house with 140A fuses in a 3" switch.
|
# ? Mar 26, 2010 18:57 |
|
Shazzner posted:You might try something like this for composite: You're my hero. Much thanks kind Soldier.
|
# ? Mar 26, 2010 21:17 |
|
Zhentar posted:if you need 256,000 interrupts, 20MHz gets you 79 cycles for each of them. At 4 cycles an instruction (god, that's awful. I designed better in college...), that gives you enough time for 19 instructions. What you've got now is nowhere close to that. Well I'll need to redo my math, right now at 20MHz everything works and the speed of the strobe looks good on my scope, it just has some occasional blips in the colors. The new chips will be here next week, but I'm very confident that I'm on the cusp of the interrupt, and only at the end of the PWM cycle. The interrupt code is about 40 instructions during the pwm cycle, and 50 at the end. Giving me a 60% boost in instructions between interrupts will fix this, and if not then I'll have to live with a slower strobe. RivensBitch fucked around with this message at 23:04 on Mar 26, 2010 |
# ? Mar 26, 2010 23:01 |
|
Hey dudes! I'm in need of some of your fine guidance here. I've been looking into building a homemade wifi antenna. Looking around the web I can see there's tons of these little crazy gadgets. I'm gonna go for a yagi antenna, following this guide here. It seems simple enough to build but I've got a few questions: 1- Would it be better to build the beam out of copper or some other metal instead of wood? 2- Is there gonna be a problem if I use a coaxial cable of about... I dont know, lets say 5 meters? Mounting the antenna on the roof and throwing a wire down to my computer room and into a regular PCI interface card. 3- Do you know of a better guide or antenna alternative? Thats it for now. I might come back with some more questions later. Now I'll go read a little more about the scienc of how these antennas work. Thanks [edit] Ok, after a little reading, I'm thinking the coaxial thing is gonna be an issue. Right? I figured there was only one kind of coaxial cable. I only have the cable TV one. Could someone point me in the right direction here? I really need to figure out the cable issue. I don't want to go for a USB dongle setup since the USB cables are limited to less than 5m CptAJ fucked around with this message at 00:47 on Mar 27, 2010 |
# ? Mar 26, 2010 23:26 |
|
RivensBitch posted:Well I'll need to redo my math, right now at 20MHz everything works and the speed of the strobe looks good on my scope, it just has some occasional blips in the colors. The new chips will be here next week, but I'm very confident that I'm on the cusp of the interrupt, and only at the end of the PWM cycle. The interrupt code is about 40 instructions during the pwm cycle, and 50 at the end. Giving me a 60% boost in instructions between interrupts will fix this, and if not then I'll have to live with a slower strobe. After looking at the calculations above, what I consider to be far more likely is that you are currently not executing every interrupt you think you are, and your visible glitches are due to what is effectively a discrete intermodulation or aliasing process when you change values. Have you verified the actual rate of processed interrupts? Do the math with different combinations of strobe frequencies and PWM resolutions, and see what is actually possible with your clock frequency and instruction count. Software PWM makes me cry on the inside...
|
# ? Mar 27, 2010 00:24 |
wow, I was unaware that there was such a thing as a PIC without hardware PWM. what a joke.
|
|
# ? Mar 27, 2010 00:51 |
|
Zhentar posted:Does your PID temp controller have a heatsink? I doubt it. If it doesn't have special cooling requirements, then it can't be pulling very much power. It's in the low milli-amps (probably somwhere in 50-100mA, though it could be a bit more). The relay has a heatsink on it (I used the heatsink from an old crappy agp card). It got hot when I used it for a few hours but not hot enough to melt the project box or anything.
|
# ? Mar 27, 2010 05:12 |
|
ANIME AKBAR posted:wow, I was unaware that there was such a thing as a PIC without hardware PWM. what a joke. I was unaware that PICs have hardware PWM until all y'all schooled me. The 16F1827 has four PWM modules, I will have to experiment with them when the chips arrive. It's too bad they only have three timing sources, it would be cool to try to use the fourth to do the strobing but once the LED dimming is being done in hardware I'll have tons of cycles leftover to do the strobing in software.
|
# ? Mar 27, 2010 08:56 |
|
CptAJ posted:Hey dudes! 1) No, the vertical rungs need to be insulated from each other. 2) The coax needs to be kept short. You're not picking up that much power with the antenna and it's going to see lots of loss (relatively speaking) through that 5m of coax. 3) You need to either have the dongle/amplifier physically at the antenna, or you'll have to located the antenna in close proximity to your PC.
|
# ? Mar 27, 2010 17:15 |
|
Cyril Sneer posted:3) You need to either have the dongle/amplifier physically at the antenna, or you'll have to located the antenna in close proximity to your PC. A 5m USb cable is fine, a 5m coax run is... less fine. Definitely put the dongle at the antenna and run a long USB cable.
|
# ? Mar 27, 2010 21:20 |
|
Ok update on my PID controller, I bought a cheap toggle switch at Radioshack today rated at 125vac at 5A. I basically just spliced it into a line going to the controller, however when I did that I started getting CRAZY readings from my thermocouple. Any ideas on this?
|
# ? Mar 27, 2010 22:41 |
|
RivensBitch posted:I was unaware that PICs have hardware PWM until all y'all schooled me. The 16F1827 has four PWM modules, I will have to experiment with them when the chips arrive. It's too bad they only have three timing sources, it would be cool to try to use the fourth to do the strobing but once the LED dimming is being done in hardware I'll have tons of cycles leftover to do the strobing in software. I'm not all that familiar with PIC architecture, but let me float this idea by you - rather than calculating your PWM at every sample, maybe you could use the built-in timers? Even though you don't have a PWM module on your existing chip, could you set the value of the timer, wait until it counted down once, and then set it to some other value? Using this method could give you more time in-between interrupts in the average case. Using this method, you could also potentially do your calculations in the main-loop and just load the new value at each ISR. That way even if you do miss a value update or two it won't have much effect because it'll just use the previous value. Each ISR would look something like: code:
Poopernickel fucked around with this message at 07:57 on Mar 28, 2010 |
# ? Mar 28, 2010 07:46 |
|
Shazzner posted:Ok update on my PID controller, I bought a cheap toggle switch at Radioshack today rated at 125vac at 5A. I basically just spliced it into a line going to the controller, however when I did that I started getting CRAZY readings from my thermocouple. maybe you put it in-line with your thermocouple by mistake?
|
# ? Mar 28, 2010 07:58 |
|
Any idea what these are? They look like capacitors but they're labeled with things like "100 16S 2QN" and I couldn't find anything on Google that matches. I'm salvaging and sorting parts from old electronics and I find that a lot of them have stuff not easily recognizable to me, even after consulting some how-to sites and guides.
|
# ? Mar 28, 2010 19:48 |
|
The Ferret King posted:Any idea what these are? Those are definitely capacitors. They look like the surface mount variety but the picture's too blurry to tell for sure. I'm not sure how the codes for these work, let me have a look around. e: They're electrolytics, the black band is the negative terminal e2: OK, it looks like the first number is probably capacitance in microfarads, the second probably voltage rating. The rest could be anything. This datasheet doesn't quite match up (2 lines of numbers instead of 3) but 100µF at 16V seems like a reasonable rating for a capacitor: http://industrial.panasonic.com/www-data/pdf/ABA0000/ABA0000CE2.pdf e3: Post some more numbers from different caps and let's see if they seem like reasonable ratings. Mill Town fucked around with this message at 20:14 on Mar 28, 2010 |
# ? Mar 28, 2010 20:05 |
|
RivensBitch posted:Well I'll need to redo my math, right now at 20MHz everything works and the speed of the strobe looks good on my scope, it just has some occasional blips in the colors. The new chips will be here next week, but I'm very confident that I'm on the cusp of the interrupt, and only at the end of the PWM cycle. The interrupt code is about 40 instructions during the pwm cycle, and 50 at the end. Giving me a 60% boost in instructions between interrupts will fix this, and if not then I'll have to live with a slower strobe. I checked the datasheet ( http://ww1.microchip.com/downloads/en/devicedoc/30487c.pdf ) and most instructions take 1 cycle, so that's where the calculations are wrong.
|
# ? Mar 28, 2010 20:21 |
|
Poopernickel posted:I'm not all that familiar with PIC architecture, but let me float this idea by you - rather than calculating your PWM at every sample, maybe you could use the built-in timers? The current chip I'm using has three timers but they're all different in how they work. The new chip will have three timers that have an adjustable period, but it also has four PWM modules (three of which are tied to the three timers). As for the 1kHz rate, even if your eye/brain can't process 1000 frames a second, that isn't really the point. Being able to adjust the timing in 1000 kHz increments is the goal. Your eye can definitely see the difference between a strobe of 100Hz vs 110Hz, that may have to do with how the light reflects within the fixture I'm using but the point is that even if you're not processing each possible step value, the precision in the timing creates different visual effects and patterns that anyone can perceive. Case in point, the current stable release of my lighting fixtures uses a strobing pattern coded within the main program loop instead of the interrupt, I've confirmed the 1kHz rate on my oscilloscope, and every single adjustable step of the strobe creates a visual affect that is noticeably different from the value above and below it.
|
# ? Mar 29, 2010 05:28 |
|
Mill Town posted:Those are definitely capacitors. They look like the surface mount variety but the picture's too blurry to tell for sure. They're definitely surface mount of some kind, I pried these off the board. They were adhered with a small plastic spacer between them and the board. So a secondary question, how to you desolder/remove surface mount components easily? All the guides I've found only explain how to remove thru-board solder mounts. Other ratings of those are: 47 6S 2CN 100 4S 2PN 30 220 4V
|
# ? Mar 29, 2010 13:31 |
|
Those aren't separate plastic spacers, they are part of the cap. Don't worry if you tossed them though, since they don't do anything electrically. The easiest was to remove surface mount parts is with hot air. If you have a heat gun that may work. You could even stick the whole board in a toaster oven (don't use it for food afterward) for a few minutes then pick the parts off before they cool. It can be done with an iron as well though. For those caps, hold the iron on one lead until you can tip it up, then unsolder the other.
|
# ? Mar 29, 2010 15:10 |
|
Does anyone know where I can find the IC layout for a 555? I can find layouts for simple things like transistors and ring oscillators or complex things like a pentium processor but nothing moderately complex. The 555 has been around forever, surely someone has a layout for it somewhere.
|
# ? Mar 30, 2010 03:53 |
|
What? You mean like an example circuit? Any result on google will give you some datsheets that have them. Here's one that has a couple circuits, depending on what you want to do with it.
|
# ? Mar 30, 2010 04:11 |
|
RussianBear posted:Does anyone know where I can find the IC layout for a 555? I can find layouts for simple things like transistors and ring oscillators or complex things like a pentium processor but nothing moderately complex. The 555 has been around forever, surely someone has a layout for it somewhere. I don't mean to be "that guy" but did you even try searching Google for "555 timer"? The first page of images alone contains several schematics that show basic usage of it.
|
# ? Mar 30, 2010 04:27 |
|
BattleMaster posted:I don't mean to be "that guy" but did you even try searching Google for "555 timer"? The first page of images alone contains several schematics that show basic usage of it. I guess I should have been more clear. I'm not looking for a schematic, I'm looking for a physical layout. How the 555 would be implemented in silicon. Like this.
|
# ? Mar 30, 2010 05:08 |
|
A 555 is not much more than a pair of comparators and a flip-flop. This page has a decent diagram of the internals of a canonical 555 and some discussion of its functionality. As the 555 doesn't do anything clever involving internal trace lengths or microwave effects or the like, you can generally build a hard implementation in whatever manner you like; wirewrap 555s work just fine, for example, and are frequently used in electronics classes as an introduction to IC-based design. Edit: If you're trying to build a silicon 555 yourself and you're having trouble, I can help you with whatever you're having trouble with if you share whatever layout you've got and your process details that you're building with. But there's not really a "trick" or anything to making it work; it's just everyday transistor/resistor/diode/capacitor and whatever traces you need to hook it together without introducing crosstalk or capacitance. Standard debugging techniques apply: If it's not doing anything, check for accidental capacitance between neighboring traces; if it's shorting, check for accidentally introducing features smaller than your minimum feature size; if it's not driving enough power, add a transistor to buffer the current; when in doubt about what's wrong, just make everything bigger and farther apart. It's helpful to build it as if you were using discrete components at first - set aside an area of your chip for each comparator, and an area for the flipflop, and get it working all spread out like that; once that's done, you can work on packing the transistors together and doing routing tricks to meet your space constraints. There shouldn't be much leakage on such a small circuit, so I wouldn't worry much about your power constraints unless you're either really constrained or need to be able to supply a large current; once you get a working 555 you'd expect to be able to shrink down to meet your feature size without breaking functionality, at which point you've done just about all you can do in terms of power. ShoulderDaemon fucked around with this message at 06:26 on Mar 30, 2010 |
# ? Mar 30, 2010 05:49 |
|
|
# ? May 21, 2024 21:30 |
|
Does anyone know a source of cheap panel mount 1P10T rotary switches? I am having a tough time finding a place that won't charge and arm an a leg per. edit: forgot to mention they would need to be panel mount therunningman fucked around with this message at 06:38 on Mar 30, 2010 |
# ? Mar 30, 2010 06:26 |