Light Dependent Resistor (LDR) and LED lighting

Garahbara

New Member
Hi,

That waveform looks very "suspicious" and my inclination is that "Earth" is not what you think it is, BUT.....

If the "Earth" (local to the point that Channel 1 is measuring) is "dirty", then connecting it to the PCBScope might cause damage, so: Connect the Channel 2 probe to the Earth (0 volts) point close to the Channel 1 probe, and "tick" CH2 . The (horizontal) blue line should be just that, of course; if it isn't then you've learnt something. ;)
hmmmmm........ what do you mean by "dirty"?๐Ÿค“ a dodgy solder joint or something? And by "Earth" I think you mean the -ve common "bus" I've got on the board? (black wire).?? ๐Ÿค“

That's another feature that "big" scopes have; a "differential" mode, either a "dedicated" facility (or the early Tektronix 'scopes actually had an optional "plug in" Differential Pre-amplifier module), or simply an "invert signal" for one of the channels and an "Add" mode for the two channels (or of course a "Subtract channels" mode).

Cheers, Alan.
ummmmmm.... my eyes have glazed over with that one.๐Ÿ˜ต
 

Garahbara

New Member
I concur with Alan about the earth connection.

Also you should look at the capacitance you have across the power rails on each board. Depending on the power requirements, you may need a few hundred microfarads on each board.
hmmmmm...OK. How would I "look at the capacitance I have across the power rails"? :geek: Do you suggest I replace the 5V AC with the 5V DC supply I bought today?
 

inglewoodpete

Senior Member
hmmmmm...OK. How would I "look at the capacitance I have across the power rails"? :geek: Do you suggest I replace the 5V AC with the 5V DC supply I bought today?
You seem to be drip feeding us information. I can't imagine what part a 5v AC supply has in your setup.
 

AllyCat

Senior Member
Hi,

Basically, I don't believe that the PICaxe could work on the supply voltage that you've shown, so "something is wrong". The most direct way to find out, is to connect the PCBScope CH1 to the PICaxe's +5v pin (Vdd, and traditionally wired Red) and CH2 to the 0v (aka Earth, Vss, and traditionally black). Ideally connect to the pins themselves or components nearby, but whatever is "reasonably convenient". The 0v should be just a horizontal line on the PCBScope, if it's not then I'd call it "dirty". In electronics we normally call the power supply lines "rails" (perhaps I can see why you don't) because "bus" normally applies to a group of "wires" carrying data signals.

I have to confess I've never seen the nn or nnP nomenclature and one might believe it's meant to be a m (for mu , not milli F which I think would be impossible). But I don't think I've ever seen ceramic capacitors above 10 uF and they're normally specified in pF (pico F) or nF (nano F) : 1,000,000 pF = 1,000 nF = 1 uF = 0.001 mF, so a pF is very small.

Therefore, I'm not confident that they will be much use for this particular application (but don't bin them yet). The simplest test might be to connect the "largest" one you can find directly across the LDR or 100k resistor (or whatever you used) and repeat the measurement you made in #69. If it "smoothes" (reduces) the ripple amplitude then maybe there's hope.

To make a quantitative measurement you need an ac signal, preferably a square wave, perhaps around 1 kHz. The earlier DPScope actually generated 1 kHz to align the (BNC) probes, but looking at the last section (7) of the PCBScope User Manual it simply says to use a generator, or a PICaxe pin toggling at 2 kHz. Do you now have a PICaxe protype/development board that you can easily use? If so, we can write a very simple program and make a test setup to "measure" the ceramic capacitor values that you have.

That's probably enough for now as I presume your bedtime is approaching. ;)

Cheers, Alan.
 

Garahbara

New Member
You seem to be drip feeding us information. I can't imagine what part a 5v AC supply has in your setup.
Ah..... I'l try to explain in my limited "terminology".

This is an example of the Picaxe boards that control the signalling system on the model railway. (posted earlier up the thread).

24089

There are 10 of these, one located at each signal along the track.

Up the top right, is the power feed to the board. +ve & -ve (red & black). You'll see that the +ve/-ve runs to the power (+ & -ve) pins on the Picaxe. The power bus then flows out the bottom right (red/black), and along to the next Picaxe board down the track. I have indicated the connection to the LDR for train detection for that particular signal. The three resistors at the bottom are for the red/yellow/green LEDs in the actual signal.

For some reason (I have no idea why) I powered this with a 5 V AC powerpack adaptor (connected to the +ve/-ve red/black power bus).

