Problem :- Model steam locomotives do not have a speedometer, however track constraints often create speed restrictions so we need to know how fast we are going. Current method is guessing!
Solution :- Use a picaxe to create a speedometer. This is only a concept proving at the moment as I have yet to build my locomotive. The BIG problem with picaxe is the integer only math, while the speedometer does not have to be perfectly correct it should be a real indication of speed. My solution is as follows
Wheel tyre diameter 75mm, therefore 235.619mm circumference. To travel 1km the wheel must make 4244.1318 revolutions. So that means at 1km/h we are doing 1.1789 revs/second which is 1 rev every 0.8482 seconds.
If we use the count command with the interval set to 848ms then every count represents exactly the number of km/h. This gives us a relatively accurate speed using integer only math and results.
A second problem that has also been catered for is knowing the amount of water in the water tank in the riding car, which is situated behind the driver. By using a resistor chain in the water we can monitor the water level using adc. This is shown on the 2nd line of the LCD. Once the water is only 1/8 full or less then a LED is also flashed - steam engines without water are called an expensive breakdown :)
All equipment was in my electronics box already but mainly cosists of a picaxe 08M and a serial LCD module. with a couple of LEDS (power and low water).
A tip that you may or may not know: You can work with floaing point maths in Picaxe, when your numbers are not too large. Use word variables and simply work with 10 times, 100 times, 1000 times, or … depending on how many digits you need.
Forget the “.” through the proces, so that instead of 3.47, you let it be 347.
If you want a resolution of 3 digits, instead of 1, let it be 1000 in your variable
If you want to devide it with 6.94, and continue working with it, just devide it with 694
If you want to devide your variable with 6.94, but have the result out to something where integers only can be used just do it like this:
X = X * 100 / 694
You will just have to decide how high a resolution that you want to work with, and then fil in, instead of using point. My approach is usually to work with rough integers first, and then if needd refine the code, by adding * and / 's to get a higher resolution. That way I can make sure I got it all right
Yep, I knew that but working in millimetres and kilometres, even if both expressed in metres is just too large for even word variables!
This way I did all of the hard work in the theory side of things giving a direct integer from the count command in a 1 to 1 relationship. Most of the code is actually in formatting the display!
The only thing I would have liked to have done is to have used a solid rectangle for the tank display rather than ~. However there seems to be no option of programming your own characters in the AXE033 serial display that I could find in the instruction and it is not an available character.
Now all I have to do is find something for the other input/output to do.
The reason I got the lathe was initially to make it easier to adapt wheels to motors but then I got interested in the live steam thing.
Well it has been a long time coming but I have finally got back onto this project.
Main thing holding me back was finishing the riding car
The final coice for the hall effect sensor was a UGN3503. There are two high gauss, small magnets to be mounted on one of the axles, via a collar attachment, this will mean it is easy to remove to another carriage if required. The timing has been reduced to 424ms due to the use of two magnets (two pulses/rev)
The pulse is then level shifted and amplified by a LM358 op amp before being fed in to the Picaxe. Schematic attached
I am now awaiting the delivery of a pressure sensor (MPXV5010) to do the water levels. As I read the datasheet for this device I will need to use the other 1/2 of the Op Amp to amplify the analogue signal to suit the picaxe.
Thanks to Fritsl I now have th solid rectangle for my water meter.