Help making a calculation pixaxe circuit

Arcantium

New Member
Hey Everyone!

I need some help on how to go about making a PICAXE circuit that will calculate for me.

My Current circuit is this:


Currently, as a car breaks the infrared beam, it turns a corresponding LED on.

I want to remove the LEDs and have the circuit feed into a PICAXE chip/circuit, then calculate the acceleration of my cars.

I have a switch that will control the start time, so if you can tell me where to put that it would be good.

If you need any more info plz reply.

Thanks in advance!
 

westaust55

Moderator
making a calculation pixaxe circuit

Welcome to the PICAXE forum.

As a starting point can you explain exactly what PICAXE experience you have to date?

The circuit appears to be a copy straight from another website.

What is the time frame you are looking for at each detector?

The PICAXE pulsin command can detect pulses to a resolution of 10us - use a start signal into some form of flip flip and the position detect to stop the pulse. The maximum duration for the pulsin command is 0.65 seconds
 
Last edited:

Andrew Cowan

Senior Member
What are the cars?
Calssic cars?
Sorts cars?
R/C cars?

What is the distance between the sensors?
Milimeters?
200 metres?

We need to know how sensitive/responsive it should be.

A
 

hippy

Ex-Staff (retired)
From the diagrams which look like rail tracks between LED and photo-transistor I'd guess railway cars.

The comparator outputs can feed directly into PICAXE inputs via 22K resistors.

Whether that is enough to do the calculations I don't know; we need more information. How close are the sensors, will only one output ( LED ) be on at a time or can multiple outputs be on at the same time ? For how long ? How is acceleration to be determined ?
 

Rickharris

Senior Member
The circuit comes from here http://home.cogeco.ca/~rpaisley4/PhotoDetectors.html and is being used there to detect the position of trains on a rail road track.

Polishing my crystal ball here I bet this users wants to measure the speed or lap times of a slot car track rather than the acceleration of railway trains (which seems a bit unusual)


Lap counting I don't see much of a problem, Speed might be depending of the distance apart the sensors are as slot cars can do 10 15 MPH on a reasonable length of straight track.

James May tried to beat the land speed record of 458 MPH at a scale size with scaletrix cars 458/32=14.3 MPH
 

moxhamj

New Member
Yes, you can remove the leds and feed straight into a picaxe: http://www.national.com/mpf/LM/LM339.html

The 3k resistor would be a more standard value, eg 2.7k or 3.3k.

The resistor is needed to pull the output high. The 339 is a bit unique in this respect, as it pulls the outputs low but doesn't output a high as such. Different to an op amp for instance. So - just leave out the led and led resistor, put in a 2.7k pullup resistor and feed it into a picaxe. Run both the 339 and picaxe off 5V.
 

hippy

Ex-Staff (retired)
Good idea checking the datasheet; I hadn't realised it was open collector.

That makes it a bit more complicated because you need a pull-up suitable for use with the PICAXE ( the LED+R probably has too much Vled at 5V to guarantee a high signal ).

The 22K was to current limit the 12V. Just dropping the LM339 voltage to 5V could have problems with the opto's etc on 12V.

It would probably make sense to make the opto's and everything which follows 5V, and more sense to lose the LM339 and just feed the opto's to the PICAXE.
 

Arcantium

New Member
Thanks for the info and help so far everyone.

The Cars are small cars similar to slot cars, and they race down a 20m track.

They are powered by CO2 canisters so they are fairly powerful, and they travel down the track in approximately 1 second.

I want the circuit to feed into a picaxe circuit.

i will use this calculation in the PICAXE chip
 

moxhamj

New Member
Re "Good idea checking the datasheet; I hadn't realised it was open collector."

I only know that because I found it out the hard way when I was a kid. Circuit wouldn't work. Back then, it wasn't a matter of Googling the data sheet. I had to catch the bus into town, go into the library, find the relevant book etc. It took a whole morning, so I'll never forget the 339 is different. My kids don't believe me when I tell them these stories. They are still a bit dubious about my claims that there once was a time when computers didn't exist.

Re the CO2, yes you will have some fast accellerations there. Pulsin would be fast enough but you may only be able to do one pulsin, as the time taken to run the next one would upset the calculation. (about 1ms per instruction on a picaxe). So you might need one picaxe to do a pulsin from sensor 1 to 2, a second picaxe from sensor 2 to 3 etc, and then look at the readings afterwards.
 
Last edited:

Arcantium

New Member
Thanks for the speedy reply!

It sounds good. Would I perhaps be able to have 1 picaxe doing a pulsin on each of the 339s, and having each of them feed into ANOTHER picaxe, that will process the times for all of them?
 

moxhamj

New Member
That would work. Maybe build it in stages - get just two sensors working and one picaxe. Then grow it from there.
 

Arcantium

New Member
Cool. Is anyone able to help me design this? I dont know where to start as ive never added PICAXE into another circuit before? Perhaps a very basic tutorial would be best.
 

Arcantium

New Member
*bump*

If anyone could help me with designing the circuit it would be of great help!

Im relatively new to adding picaxe into an existing circuit.
 

Dippy

Moderator
Haven't the minor mods required to connect to a PICAXE been given to you on the previous page?

Why not, as suggested, start with a single sensor+op-amp and see how you get on.

I don't know how fast these things go or the distance between sensors.
Without that info I cannot say whether PICAXE is fast enough, but I would have thought so.
With an array of sensors I would do all the measurements first and then process the data.

I'm sure a kind soul will design it all for you...
 
Top