You will also see a "blue" (un notated) wire at the top middle, and bottom middle. This is also part of the "bus" connecting each Picaxe board at each signal. One blue wire on an "input" pin, and the other on an "output" pin. These receive different length pulses from the next signal, and send differrent length pulses to the prior signal. EG if the next signal down the track is "red", then this signal board will measure the "pulse length" received as being "red", and set this signal to yellow, This signal then sends a "pulse length" of "yellow", so the prior signal will be able to change to "green" , and so on and so on, up and down the track.

Hope I've conveyed that in a comprehensible way. :geek:

TOOT!

EDIT: I've learnt now, that I should be saying "power rail" not "power bus". ๐Ÿ˜
 
Last edited:

Garahbara

New Member
OK guy. An admission to make. My big boo boo I think. I've made a mistake.

On real close look at the power supply it says "AC ADAPTOR" Output = 5V with a____________ (solid line) and a ----------- (dotted line) underneath the solid line. then 3.0A (3.0 amps??) I've seen those lines on a few things lately, and I'm sure the lines mean "DC".

So we can scrub the bit about having a 5V AC supply stuff?

Mea cupla and apologies.

Now for those capacitors I got. Further notation on the packet says P=5mm and they are 5mm across.

So CAP CER NPO (Non-Polarised??) 10P 50V where P = 5mm, I suppose. Magnifying glass says it has 10 J on the actual capacitor
CAP CER NPO 100P 50V and 101 J on that actual capacitor.
CAP CER NPO 4P7 50V has 4.7 J on the actual capacitor.

I think I'm tyring to take too many shortcuts with this and I'll order a range of 1uf through 100uf electrolytic capacitors.16V. They'll take a week or so to arrive.

I trust I'm not asking too much of you guys for help here.

Alan.

TOOT!
 

Garahbara

New Member
Hi,

Basically, I don't believe that the PICaxe could work on the supply voltage that you've shown, so "something is wrong".
I think we've sorted that one.

Therefore, I'm not confident that they will be much use for this particular application (but don't bin them yet). The simplest test might be to connect the "largest" one you can find directly across the LDR or 100k resistor (or whatever you used) and repeat the measurement you made in #69. If it "smoothes" (reduces) the ripple amplitude then maybe there's hope.
MIght give that one a go on the weekend. I work full time, so not much play time for me during the week.

Do you now have a PICaxe protype/development board that you can easily use?

Cheers, Alan.
Not easily. I have a spare breadboard, and I've just got the USB Picaxe programming cable today, but no way of connecting it to the board yet. I've made the decision to use the project boards from now on, rather than make my own out of veroboard. I'm not about to dig out my old home made serial port, 3 pin programming cable. :eek:
 

inglewoodpete

Senior Member
I recommend you put a 100nF (0.1uF) as close as practicable to the PICAXE's power pins (if there is not one hiding under the board). Also, because of the electrically noisy environment and relatively long thin leads, this board should have its own electrolytic capacitor on board I'd use a 220uF but you could probably get away with a 100uF. 16v electros are adequate but can be hard to find. 25v and 35v versions are physically not much larger.
 

Garahbara

New Member
3-pin programming cable is the best (just my opinion, of course).
You'll see the three pin programing plug up the top right of the board pic (Post #85). Trouble is, my three pin programming cable has a serial port plug on the other end. I haven't cranked up the laptop I used to progam these things for years. (it had a serial port). I do have a USB --> serial driver cable that I use for connecting the laptop to the Digital Command Controller for the trains (yes, you now program locos and drive them from your computer or wireless Android device or your phone). Model trains now run on a constant 14 - 17 V AC track, with digital data packets slotted in between the AC phases and a digital decoder in each loco that interprets the data packets. eg. a data packet would be "Loco No 10 - fwd - speed 20" or "Loco No 5 - toot horn" etc. BIt more to it than that, but that's the basics of it.๐Ÿš‚๐Ÿ›ค
 

Garahbara

New Member
I recommend you put a 100nF (0.1uF) as close as practicable to the PICAXE's power pins (if there is not one hiding under the board). Also, because of the electrically noisy environment and relatively long thin leads, this board should have its own electrolytic capacitor on board I'd use a 220uF but you could probably get away with a 100uF. 16v electros are adequate but can be hard to find. 25v and 35v versions are physically not much larger.
There is nothing hiding under those boards except hot glue gun to stick them on. To get them off I'd likely break them in two. Yes I was a bit maverick in those days! I note your comment "electrically noisy environment". You're probably not wrong. The power bus runs alongside and bundled with a plethora of other wiring that runs all the other stuff on the layout.

But they've all worked fine for years. Goes to show the robustness of Picaxe, I suppose.
 

AllyCat

Senior Member
Hi,
I think we've sorted that one.
I don't think the "bus ripple voltage" waveform in #77 has been explained yet: :(

