Jump to content
 

andysollis1

Members
  • Posts

    54
  • Joined

  • Last visited

Everything posted by andysollis1

  1. thanks. I kept puzzling over the original Sketch and couldn’t find what was missing. I did a google for something similar and tried it and it worked. it was more a case for me of knowing what command I needed, but knowing what the specific wording was that i needed. I’m hoping to go an fit it soon, but Nottinghamshire has now had its amber light re covid, so not sure I can go to my Dads... although, the layout is in the shed in the garden, so I may be able to get away with it. I’ll keep you informed on progress. thanks again Ray, your topic has been a great inspiration - I’m still reading the earlier posts and only on page 11!!! Andy
  2. Well, after a quick google for a similar issue, I have found the one line I was missing... simple really! stepper.setCurrentPosition(0); doh! ok, so next move is to transfer from the dummy set up Solder the wires for the preset switch box and move it to the Peco turn table. once done I can then adjust my figures to match the entry:exit points on the turntable. thanks to Ray for his help earlier in the week. I’ll post a video soon! andy
  3. Ah! At last - Little bit of fudging Ive got the code to check for the sensor and back up. Yae!!! But, its not resetting the zero, So I guess I'm still missing something on the Input_Pullup entry ? as I cant see it does anything further. Here is the working code that does everything but the reset now... Any suggestions ? I'm actually quite pleased now. Hopefully I can post a video soon. Andy /* Example sketch to control a 28BYJ-48 stepper motor with ULN2003 driver board, AccelStepper and Arduino UNO: acceleration and deceleration. More info: https://www.makerguides.com */ // Include the AccelStepper library: #include <AccelStepper.h> #include <Wire.h> // Motor pin definitions: #define motorPin1 8 // IN1 on the ULN2003 driver #define motorPin2 9 // IN2 on the ULN2003 driver #define motorPin3 10 // IN3 on the ULN2003 driver #define motorPin4 11 // IN4 on the ULN2003 driver // Define the AccelStepper interface type; 4 wire motor in half step mode: #define MotorInterfaceType 8 // Initialize with pin sequence IN1-IN3-IN2-IN4 for using the AccelStepper library with 28BYJ-48 stepper motor: AccelStepper stepper = AccelStepper(MotorInterfaceType, motorPin1, motorPin3, motorPin2, motorPin4); int Pin07Read ; // step Road 1 (head) int Pin06Read ; // step Road 2 (head) int Pin05Read ; // step Road 3 (head) int Pin04Read ; // step Road 1 (tail) int Pin03Read ; // step Road 2 (tail) int Pin02Read ; // step Road 3 (tail) void setup() { digitalWrite(7, HIGH); digitalWrite(6, HIGH); digitalWrite(5, HIGH); digitalWrite(4, HIGH); digitalWrite(3, HIGH); digitalWrite(2, HIGH); // Set the maximum steps per second: stepper.setMaxSpeed(300); // Set the maximum acceleration in steps per second^2: stepper.setAcceleration(15); //configure pin13 as an input and enable the internal pull-up resistor pinMode(13, INPUT_PULLUP); //read the sensor (open collector type) value into a variable int sensorVal = digitalRead(13); // if near reference point move away sensorVal = digitalRead(13); while (sensorVal == HIGH) { sensorVal = digitalRead(13); stepper.moveTo(stepper.currentPosition()+10); stepper.runSpeedToPosition(); delay(50); } // step forward to sensor index point while (sensorVal == LOW) { sensorVal = digitalRead(13); stepper.moveTo(stepper.currentPosition()-10); stepper.runSpeedToPosition(); delay(50);} } void loop() { // run to position with set acceleration stepper.runToPosition(); Pin07Read = digitalRead(7) ; Pin06Read = digitalRead(6) ; Pin05Read = digitalRead(5) ; Pin04Read = digitalRead(4) ; Pin03Read = digitalRead(3) ; Pin02Read = digitalRead(2) ; // check which button is being pressed - chooses which road is set if (Pin07Read == LOW) { stepper.moveTo(-200); } else if (Pin06Read == LOW) { stepper.moveTo(0); } else if (Pin05Read == LOW) { stepper.moveTo(200); } else if (Pin04Read == LOW) { stepper.moveTo(800); } else if (Pin03Read == LOW) { stepper.moveTo(1600); } else if (Pin02Read == LOW) { stepper.moveTo(2000); } else { digitalWrite(8,LOW); digitalWrite(9,LOW); digitalWrite(10,LOW); digitalWrite(11,LOW);; } }
  4. Hello Ray, I am in debt for your time and help, but alas, it still doesn’t do anything. Now it sits until I trigger the sensor with the magnet and it flashes the sheild to say it’s moving once and stops. I am (always have been) at a loss how to make it increment by one step. I thought you had got it with the +1 in brackets but sadly, it doesn’t want to budge. Have I maybe got something in the wrong order? I even removed the code at the end that turns off the stepper sheild with no joy? andy
  5. Well, I've finally got no errors and got it on to the Uno. Didn't need stepper.h library as using the accelerator one. But.. It only turns one way and stops, regardless of if I trip the sensor, it doesn't go the other way. it simply runs to the end. The "L" light goes out on the Uno board. Am I missing some more code re the "Input_pullup"? so it still doesn't know the location of Zero ? The push buttons don't work until I trip the sensor with the magnet. Andy /* Example sketch to control a 28BYJ-48 stepper motor with ULN2003 driver board, AccelStepper and Arduino UNO: acceleration and deceleration. More info: https://www.makerguides.com */ // Include the AccelStepper library: #include <AccelStepper.h> // Motor pin definitions: #define motorPin1 8 // IN1 on the ULN2003 driver #define motorPin2 9 // IN2 on the ULN2003 driver #define motorPin3 10 // IN3 on the ULN2003 driver #define motorPin4 11 // IN4 on the ULN2003 driver // Define the AccelStepper interface type; 4 wire motor in half step mode: #define MotorInterfaceType 8 // Initialize with pin sequence IN1-IN3-IN2-IN4 for using the AccelStepper library with 28BYJ-48 stepper motor: AccelStepper stepper = AccelStepper(MotorInterfaceType, motorPin1, motorPin3, motorPin2, motorPin4); int Pin07Read ; // step Road 1 (head) int Pin06Read ; // step Road 2 (head) int Pin05Read ; // step Road 3 (head) int Pin04Read ; // step Road 1 (tail) int Pin03Read ; // step Road 2 (tail) int Pin02Read ; // step Road 3 (tail) void setup() { digitalWrite(7, HIGH); digitalWrite(6, HIGH); digitalWrite(5, HIGH); digitalWrite(4, HIGH); digitalWrite(3, HIGH); digitalWrite(2, HIGH); // Set the maximum steps per second: stepper.setMaxSpeed(300); // Set the maximum acceleration in steps per second^2: stepper.setAcceleration(15); //configure pin3 as an input and enable the internal pull-up resistor pinMode(13, INPUT_PULLUP); //read the sensor (open collector type) value into a variable int sensorVal = digitalRead(13); // if near reference point move away sensorVal = digitalRead(13); while (sensorVal == LOW) { sensorVal = digitalRead(13); stepper.moveTo(3400); delay(50); } // step forward to sensor index point while (sensorVal == HIGH) { sensorVal = digitalRead(13); stepper.moveTo(-3400); delay(50);} } void loop() { // run to position with set acceleration stepper.runToPosition(); Pin07Read = digitalRead(7) ; Pin06Read = digitalRead(6) ; Pin05Read = digitalRead(5) ; Pin04Read = digitalRead(4) ; Pin03Read = digitalRead(3) ; Pin02Read = digitalRead(2) ; // check which button is being pressed - chooses which road is set if (Pin07Read == LOW) { stepper.moveTo(-200); } else if (Pin06Read == LOW) { stepper.moveTo(0); } else if (Pin05Read == LOW) { stepper.moveTo(200); } else if (Pin04Read == LOW) { stepper.moveTo(2000); } else if (Pin03Read == LOW) { stepper.moveTo(1600); } else if (Pin02Read == LOW) { stepper.moveTo(800); } else { digitalWrite(8,LOW); digitalWrite(9,LOW); digitalWrite(10,LOW); digitalWrite(11,LOW);; } }
  6. OK, So I have the following Sketch , but I'm getting error messages.. (see below) /* Example sketch to control a 28BYJ-48 stepper motor with ULN2003 driver board, AccelStepper and Arduino UNO: acceleration and deceleration. More info: https://www.makerguides.com */ // Include the AccelStepper library: #include <AccelStepper.h> // Motor pin definitions: #define motorPin1 8 // IN1 on the ULN2003 driver #define motorPin2 9 // IN2 on the ULN2003 driver #define motorPin3 10 // IN3 on the ULN2003 driver #define motorPin4 11 // IN4 on the ULN2003 driver // Define the AccelStepper interface type; 4 wire motor in half step mode: #define MotorInterfaceType 8 // Initialize with pin sequence IN1-IN3-IN2-IN4 for using the AccelStepper library with 28BYJ-48 stepper motor: AccelStepper stepper = AccelStepper(MotorInterfaceType, motorPin1, motorPin3, motorPin2, motorPin4); int Pin07Read ; // step Road 1 (head) int Pin06Read ; // step Road 2 (head) int Pin05Read ; // step Road 3 (head) int Pin04Read ; // step Road 1 (tail) int Pin03Read ; // step Road 2 (tail) int Pin02Read ; // step Road 3 (tail) void setup() { digitalWrite(7, HIGH); digitalWrite(6, HIGH); digitalWrite(5, HIGH); digitalWrite(4, HIGH); digitalWrite(3, HIGH); digitalWrite(2, HIGH); // Set the maximum steps per second: stepper.setMaxSpeed(300); // Set the maximum acceleration in steps per second^2: stepper.setAcceleration(15); //configure pin3 as an input and enable the internal pull-up resistor pinMode(13, INPUT_PULLUP); //read the sensor (open collector type) value into a variable int sensorVal = digitalRead(13); // if near reference point move away sensorVal = digitalRead(13); while (sensorVal == LOW) { sensorVal = digitalRead(13); forwardstep2(); delay(50); } // step forward to sensor index point while (sensorVal == HIGH) { sensorVal = digitalRead(3); forwardstep2(); delay(50); } void loop() { // run to position with set acceleration stepper.runToPosition(); Pin07Read = digitalRead(7) ; Pin06Read = digitalRead(6) ; Pin05Read = digitalRead(5) ; Pin04Read = digitalRead(4) ; Pin03Read = digitalRead(3) ; Pin02Read = digitalRead(2) ; // check which button is being pressed - chooses which road is set if (Pin07Read == LOW) { stepper.moveTo(-200); } else if (Pin06Read == LOW) { stepper.moveTo(0); } else if (Pin05Read == LOW) { stepper.moveTo(200); } else if (Pin04Read == LOW) { stepper.moveTo(2000); } else if (Pin03Read == LOW) { stepper.moveTo(1600); } else if (Pin02Read == LOW) { stepper.moveTo(800); } else { digitalWrite(8,LOW); digitalWrite(9,LOW); digitalWrite(10,LOW); digitalWrite(11,LOW);; } } I'm getting the below error messages.. Any help is welcome and this is my last (apparent hurdle) ??help ? I'm sure the { } issue is simple, but im not sure where the "forwardstep2" bit is wrong or how to enable ? and whats the multiple libraries ? its never thrown this up before.. I'm really not seeing the wood for the trees. Andy
  7. Ok possible daft question alert! which one is pos and which is Neg? It’s like going to Rimmer Bros for the Triumph spitfire spares.. never have instructions and just expect you to know what your doing...? ok, ignore last.. quick google turned up what I need, but just incase the next person is at my level of knowledge, here is a link.. https://components101.com/a3144-hall-effect-sensor
  8. Hi Ray, many thanks... the Hall effect detectors arrived this morning so off to test. Ive changed to digital pin 13? I’m already using the 3digital (and this is still new to me and working my way through understanding some code) I was trying to get the screen to read back the steps last night but it either read 0 or just counted on it’s own? it doesn’t know what forwardstep2(); is... is this related to the Ada fruit? Which I’m not using?
  9. I wish I could, unfortunately the program wants to look in iCloud, which I don’t use so could only copy and paste. Can’t log in off my computer as forgot my password.
  10. Now, I said I’d be back.. I can’t find how I paste the code/sketch in on my phone... so I apologise that it’s text below.. what I would like help with is what lines I need to add in for the hall detector and likely where is best to plug it in? (Pin numbers) so it does the zero check at power up.. so far, I’m running..... /* Example sketch to control a 28BYJ-48 stepper motor with ULN2003 driver board, AccelStepper and Arduino UNO: acceleration and deceleration. Modified A.Sollis Oct 2020 // Include the AccelStepper library: #include <AccelStepper.h> // Motor pin definitions: #define motorPin1 8 // IN1 on the ULN2003 driver #define motorPin2 9 // IN2 on the ULN2003 driver #define motorPin3 10 // IN3 on the ULN2003 driver #define motorPin4 11 // IN4 on the ULN2003 driver // Define the AccelStepper interface type; 4 wire motor in half step mode: #define MotorInterfaceType 8 // Initialize with pin sequence IN1-IN3-IN2-IN4 for using the AccelStepper library with 28BYJ-48 stepper motor: AccelStepper stepper = AccelStepper(MotorInterfaceType, motorPin1, motorPin3, motorPin2, motorPin4); int Pin07Read ; // step Road 1 (head) int Pin06Read ; // step Road 2 (head) int Pin05Read ; // step Road 3 (head) int Pin04Read ; // step Road 1 (tail) int Pin03Read ; // step Road 2 (tail) int Pin02Read ; // step Road 3 (tail) void setup() { digitalWrite(7, HIGH); digitalWrite(6, HIGH); digitalWrite(5, HIGH); digitalWrite(4, HIGH); digitalWrite(3, HIGH); digitalWrite(2, HIGH); // Set the maximum steps per second: stepper.setMaxSpeed(300); // Set the maximum acceleration in steps per second^2: stepper.setAcceleration(15); } void loop() { // run to position with set acceleration stepper.runToPosition(); Pin07Read = digitalRead(7) ; Pin06Read = digitalRead(6) ; Pin05Read = digitalRead(5) ; Pin04Read = digitalRead(4) ; Pin03Read = digitalRead(3) ; Pin02Read = digitalRead(2) ; // check which button is being activated- move to that position. if (Pin07Read == LOW) { stepper.moveTo(-200); } else if (Pin06Read == LOW) { stepper.moveTo(0); } else if (Pin05Read == LOW) { stepper.moveTo(200); } else if (Pin04Read == LOW) { stepper.moveTo(2000); } else if (Pin03Read == LOW) { stepper.moveTo(1600); } else if (Pin02Read == LOW) { stepper.moveTo(800); } else { digitalWrite(8,LOW); digitalWrite(9,LOW); digitalWrite(10,LOW); digitalWrite(11,LOW);; } } I hope someone here can point me in the right direction to complete the project. andy
  11. Thanks! I’ll be back in a few days when they arrive with the magnets and I’ve set it up.. I suspect I may have to do some adjusting of my sketch which I’ll post at a later time. I will need to add this check section in at the fore, but I’m using a different motor and sheild, so need to work out what’s relevant and what won’t work.
  12. Oh.. um.. so which would be better? The liner or the digital? I would have automatically thought doing what we’re doing with the Arduino that I’d want Digital? and looking at that, I see one vast difference. No coloured wires.. (that’s not a problem! ) but which was which unless I’ve missed that in the description? (Ignore that, just checked again and found that the links are the opposite way to which you wrote them down... best get my order in!! :-) )
  13. I’m a latecomer to this, but using the arduino and Peco turn table deck. id been having some issues with the control, but thanks to reading on here I now have it sorted. I’ve opted for push button location, but I’ve also decided to add the reset location at the start.. went to look for the Hall effect sensor, only RS do it and it’s now £14.50! now if I need to, I will buy one of those, but wondered if anyone had used anything less expensive ? Same thing different brand etc? andy
  14. andysollis1

    Dapol 08

    Is it worth seeing if anything can be posted in a magazine to see if they respond then?
  15. andysollis1

    Dapol 08

    You appear to be missing 2 grills on the side? Is that correct? (I saw a post on another forum of someone else who had received their loco like that too) I would see if it can be sent back under a warranty?
  16. andysollis1

    Dapol 08

    How do they work? Is it just different functions? Surely you need around 9 functions (inc cab light?) as you would need white on all 4 lamps and red on all four lamps? I’m interested to find out more.
  17. andysollis1

    Dapol 08

    Ah, my error, misunderstood. I thought you meant by later models from Dapol, never thought you meant the later models of the real thing. Oops!
  18. andysollis1

    Dapol 08

    How have you got the two colours in one lamp? Is it specific to this loco or have they been replaced/required with bi-colour? look really impressive and that’s my only bug bear with my green one that I can’t change the side which the red and white appear as per the prototype. andy
  19. andysollis1

    Dapol 08

    Yes, I’ve done the D3002 in Green with sound. Only the centre lower lights don’t function, but I’m lead to believe that there is no LED fitted.
  20. andysollis1

    Dapol 08

    So I’ve spent the last 2 weeks in between calls reading the last 75 pages of this article... apart from the mentioned missing items of lifting bolts, guard irons and wipers (which now come in the pack with the green D3002 model) has no one detailed the internals of the cab other than with a driver? It seems very sparse? It may be correct for an early loco? although I’ve noted from reading this thread that the Bonnet handles shouldn’t be present on D3002, my ladders have not disintegrated and I’m very pleased with it with the sound decoder installed. Managed to adjust some of the Locsound settings to get the lights to work how I want them on the spare functions. Just wish the traction motors sounded a little more. (I have the DCKITS setup)! the only thing I’m suprised about is that all the windows are shown closed? When did you ever see an 08 with the windows closed?
  21. Hi Dave, sorry don’t get email notes at work that you had posted. Just replied to your PM, but all the tops (with and without doors, single and double versions) are all available in N and OO on the Northern Bridge 3D models shop at Shapeways. https://www.shapeways.com/shops/NB3DM andy
  22. We’ve been running one of these (the handheld controller and WiFi adapter) for the last 4-5 months... first issue... you only have one socket... so it’s either handheld controller... or the WiFi. Not both... so so I spent a few quid on eBay and bought a simple cat5 network splitter for about £5 which turns one plug in to 3 so you can run the hand held and WiFi adapter side by side... its been running well well using WiThrottle... until today.. ive been extending our layout outside by around about 10 yards. (Surprisingly we have noted only about 1v drop at the farthest point) and whilst testing ran the Hornby railroad Tornado that we have fitted with a Hornby sound decoder.... it’s worked fine the last couple of weeks but then none of the functions would latch on the WiThrottle (but would on the hand controller) then it would suddenly not respond to the throttle leaving the loco running away on its own. The only way to regain control was to switch off the WiFi on the phone and reconnect and then return to wiThrottle. Anyone else had any similar issues? Just trying to fathom if it’s a Gaugemaster WiFi issue, the Hornby decoder or WiThrottle.? all other locos functioned correctly, but.... they also lost control. Thoughts?
  23. Btw, have a look at www.shapeways.com/shops/nb3dm there may be some models there you find of interest.
  24. Leek is progressing slowly in the background. Track plans and signalling are being drawn up (hopefully seeing yet another NSR signal box returning to use with the commissioning of Leek Brook Junction) although it’s expected to be in small stages, the first I believe will be to the birchill tunnel. There is still work to be done by other agencies such as the Severn Trent pipe line running down the track bed, which may need to be moved. Then it be the loops at the limit and finally the station to follow at a later time as funds permit - sadly it won’t be like the GWR who can afford to build the station before a train or track reach their new terminus. hopefully once Leek is reached we may be looking to extend again on Cauldon and back to Oakamoor replacing the worn tracks that had been lifted to help pay for other projects.
×
×
  • Create New...