|
Slanderer posted:I did a quick search for pencil sharpener motors---was it something like this? That's actually exactly what it is. Thanks!
|
# ? May 24, 2011 03:40 |
|
|
# ? May 8, 2024 10:31 |
|
Does anyone here with embedded programming knowledge know the best way to write C code that has deterministic timing? From what I've heard in passing and inferred myself, it would seem easy to write assembly routines and padding different branches with delays (either NOPs or delay loops using an instruction like branch if not equal (to some delay)) so the section of code takes the same amount of time no matter which branches are taken, and this could be extended for more complex constructs. But what's the proper way to do this with a high level language? Do I just write the code, and then run it through a simulator/debugger and see how many instructions each branch within the section of code takes? Is there some more professional way of doing this? Also, how can I know for sure that my compiler won't change how that part of the code is compiled, even if they're unrelated (because I assume that the compiler is dumb)?
|
# ? May 26, 2011 01:46 |
|
When doing anything with that kind of precision, I would definitely switch to assembly. If you use inline assembly in your c code, be very very careful with functions and the stack.
|
# ? May 26, 2011 01:51 |
|
Yeah, gonna say that if you need that kind of precision you don't use C. Well if you can read the disassembly listing and you have a good feel for what statements turn into what instructions I guess you could pull it off but I bet it would be too much effort compared to just using assembly.
|
# ? May 26, 2011 02:57 |
|
If your clock was fast enough and it wasn't important to run the code as fast as possible couldn't you start a timer before the branches and have them return to some code that waits until the timer hits a specific value? Actually I suppose it wouldn't be very inefficient if you made the timer just slightly longer than the longest path.
|
# ? May 26, 2011 08:40 |
|
Slanderer posted:Does anyone here with embedded programming knowledge know the best way to write C code that has deterministic timing? You just tick a clock variable every time the clock ISR hits and run everything else based off of that. So certain routines can go every 5 milliseconds, other can go every 10 milliseconds etc. This way if even a particular routine takes longer than a single clock cycle (or even many clock cycles), because the clock ISR has the highest priority your overall timing won't slip. By much, anyways.
|
# ? May 27, 2011 00:09 |
|
Zo posted:Depends on how accurate you need it, c can work. In the automotives industry they get around this by, as was mentioned, having a fast clock and using only one ISR essentially, that being the clock peripheral, . That's the way I'm doing things currently. The microcontroller I'm currently working with has a total of 7 timer/counters. Each of these as either 2 or 4 compare channels (or capture channels, for input), each of which can trigger an interrupt, as well as normal overflow interrupts. And if I want to increase the timer resolution from 16 bits to 32 bits, I can use a feature called the "Event System", which routes triggers/data/whatever between individual peripherals w/o CPU intervention, to chain two timers together into a 32 bit timer. It can do a gently caress ton more, too. Frankly, I'm mostly interested in doing stuff the "old" way because I'm sorta spoiled by the scope of the peripherals I'm working with.
|
# ? May 27, 2011 05:57 |
|
Slanderer posted:Frankly, I'm mostly interested in doing stuff the "old" way because I'm sorta spoiled by the scope of the peripherals I'm working with. Microcontrollers have had timer peripherals for a looong time. For example, Intel's 8051, released in 1980, has two 16-bit counters with interrupts. I wouldn't consider it a modern convenience in the same realm as an integrated CAN controller or similar.
|
# ? May 27, 2011 20:22 |
|
The Intel 8080 and Zilog Z80 both had official timer chips in their peripheral collection so computers have pretty much had access to timers since they've been small enough to use in embedded applications. If you want to do it the hard way then you're just going to have to get used to reading disassembly listings - So I discovered that high-side MOSFETs in a bridge need to be driven with a higher voltage than the load. Which makes sense now that I think about it but was confusing the hell out of me when my first attempt at an H-bridge was screwing up. So I built a charge pump with a 555 timer () and everything's cool. Only thing is, while it works I don't know how to select the frequency or capacitor values or anything like that. Searching for charge pumps seems to only find articles on how to use ASIC charge pumnps. Anyone have any resources on designing charge pumps?
|
# ? May 28, 2011 12:46 |
taqueso posted:Microcontrollers have had timer peripherals for a looong time. For example, Intel's 8051, released in 1980, has two 16-bit counters with interrupts. I wouldn't consider it a modern convenience in the same realm as an integrated CAN controller or similar. Having a basic timer is one thing. But the MCU he's talking about has things like direct timing of the DMA controller, several compare and capture registers, triggered control of other peripherals, etc. For realtime applications those hardwired event systems can eliminate the need for several interrupt routines in software. BattleMaster posted:So I discovered that high-side MOSFETs in a bridge need to be driven with a higher voltage than the load. Which makes sense now that I think about it but was confusing the hell out of me when my first attempt at an H-bridge was screwing up.
|
|
# ? May 28, 2011 20:07 |
|
Possibly stupid question about the Arduino: the circuit can only push something like 40mA from each output pin, so if you need more you have to use the pins to switch current from the power supply through a transistor or something. But what's the limit on the current you can safely draw from the Vin pin, assuming your DC power supply is otherwise up to the task?
|
# ? May 30, 2011 23:56 |
|
200mA, though certainly not for any significant length of time.
|
# ? May 31, 2011 00:03 |
|
I don't suppose anyone here has any familiarity with some manner of circuit/sensor designed to measure salinity? I have a couple of possible sensors in mind (e.g. this) but am not sure I'll be able to discern it's mode of operation. I suppose I should mention that it's for a fishtank (my own) and that finding an off-the-shelf salinity sensor is neigh-on-impossible under a reasonable budget. Any ideas?
|
# ? May 31, 2011 01:45 |
|
Whompy posted:I don't suppose anyone here has any familiarity with some manner of circuit/sensor designed to measure salinity? I would guess that salinity has an inverse relationship to resistance, so you could measure the resistance between two probes of a fixed distance and correlate that to salinity. It would require calibration, and the probes will corrode quickly they're copper.
|
# ? May 31, 2011 04:25 |
|
ANIME AKBAR posted:
Yeah that's probably the best solution. I just wanted to rig up something with parts I already had. There isn't enough stuff I want to buy to justify the shipping from Digikey so I'll see if one of the hobby shops here has a high-side driver.
|
# ? May 31, 2011 04:28 |
|
SnoPuppy posted:I would guess that salinity has an inverse relationship to resistance, so you could measure the resistance between two probes of a fixed distance and correlate that to salinity. It would require calibration, and the probes will corrode quickly they're copper. I'm no chemist, but it should also be affected by the amounts of potassium, calcium, and crap like that in the water. Calibration is probably going to be annoying with a couple reference solutions (some tap water has a LOT of sodium in it)
|
# ? May 31, 2011 04:58 |
sixide posted:200mA, though certainly not for any significant length of time. I routinely run ~250ma through the 5V regulator on my arduino for hours at a time, from a 12V input. Gets drat hot, but hasn't broken yet. Keep in mind the max current tolerated by the regulator will depend on the input voltage (more input voltage means more heat and less max current).
|
|
# ? May 31, 2011 05:29 |
|
That's regulator current, and given typical linear regulator efficiencies not all of that is making it to the Vcc pin on the MCU. The 328 is rated to 200mA as an absolute maximum.
|
# ? May 31, 2011 05:54 |
|
Slanderer posted:I'm no chemist, but it should also be affected by the amounts of potassium, calcium, and crap like that in the water. Yeah, any ions, not just sodium ones, would act as charge carriers and would contribute to a lower resistance.
|
# ? May 31, 2011 06:24 |
|
The following assumes that Whompy has a saltwater fishtank: 1) Calibration would be easy since RO/DI water should have a zero or near-zero total dissolved solids and be pretty deionized. 2) I don't think it's a good idea to put bare copper in the water (copper kills marine invertebrates). 3) Would another metal be sufficient for measuring resistance between two probes? Most metal motor axles for powerheads and such are titanium and even that corrodes eventually but it takes a lot longer. 4) I'm not sure what Whompy's setup is like or why he's testing for salinity in the first place but would specific gravity be a possible alternative measurement? I have zero idea if that can be measured electronically. I've only seen it measured optically with a refractometer and via buoyancy with those goofy swing-arm things.
|
# ? May 31, 2011 14:25 |
sixide posted:That's regulator current, and given typical linear regulator efficiencies not all of that is making it to the Vcc pin on the MCU. The 328 is rated to 200mA as an absolute maximum. Oh, I thought he was asking for the regulator limit. Yeah, for most microcontrollers there is a max current per pin, but there is also usually a maximum current per I/O bank which puts an additional limit on total current. 200ma sounds right.
|
|
# ? May 31, 2011 17:11 |
|
csammis posted:3) Would another metal be sufficient for measuring resistance between two probes? Most metal motor axles for powerheads and such are titanium and even that corrodes eventually but it takes a lot longer. One of my friends was doing a project that involved salinity measurement and I think I recall platinum being used because it doesn't corrode. I know for sure that they use it when doing electrolysis of water for that reason. Speaking of which, I think I recall my friend having to use AC across the electrodes or else it actually would begin to electrolyze water. BattleMaster fucked around with this message at 18:32 on May 31, 2011 |
# ? May 31, 2011 18:25 |
|
csammis posted:The following assumes that Whompy has a saltwater fishtank: Measuring conductivity would be the easiest. Density measurements would require ultrasonics or a mechanical float gauge. Ideally, you would use gold or platinum plated electrodes, since those do not corrode like copper does. Honestly, I think just buying a sensor would be the easiest - the electronics won't be difficult, but constructing a robust probe head will be. Now, if this is just a quick measure of the water, and then you remove and clean the probe, you could probably get away with a PCB that has an ENIG finish. Just make sure you wash the PCB before you put it in the tank, and definitely don't keep it submerged for any length of time.
|
# ? May 31, 2011 18:30 |
|
A quick search revealed that all these salinity monitors are encapsulated things. Now, that's probably just because they threw the electronics in their, but is there any chance they use a more complicated (and selective) electrode like pH meters do? ie, http://en.wikipedia.org/wiki/Glass_electrode EDIT: Apparently I'm not talking out of my rear end: https://www.sciencelab.com/page/S/PVAR/50-FC300B Slanderer fucked around with this message at 18:57 on May 31, 2011 |
# ? May 31, 2011 18:55 |
|
SnoPuppy posted:Measuring conductivity would be the easiest. Density measurements would require ultrasonics or a mechanical float gauge. Pg = (rho)*g*h Is it practical to measure height and static pressure of a column of saltwater? Or if you had an overflow setup to control height of the water column, all you need to measure is pressure.
|
# ? Jun 1, 2011 10:31 |
|
Anyone know of a USB-B jack with integrated LED, like some RJ45 jacks?
|
# ? Jun 1, 2011 15:57 |
|
taqueso posted:Anyone know of a USB-B jack with integrated LED, like some RJ45 jacks? The closest I could find were USB + RJ45 (with LED) combinations.
|
# ? Jun 1, 2011 23:20 |
|
Slanderer posted:The closest I could find were USB + RJ45 (with LED) combinations. Ya, I looked for a few hours and couldn't find even a hint of one.
|
# ? Jun 1, 2011 23:25 |
|
taqueso posted:Anyone know of a USB-B jack with integrated LED, like some RJ45 jacks? I don't think that's in the spec.
|
# ? Jun 2, 2011 06:39 |
|
What up thread. I posted this question in ML but got no answers; I'm not very electronics savvy but I've learned quick and decided to jump right in and try a DIY guitar stomp-box. Here's what I asked in ML:big business sloth posted:So I've decided to build my own distortion box via an old walkman tape player, after seeing all these videos/pics about it. I figured it'd be simple, slap a jack onto where the tape head goes and one on where the audio out/speakers go, and that'd be that. However I know nothing about electronics and have become confused by what I discovered when I opened up my tape player. I was following the instructions on http://brokenpants.com/?page_id=211 but what I've got appears to be different. I'd google this sort of thing but my lack of understanding and terminology makes it difficult. My problem is: As I said, just a point in the right direction would be much appreciated.
|
# ? Jun 3, 2011 00:02 |
|
I suspect you're missing a conductor on the tape head. It could be very small. The alternative is that your walkman is actually mono. Trace out where the conductors go, if it terminates at 2 places on the PCB it's probably a mono playback head. Basically it's still possible but you can't feed the signal through twice. If there's 3 terminations, there's no issue. I don't really understand why you'd want to apply the ludicrous amount of gain needed to amplify a tape head signal up to headphones level twice. As for the second, I don't understand what the problem is. You have both mono and stereo cables? Also if this works out well, you should look into using one of those old line-to-cassette adapters for tape saturation. It sounds pretty awesome. Even better if you could use a tape loop and a record and playback head. Then you could saturate, delay, and add tape flutter.
|
# ? Jun 3, 2011 00:29 |
|
Yeah, the wires both terminate independently on the board. So it's mono then I guess? Regarding the cables; I guess I'm just not sure how they work. Guitar cables are mono I thought, so I figured in the instructions on the blog he'd be using mono cables to get it done. But he uses cables that have three wires, (red white black) which is how my stereo cable is. So I guess he's using stereo cables? Either way, what would be the logical connection for the mono cable (er, which wire does which?). I actually tried wiring it up once, this is how I did it: code:
Anyway, this produced no sound, obviously, but I'm sure I'm just missing some key element.
|
# ? Jun 3, 2011 01:52 |
|
big business sloth posted:Yeah, the wires both terminate independently on the board. So it's mono then I guess? He's using an XLR, or balanced mono. Which basically wires, signal-ground-inverse_signal. So if you are receiving unbalanced then just connect one of the signals up.
|
# ? Jun 3, 2011 02:07 |
|
big business sloth posted:I figured the black stereo cable was a ground of some kind and wired in in a logical place on on the body of the walkman. This is probably not right and I feel dumb looking back now. Aren't walkmans usually plastic? Be sure you're connected to the signal ground at the output. Also there's a possibility that I didn't think of earlier, the tape head's housing might serve as the return path. It could be electrically connected through a screw or something. edit: Standard 1/8" and 1/4" jacks/plugs are set up so that connections between mono and stereo will be tied together. Basically, it will approximate a sum of the left and right channels. sixide fucked around with this message at 02:43 on Jun 3, 2011 |
# ? Jun 3, 2011 02:40 |
|
sixide posted:Aren't walkmans usually plastic? Be sure you're connected to the signal ground at the output. You've been preempting most of the posts that I've wanted to write, but one thing--a quick search revealed that some really cheap "Walkman"s were actually only mono, although I'm not sure if that meant they mixed the two audio channels from the tape, or only read one. Also, all the magnetic card read/write heads I've seen have always been free-hanging modules that snap into the plastic mechanism, isn't of being soldered to something (so it's further unlikely that the metal of the head is the ground return)
|
# ? Jun 3, 2011 02:59 |
|
Ok let me make some corrections now that I have the thing in front of me. First, there was a black wire from the board that was originally soldered to a small contact on a screw on the motor body mechanism. When the play button is pushed, something moves beneath it. I cut this to remove the motor mechanism, and also a red and black wires that I assume were sending power to the motor. These I have left free. The black that was on the screw contact I had connected to the black from the R/W/B 1/4" jack plug. EDIT Fuckin' got it to work! there was a power connection that needed to be fixed, probably the play button's job or some poo poo. Gonna play it in my setup right now, I would like to know what I could possibly do with the record head. Fun stuff? Thanks for the insights anyhow. EDIT 2: Further insights after the initial success. It actually sounds more like a fuzz pedal than a distortion pedal, and to be honest the signal is a little weak. Also, whenever there is input from the guitar, the battery button grows dimmer for a moment, and with sufficient signal it actually switches off for a second and cuts the sound. It's kind of neat but pretty annoying. Anyway I think I'll want to route the signal through the circuit a second time, but that will require some more wire, I would think. doug fuckey fucked around with this message at 19:07 on Jun 3, 2011 |
# ? Jun 3, 2011 17:17 |
|
From the Scammed! thread:
|
# ? Jun 5, 2011 05:04 |
|
How do you all like to draw circuits? I was reading "Make" earlier and I am pretty impressed by their schematics. I usually just print whatever Orcad Capture shows me but I'm feeling really inadequate right now.
|
# ? Jun 5, 2011 20:39 |
|
Corla Plankun posted:How do you all like to draw circuits? I was reading "Make" earlier and I am pretty impressed by their schematics. I usually just print whatever Orcad Capture shows me but I'm feeling really inadequate right now. Curved lines?! That's just weird
|
# ? Jun 5, 2011 20:48 |
|
|
# ? May 8, 2024 10:31 |
|
Slanderer posted:Curved lines?! That's just weird Wires going through components? That's just wrong.
|
# ? Jun 5, 2011 21:57 |