BusRipple.png

As for the ceramic capacitors, obviously one meaning of the "P" is the pitch of the leads (personally I prefer 2.5mm, but they seem harder to find than 5mm now). But the most common unit for them is pF (picoFarads), perhaps so common that it's assumed (rather than being printed on the tiny packages). For larger values, two digits and a multiplier (i.e. the number of additional zeros) is used, for example "105" means 10 00000 = 1,000,000 pF = 1 uF. Also, since it's easy for a decimal point to be overlooked, it's quite common to replace it with the multiplier units, for example 5p6 = 5.6 pF, 4k7 = 4.7 kohms, 5R6 = 5.6 ohms, etc..

I think probably the "nnP" means that those capacitors are marked with two digits which represent the value in pF. The "NPO" is possibly the ceramic material formulation and/or their (zero) temperature coefficient: Ceramic capacitors often were employed in the tuning oscillators of radio sets (together with an inductor), where frequency stability can be very important.

So I don't think those capacitors are gong to be of much use for the present filtering task. But they might be handy if, for example, you want to make a simple (frequency-compensated) 10:1 or 100:1 voltage-divider probe to use with the PCBScope (for anything over 13 volts rms). They're also what I needed recently to assemble a RTC (Real Time Clock) chip to use with a PICaxe.

Quite a number of us still use the "Legacy" programming pins, at least occasionally, for convenience or to use less PCB area. It is "possible" to find/make USB adapter cables to program PICaxes, but there can be a number of complications. So if you already have the 3.5mm Programming cable (AXE027) then the best thing to do is to make an adapter cable from a 3.5 mm stereo socket to the "Molex" or Dupont header sockets (the pin arrangement is still shown in PICaxe Manual 1).

Cheers, Alan.
 

Garahbara

New Member
OK guys,

I've ordered some electolytic capacitors.

16V 10, 22, 47, 100 uf and 25V 10, 22, 33, 47, 100 uf.

That should give me a reasonable config/range to put across the LDRs to test this thing under the LED floodlights.

Oh.... and a 3.5mm stereo line socket and some 3 pin headers with crimp pins (I don't have any) to make up an adaptor connector for my new USB programming cable to the old "3 pin" plug on the old boards, (or new ones I might make!) as Mr Allycat suggested. I already have about 20 of the 3 pin PCB mount plugs to match, but no headers.

That lot will take a week or so to turn up.

A couple of servo motors **these** should turn up tomorrow, that will drive the railway crossing boom gates up and down. So that'll give me something to muck with to get them working from a Picaxe in the meantime. :eek: o_O :eek: o_O Have I ordered the servos that will do what I want? I have no idea. ๐Ÿคชo_O

Again, many thanks for your help here. I'm learning something, which is the important thing. :cool:

Alan.

TOOT!
 
Last edited:

roho

Member
A couple of servo motors **these** should turn up tomorrow, that will drive the railway crossing boom gates up and down. So that'll give me something to muck with to get them working from a Picaxe in the meantime. :eek: o_O :eek: o_O Have I ordered the servos that will do what I want? I have no idea. ๐Ÿคชo_O
I use those Tower Pro SG90s for turn out switching. They're easy to use and reliable, I've had no problems at all with them and they should work fine in your application. However, they don't have any fixing lugs on them (don't know if this is a common trait of miniature servos or not since these are the only ones I've ever used) and so fixing them securely in the right place may require a little creativity. Electrically they're noisy so make sure you run them off their own 5V supply.

Roger.
 

Garahbara

New Member
I use those Tower Pro SG90s for turn out switching. They're easy to use and reliable, I've had no problems at all with them and they should work fine in your application.
I think they would work well too. I've set up all my turnouts to use the Peco solenoid switches via a CDU (Capacitor Discharge Unit). I made the first CDU from a kit, and had throw rail connectivity problems. The "throw" wasn't strong enough. Put in a Peco CDU and "WACK - - "WACK" much more powerful and instant recharge. No real throw rail connectivity problems since. How do you drive you Tower Pros as turnout switches? With Picaxe?

Fixing them to the baseboard etc? They uses a bracket and double sided tape **here** but you'd need to mount them horizontal for turnout switching.
 

Garahbara

New Member
Electrically they're noisy so make sure you run them off their own 5V supply
I've done some research on programatically driving them, and Picaxe recommend running them off their own 5V supply, however Arduino suggest run them off the same power rails as the Arduino. ๐Ÿ˜ต :eek:

I've looked at code to drive them and control the speed as well.

Basically, (and in my own pseudo code).

Initalise the servo first of course. (Servopos)

User "Servo" command, and put the code into a loop, (with from-to position as a loop counter). then increment the "position" by 1, with a "pause" included. The length of the pause, sorta controls the speed.

If anyone can suggests a better way of controlling the servo speed, (to raise/lower the boom gates at a realistic speed) please let me know.

Alan.

TOOT!
 

AllyCat

Senior Member
Hi,

An Arduino drains much more power from the supply, so it may need a "better" power supply (than a PICaxe), which then may well be able to also drive servos. In principle, a PICaxe can run off 3 Carbon Zinc AAA cells, but I wouldn't try also adding a couple of servos. ;)

As for moving the barriers, it depends if the PICaxe has anything "else" to do at the same time. Something "simple" could probably be included in the basic "delay" (pause) loop, but an alternative would be a timed interrupt to "step" the barrier position(s). The X2s can do that internally, or an M2 by looping a PWM output back into an "interruptable" pin, for example.

Cheers, Alan.
 

Garahbara

New Member
As for moving the barriers, it depends if the PICaxe has anything "else" to do at the same time
Mr Allycat,

Yes I had worked that bit out as a problem. It will need to flash alternately the red flashing crossing lights at the same time as lowering/raising the gates, and had pondered how I was going to achieve that using just a single Picaxe. I have used the "interupt" command in the signaling code, so I'm familiar with what it does. Plus, while lowering/raising the gates using that sort of loop, and a train comes the other way on another track, it won't detect it, cause the Picaxe will be in the raise/lower gates loop for 4 - 5 seconds. So I've got some thinking and experimenting to do.

PS. The "sound modules" are in the country and "awaiting customs clearance" according to online tracking. And the capacitors are on their way.
 

AllyCat

Senior Member
Hi,

It should be "easy" to include Flashing the lights (and probably polling another train-sensor), within the basic "gate-stepping" loop (just another loop-counter, etc.). PICaxe interrupt capabilities are quite limited, so they're best saved for something "important" or urgent.

Cheers, Alan.
 

roho

Member
I've set up all my turnouts to use the Peco solenoid switches...
Aahh yes, Peco solenoid switches, I remember them well. Driving them wasn't a problem, but the noise they make -- WACK! as you rightly put it -- was too much for me, so I junked them in favour of using a servo.

How do you drive you Tower Pros as turnout switches? With Picaxe?
Indeed so, yes, 14M2 for the two way turn out and an 18M2 for the three way and the slips.

Fixing them to the baseboard etc? They uses a bracket and double sided tape **here** but you'd need to mount them horizontal for turnout switching.
The principle is the same though my approach is rather more agricultural. I superglue the servo(s) to a dedicated PCB for each turn out, and this assembly is screwed into the correct location under the baseboard. A small hole in the PCB provides the fulcrum for the linkage, which is an L shaped length of piano wire.
 

Garahbara

New Member
The problem with those is that the signals need to be inverted. Following a design by goetex via erco, I made a Picaxe programmer PCB to do this which anyone can order: https://picaxeforum.co.uk/threads/picaxe-programmer-pcb-for-ch340-gold-usb-serial-adapter.31823/
Well that was a bit of rigmarole and muckin' about. To get my new Picaxe programming cable to work, and setup the drivers and stuff.

Silly me plugged the cable in first, didn't I, so I had to use the .zip file and manually load the drivers, and also the COM port drivers as well. Device Manager sorted a lot of it for me.

The loopback and voltage tests on the USB programming cable work fine. (Picaxe Editor 6.1.0.0) I don't think I'm gunna try my other USB - serial cable I mentioned, together with my old serial programming cable.

Might make up a 3.5mm stereo socket to 3 pin cable. To plug onto those old boards, if I need to. Just need to work out which pin goes to which lug on the 3.5mm stereo socket! I'm sure it's documented somewhere. I'm right that this will work? :geek:
 

Garahbara

New Member
Mr Alley Cat, Sir,

You are a gentleman and a scholar. (y)

I got a range of 25V electrolytics. They smoothed the strobing out beautifully. I put them across the LDR.

Tried the 47uf first, and it didn't respond quick enough. By the time the LDR voltage had lowered enough, the loco had gone past. (slower speed of the loco did work) Tried the 100uf and it took even longer to respond. Tried the 10uf and it's just enough. The train signals work again, and the existing logic in the Picaxe operates the signal correctly. Although, if I run the loco flat chat, it passes by the signal too quick, even with the 10uf.

To get a lower uf I have to go to a higher voltage capacitor. I can get a u47 1u, 2u2, 3u3, 4u7 and 10uf 63V capacitor. I'm assuming these are .47uf, 1uf, 2.2uf 3.3uf & 4.7uf. Would these respond quicker than the 10uf 25V, yet still smooth the voltage enough?

This is the wave from the sillyscope using the 10uf 25V capacitor when a loco on it's own arrives, then goes past at mid/high speed. My maths tells me it takes about .4 secs to reach the low point, and about 1.25 sec for the loco to go past. I'd like it to be about .25 secs or lower when detecting the loco. The rise timeframe desn't really matter.

24094

Mr Alleycat, what you have prescribed is exactly the sort of thing I needed. I didn't want to have to pull the Picaxe boards apart, or "fix" any of the code in them. You are, indeed, most helpful. It's now just a matter of fine turning. This will also help immensely with the 12 train detectors I need for the level crossing.

And thanks again to all that have contributed so far.

Thanks,

Alan.

TOOT!
 
Last edited:

AllyCat

Senior Member
Hi,

Electrically, the voltage rating of a capacitor is not very important, provided that it is "high enough". So in principle a PICaxe circuit could use 6.3 volt electrolytcs (but there can be minor disadvantages). A parameter of capacitors that we haven't really discussed is their physical size (often called the "can" size). The (volumetric) size of the can is approximately proportional to the product of the capacitance and the voltage rating (or the C.V product). Typically, a capacitor of 10uF at 16v (or 16uF at 10v, etc.) is about the smallest physical size that's worth manufacturing. Generally, a manufacturer's capacitor family may have about 6 can sizes covering about 10 - 100 uF at 16v. So the 100uF may have about 8 times the volume of a 10uF, i.e. twice the linear dimensions, but probably increasing more in diameter than in height. If physical size is an important factor then you might consider lower voltages (when practical) of 10v, 6.3v , 4.0v or even 2.5 volts, but probably not unless values above 100 uF are required.

Conversely, if lower capacitor values are needed (to respond more quickly as you say), you might gradually choose higher voltages (if they're available), through 15v, 40v to 63v (and maybe 100,) but unless physical size is critical, you'd probably jump straight to 63 volts (and may have to), where the lowest values 0.63 - 2.2 uF might use the same can size anyway. That's also the point were you consider changing the "technology" to ceramic (or to one of the plastic film types), with the advantage of being unpolarised (so you don't need to worry about which way they're inserted). An advantage of having only a limited range of voltages (e.g. 10 - 16 and 64 - 100) is that when testing you can quickly swap values up or down by can size without having the read the tiny digits on the cans. ;) So, what I'm guessing is that you might (ultimately) need (electrolytic) capacitors around 2.2 - 4.7 uF and perhaps rated around 63v, but there's no need to hurry because we can probably "make up" those values for testing.....

Because, I'm afraid more testing is required first. There will be two "limit" situations, one when the capacitor is too small and the ripple from the light causes the program to malfunction (i.e. your original problem) and the second when the capacitor is too large and a train moving quickly is missed. For each of these situations we need to identify the "worst (possible) case", which will probably depend mainly on the light level. Then we can (hopefully) choose an optimum configuration mid-way between these limits, to give reliable operation under all conditions.

The first limit is when the time constant is too small, that's when the capacitor is (too) small and the resistance is also small. That will occur at the highest light levels, so you need to create those conditions, obviously with the floodlamps on "full", probably with any additional ambient light present and at the brightest part of the layout. To be safe you might even introduce another floodlight near to the sensor you're testing (but not creating an unrealistic brightness). If you don't have any smaller capacitors to hand, you can make (e.g.) 5 uF by connecting two 10 uFs in series (and connecting negative to negative or positive to positive leads will make it unpolarised). In principle you can put 3 or 4 in series to make 3.3 and 2.5 uF. I wouldn't expect to be able to to go any lower as the LDR resistance also will be lower at the high(est) light level.

Then, you need to test that the filter delay (time constant) is not too long. Here the test capacitor will be larger, but also the (LDR) resistance at its highest, i.e. with the minimum light level (floodlights dimmed) and equivalent to the "darkest region" on the track, and running the train at the maximum possible speed. Hopefully, you will be able to make this capacitor value significantly larger than for the first test, and then you can choose an optimum/compromise capacitor value comfortably between the two.

Ultimately, you will need to test the final chosen value(s) on the real track, with real (worst case) conditions (because the existing software operation isn't fully characterised), but we should be able to do quite a lot with the 'scope. Note that when you use the slow trace to display the train passing, then the "ripple" from the floodlights will cause the line to become wider (technically we call that an "envelope"). There's little sign of it in your screenshot in #105, which suggests that you can safely reduce the capacitor value; Some "ripple" is apparent, but it's a lower frequency than 50 Hz, so not directly related to the lighting (and hopefully can be ignored). Finally, as I suggested before, try to "fill" the screen more with the waveform(s) :- the amplitude of the "pulse" shown in #105 is about 50 ADC units! Also, add CH2 and Cursor lines to "mark" levels where things appear to start or stop working correctly, i.e. corresponding to the ADC levels that the software is responding to. It's difficult to explain exactly what to mark, but typically it will be the peak or trough of a waveform, where things start to "go wrong" (or become right).

Cheers, Alan.
 

Garahbara

New Member
Because, I'm afraid more testing is required first. There will be two "limit" situations, one when the capacitor is too small and the ripple from the light causes the program to malfunction (i.e. your original problem) and the second when the capacitor is too large and a train moving quickly is missed. For each of these situations we need to identify the "worst (possible) case", which will probably depend mainly on the light level. Then we can (hopefully) choose an optimum configuration mid-way between these limits, to give reliable operation under all conditions.
Yep. I could leave it as it is, at 10uf 25V, but it won't hurt to do a bit more "fine tuning" as I sugested. 50V caps come in just 4.7uf then jump to 220uf. I can get a good range of 65V at the smaller uf. I cant do the 10uf * 2, (to get 5uf) because I only have 1 of each of the 25V. I ordered a couple of each of the 25V, but they haven't arrived yet. I did venture out further than normal given these COVID days, to the next town down the road, and woe and behold, they have an auto accessories shop with an electronics section. They had a much better range than the local furniture shop, and I got just one of each of the 25V 10uf thru 100uf. That's what I did the testing with. We have strange shops here.

Ultimately, you will need to test the final chosen value(s) on the real track,
That is where I've been testing it. 10uf was fine if there was at least one carraige behind the loco. As I've mentioned previously, the train detection code in the existing signals system is pretty complex. Even under the halogen lights, the LDRs respond pretty quickly, and the gaps between the carriages were giving "fasle positives" (high light levels) to indicate the entire train had gone by, specially on slow moving trains. So I was "pause"ing and testing again, and think I coded 4 in a row of high light levels before confirming the train had completley gone by. Having this "capacitor mechanism" may make that "false positive" code redundant, for the level crossing train detection, if I can get the right balance of fall/rise time of the light levels using an appropriate capacitor. ie. The gaps between carriages won't be long enough for the LDR+cap to rise significanlty before beginning to fall again due to the next carriage.

I did expect to see at least some "ripple" due to the LED flodlights when using the caps, but to see close to none at all, even at 10uf was a great result for your fix. I'm sure 5uf will probably be just about right.

Thanks again for your input. I'm beginning to understand more and more of it now.

Alan

TOOT!
 

AllyCat

Senior Member
Hi,

The series capacitors don't have to be the same value (it just makes the calculations easier). For example 10 uF in series with 22 uF will give about 7 uF (the calculation is similar to resistors in parallel, but that might not help ;) ), so you may be able to extend the test a little.
Well that was a short reply (for me) wasn't it? :)

Cheers, Alan.
 

Garahbara

New Member
The series capacitors don't have to be the same value (it just makes the calculations easier). For example 10 uF in series with 22 uF will give about 7 uF
Mr AlleyCat , Sir.

I now have some more capacitors and tried 2 X 25V 10uf in series (+ to +). It lowered the time constant, but I didn't measure it closely. The "ripple" from the LED floodlight strobe was still negligible. About +- 0.2V. My shortest loco, going flat chat, triggered the Picaxe signal code most of the time, so I'm happy with that. 1 thread and 109 posts later! ๐Ÿ˜ :p

The AXE171 Picaxe-14 audio kits have arrived for the level crossing "ding ding ding ding ding". I'll put my findings and questions about that in another thread.

Again, to all those that contributed. Many thanks. (y)

Alan.

TOOT!
 

premelec

Senior Member
I mentioned 10uF in post 7 and I guess that is close - if you want to make an empirical test unit get 1, 2, 4, 8, uf capacitors and switch them in various parallel combinations for 1 to 15 uf by 1 uF steps - the "switch" can be just a solder blob on a strip board or circuit board... ROOTY TOOTLY
 

Garahbara

New Member
I mentioned 10uF in post 7 and I guess that is close - if you want to make an empirical test unit get 1, 2, 4, 8, uf capacitors and switch them in various parallel combinations for 1 to 15 uf by 1 uF steps - the "switch" can be just a solder blob on a strip board or circuit board... ROOTY TOOTLY
Thanks for the idea. Problem is, I live way up Woop Woop way. You know, way out beyond the Black Stump. Anything I need to get is mail order. The nearest decent "shop" is 4 hours drive away. And beside, I can't get there at the mo, as the Queensland border is shut. Nobody is allowed into Queensland due to Covid-19 stuff. Well, I can go, but they'll lock me up in quaratine for 14 days, at my expense, before they'll let me out.

In the end, I'll need about 30 of the capacitors to do what I want for train detection at signals, level crossings as such. So I'm happy with the 50V 4.7uf solution. It gets a bit costly to go ordering just a capacitor or two each time to test something, and then there's the week or two wait to get them.

All is looking good for what you guys have done, and suggested for me.

Alan.

TOOT!
 

premelec

Senior Member
This tread indicates good success with A3144 Hall magnetic sense units.. https://picaxeforum.co.uk/threads/quick-question-on-pullups.32091/ - Note that in old floppy drives often several of these would be used to regulate the drive motor - lots of old floppy drives to salvage parts from... and you can salvage lots of parts from motherboards & old audio equipment etc... I've been doing it for over 60 years and have hundreds of useable parts. Reuse is a cheap way to go with no delay in delivery and lots of information on how electronic stuff was built ;-0
 

Garahbara

New Member
Ibensen & Allycat,

Well I've order two of the PICAXE - 14 Audio Project kits. from Rev Ed. Two, in case the first one breaks! ๐Ÿ˜ฒ I see what you mean about the shipping. It's more than double for two, but only by 50p. .....................................

........................... That's provided the SPEO35 player doesn't have any noticeable pause/delay in between "loops" of the "loop track" function.:cautious:
Ok guys,
I've now got my TWO Picaxe - 14 Audio Project kits (with the SPE035 audio kit).

A report on it.

First, BOTH kits for the Picaxe board (AXE171) were a couple of resistors short. They had just one of each value. Whereas the kit requires TWO 330 ohm and THREE 10K ohm resistors. It had just ONE of each. Lucky I had plenty of spare from previous projects.

Next, I believe there is a problem/bug in the SPE035 Mini player. Command $08 (repeat play FAT file number) does not work on the LAST file on the SD card. This had me stumped for hours. The LAST file would play no problems (Command $12 or $03). But there was one particular file that would not "loop" Would not play at all on Command $08 (repeat/loop). Repeat/loop would work on EVERY other file. Then added some more files, and the file that didn't work, now did loop/repeat. Then worked it out that it's always the last file in the SD card MP3 folder. ie. file 0001, 0002, 0003, 0004. File 0004 will not repeat/loop. If there was a file 0005, then 0004 WILL loop/repeat, but then file 0005 won't. Added some more files, and yep, the LAST file would not repeat/loop. I did not test it with just ONE file on the SDcard to see if it would loop. (Command $08).

Now for the delay when "looping". MP3s have a longer delay between loops than .wav. Particularly if you need continuity of sound "across" the loop. So use .wav, if you want to loop something like "ding ding ding ding". MP3s have a perceptible gap between each "loop". With some careful editing of the "ding ding ding ding" .wav file I made, the looping is pretty close to imperceptible. and there is no "silence" between the dings, even at the end/start of the loop. So that has worked really well.

No probs programming the picaxe 14M to utilize the SPE035 commands, although Blockly could have a few more options on the "output SPE035" commands.

Next is to get the two servos (for the boom gates) going from the AXE171 board that has two spare "servo" pins on it.

Hope this helps.

Alan

TOOT!
 

Garahbara

New Member
This tread indicates good success with A3144 Hall magnetic sense units.. https://picaxeforum.co.uk/threads/quick-question-on-pullups.32091/ - Note that in old floppy drives often several of these would be used to regulate the drive motor - lots of old floppy drives to salvage parts from... and you can salvage lots of parts from motherboards & old audio equipment etc... I've been doing it for over 60 years and have hundreds of useable parts. Reuse is a cheap way to go with no delay in delivery and lots of information on how electronic stuff was built ;-0
Thanks for the link. An interesting read. My No 1 priority was to have no mods to the locos or rollingstock. Run what I want, in any config I want. And I need to not only detect the front of the train, but also when the train has completley passed by as well. Every solution has it's problems. LDRs under very low light levels, and as I found out, under LED lighting. IR emitters and receivers have problems with ambient stong light, when used in refelctive mode. In "break contact" mode, you've got things poking up beside the track at every detection point. Magnets, you have to modify your locos and rolling stock. The list goes on. There's alway certain conditions where the options you pick will fail under some circumstances.

It's an age old problem for model railroaders. :geek: ๐Ÿš‚๐Ÿš‚๐Ÿš‚

Alan.

TOOT!
 

tmfkam

Senior Member
I've found that the delays on the SPE035 are immensely variable. Encoding rate, file structure, folder structure, file length, file size, number of files, order files were added to the disk, deleted files on the disk, size of the disk... All seem to cause various delays, in unpredictable ways.

Saying all that, there should normally be minimal delay in starting and stopping small files. I've not used the loop commands built into the player module, I've always done that myself. If a "play" command is issued repeatedly while waiting for the busy flag, the file could be starting to play the first few milliseconds (of silence) then on another play command starting from the beginning and playing the same few milliseconds (of silence) again, and again until by chance there is enough of a gap between commands for playback to start and the busy flag be set to "playing" (0). I still think that a short loop of "ding, ding, ding" could work better than a tiny "ding".
 

Garahbara

New Member
I still think that a short loop of "ding, ding, ding" could work better than a tiny "ding".
Thanks for the info.

The loop file I created has 8 "dings" in it. Just a tad over 2.2 seconds. There are just 6 files on the SD card, of same or shorter length (4 dings). There was a noticable differerence (delay between loops) of the same sound (8 dings) saved as MP3 or .WAV. The MP3 had a noticable delay on it's looping. (including a slight "blink" of the blue "busy" LED on the player). Probably not much more the 0.1 at the most 0.2 secs. Maybe even less, but noticeable enough to hear the silent "gap" between loops. Looping the .WAV, the loop gap is not perceptible, and neither is the "blink" between loops of the blue "busy" LED on the player.

Anyway, I'm very happy with what I've acheived. And while the SPE035 player is "looping" it leaves the Picaxe 14M free to do other things, like open and close the gates' servo motors, step by step (pins B1 & B3) to get a realistic gate raising/lowering. Once the gates have opened again, I can just issue a "normal" ($11) or stop ($16) to turn the "dings" off. ๐Ÿ˜ ๐Ÿš‚

The regular alternate flashing of the red LED crossing lights, is another matter. That'll likely have to be on another Picaxe, as the servo code will interfere with any sor of regular/alternating flashing of the red LED timings, besides there ain't enough pins left on the 14 M.
 
Last edited:

tmfkam

Senior Member
I've heard very short .mp3 files being repeated very rapidly on these modules, it was not my code so I can't say how it was done. It was a very short single sound file though. Think of the word "but", then remove the "ut", now you have the "b" sound that was played. This single "b" was then played continuosly a few dozen times.

For my version, I followed my own advice and created a file (using the original single "b" file as the basis) with the maximum number of repetitions I could forsee being needed, play that and stop it when appropriate.
 

Garahbara

New Member
I've heard very short .mp3 files being repeated very rapidly on these modules, it was not my code so I can't say how it was done. It was a very short single sound file though. Think of the word "but", then remove the "ut", now you have the "b" sound that was played. This single "b" was then played continuosly a few dozen times.

For my version, I followed my own advice and created a file (using the original single "b" file as the basis) with the maximum number of repetitions I could forsee being needed, play that and stop it when appropriate.
Sounds good. :)

I've probably got too much time on my hands. I'll keep going and experimenting forever at this rate. Just that little bit more..... Just that little bit better. I've already re-written the code 4 times, cause "ahhhh.... that's a better way of doing it". :geek:

I'm trying to avoid the "ding ding ding ding di........" by just stopping a lengthy sound bite in the middle of it. I'm getting there! The "loop" followed by a "normal" lets the 2 sec bite finish on a complete "ding" Although, I found that in between loops, the player does return a "not busy".

But I'll get there. Eventually. :geek:

Alan.

TOOT!
 

Garahbara

New Member
Hi all,

Just a note that I've now been through all the train signals in the system, and put a 50V 4.7uf electrolytic capacitor across all the LDRs at each signal. All the signals now work just like bought ones. :geek: ๐Ÿ˜ Exactly as they used to, and just as reliable. A fabulous quick and cheap solution to my problem @ 35c per signal. Although an effort to get the solution right.

Many thanks for all that assisted and guided me through this to make sure I got this right. Could not have done it without you.๐Ÿ‘

I now have the confidence that the level crossing with lights and gates, and 12 LDR train detectors is going to work just fine.

TOOT! ๐Ÿš‚๐Ÿš‚

Alan.
 

regpye

New Member
EEEK Same thing, from Australia. What a rip off! 12.99 (UK pounds) is about $24 AUS. And they want $39.95 AUS?
They are now $44.00 in Australia, I just bought one. No information supplied, no paperwork at all.
I now have to try and work out how to assembly the connections and mount it in a case.
Luckily I have a case with probe connections built in that belonged to another scope that didn't work and was given to me.
The only thing I can use is the case and the probes which is handy.
Not sure about the trigger connections, no reference available to speak of in the downloaded documents from Wiltronics.
The website that is printed on the circuit board seems to no longer exist either.
 
Top