rwillett Posted January 29 Author Share Posted January 29 2 minutes ago, SpondonBassed said: Nice nod to Douglas Adams there. Cool. Nice but inaccurate nod to Douglas Adams FTFY 1 Quote Link to comment Share on other sites More sharing options...
SpondonBassed Posted January 29 Share Posted January 29 2 minutes ago, rwillett said: Nice but inaccurate nod to Douglas Adams FTFY I would be a hypocrite if I faulted you for that. I believe Adams was an early adopter of I.T. Quote Link to comment Share on other sites More sharing options...
Richard R Posted January 29 Share Posted January 29 11 minutes ago, SpondonBassed said: I believe Adams was an early adopter of I.T. Indeed he was. He and Stephen Fry used to get all excited over the latest Apple Macintosh releases and rave about them everywhere. Of course they had the income to buy them! 1 Quote Link to comment Share on other sites More sharing options...
rwillett Posted January 29 Author Share Posted January 29 14 minutes ago, Richard R said: Indeed he was. He and Stephen Fry used to get all excited over the latest Apple Macintosh releases and rave about them everywhere. Of course they had the income to buy them! I'd forgotten that about Fry and Adams, they were heavily into IT. As an aside the company I worked for as a sandwich student (do they still exist?), brought something like the 2nd Apple Lisa in the UK when it came out. I worked doing research in formal methods and the dept next door had the Lisa. It was wonderful but I recall that if you dropped the calculator into the wastebin it crashed the OS. Not to be outdone, the dept I worked in brought a few Xero Dolphin workstations and a laser printer. I think they were £25K each at the time and ran Interlisp-D. Thats when I first encountered Lisp and loved it That works out to be around £100K now, so around £400K for three workstations and a printer. Rob Quote Link to comment Share on other sites More sharing options...
rwillett Posted January 29 Author Share Posted January 29 (edited) Santa has arrived with a late delivery. 2 x 500g of 44AWG and 42(ish) AWG. I suppose this means I need to get my act in to gear and get the stepper motors working properly. Edited January 29 by rwillett 4 Quote Link to comment Share on other sites More sharing options...
rwillett Posted February 5 Author Share Posted February 5 No update for a while, work has got in the way of this. I managed to find some time yesterday as t'other half and daughter #1 went to see Lucy Worsley in Kendal talk about Agatha Cristie. I have managed to get the motors to work the way I want them to now. I did rather feel it was a battle of wills between me and the motors and they were winning. Which is sad It does look like one of my stepper motots has been abused ine the past, the only person I can think of is <ahem> me, so some more are on order from Ooznest. However I did seem to get them working with some odd and small stepper motors I found in the a box from some astrophotography project that went nowhere. I ordered some 0.9 and 1.8 degree stepper motors. The 1.8 degree version gives me a 100% speed increase for £10 so thats a bargain. I like bigger motors as I have also found a 24V 4A power supply that will replace the bench PSU I currently use. I have now managed to write the code so: 1. The lead screw goes back and forwards correctly to lay the wire down. I did like that to be honest. It makes it look like its working. 2. Rewrote the LCD code to use a different non-blocking library to display information as its winding. The issue before was that when you write a small tiny update to the LCD, the motors basically stop. I hadn't realised writing to an LCD display was so slow that you can time refreshes with you stopwatch on your iPhone. Rewrote all the sodding code and cut out everything that wasn't needed. Not it still stalls but it's very, very, very small. 3. Started writing the code for the 'home' function. This is the code that moves the winder to the left, hits a limit switch, then moves a certain user defined distance to the right. This certain user defined distance will marry the edge of the wire guides to the bobbin and will be different for each bobbin and so it needs to be flexible. I did have a mad idea of using a laser to line this up and then discarded it as I'd be blind as I cocked it up. I wanted to use the Prusa method checking for stall guard and having a physical limit switch. Stall Guard is only available on expensive stepper motor drivers so back to the drawing board and am using a physical limit switch. This is the mounting plate and this is the limit switch Of course good wiring practise is that you wire it up so the switch breaks connectivity on contact, so that if there is a real break in the wiring it "fails safe", but no, all of the sodding pre made wiring is it makes a positive contact on the switch being closed. So if it breaks, you have no idea. Which moron designs the wiring looms here? So I need to make a JATG to DuPont cable and the only thing worse than wiring JTAG is wiring DuPont connectors. Once this is wired in, I'll write the homing code, mentally written as I walked the dog this morning, but lets see. That should be it and then I can start seeing if it works. Things still to worry about: 1. Wiring tension 2. Wires coming off the main holder and twisting and jamming or breaking. 3. Mains wiring. I hate mains as it can kill me. 4. Speed. 5. It just doesn't work. Rob Rob 4 Quote Link to comment Share on other sites More sharing options...
LowB_FTW Posted February 5 Share Posted February 5 11 hours ago, rwillett said: 3. Mains wiring. I hate mains as it can kill me. I've found through experience (very early in my life) that it's good to be wary of electricity, for exactly the reason you state. Good luck with the build. Mark Quote Link to comment Share on other sites More sharing options...
rwillett Posted February 8 Author Share Posted February 8 I've now managed to get the limit switch working on the winder. The limit switch is used to check when the stepping motor that moves the lead screw is as far left as it is allowed. See the diagram below. Stepper motors have quite a lot of torque and so can easily destroy equipment or themselves if they try to turn and something is stopping them, such as a metal and PETG frame The limit switch was a spare from an older 3d printer and has three connections, a ground, Normally Open (NO) and Normally Closed (NC). This should allow the user to work out the most sensible way to use it. Good practise is that you fail safe, so you actively keep it working and so if a wire breaks or disconnects, its the same as if the switch is closed. Think of it as the deadmans handle on a train, you have to actively keep the throttle lever working, if a driver has a heart attack, the throttle will fail back to zero. So we want Normally Closed, so if a wire breaks, the circuit goes open and its as if the switch has been activated, saving your printer, or other expensive gear from shaking itself to death. The way the Arduino implements this on a CNC shild is 'odd' and I could not understand what it was doing and why. It also turns out that the JTAG to DuPont cable I had was broken, so basically I had no idea what I was doing, couldn't understand the documentation, on a piece of hardware that changed the pinouts, with a cable that I thougth was wired incorrectly anyway and which then turned out to be broken, with a switch that was unclearly marked. In the end I took two long female to female DuPont connectors, wired them directly to the switch and to the Arduino and epoxy resined the connectors into the switch, so nothing was ever going to change and it would work. I have rage quit in the past, I have shouted and cursed at kit and software in the past (Windows 3.1 TCP/IP drivers I'm looking at you, if I ever find the developer who put that pile of utter junk out, they will never walk again), but I have never rage glued equipment together I then went back to the kids who were cowering the corner learning very new words from their father and watched Ghosts Xmas special to wind down. This means that now I *think* I have all the bits done. They aren't necessarily in the right place and they aren't all complete, but I'm now down to stuff I know about (famous last words) and just need to finish the software, assemble the bits and screw things down (actually still waiting for the 1.8 degree stepper motors), and pull apart a pickup to then reassemble it. Target is next weekend to try and do a wind. Away this weekend so thats out. Rob 2 1 Quote Link to comment Share on other sites More sharing options...
choob.squeemer Posted February 8 Share Posted February 8 Finding this both riveting and hilarious by turns - can't wait for the next episode Quote Link to comment Share on other sites More sharing options...
rwillett Posted February 8 Author Share Posted February 8 The next episode is where I discover that what I thought was an 2mm pitch threaded rod is actually an 8mm pitch threaded rod. This means that when I send down 400 steps to the motor, I expected the threaded rod to rotate 360 degrees and to move the winder mechanism 2mm whereas in fact it turned one turn and moved 8mm. As none of my children seem to possess a ruler, I possess digital calibers and do not need rulers, I work digitally and rely on my school age children to provide simple things like rulers, so I guessed how far it was moving until the kids finally found a ruler. As I'm a man, my guesses at distances were perfectly accurate (not). I've just spent two hours looking through Arduino code, trying to understand what I was doing wrong. I've checked motor speeds, distanceToGo(), current settings, aceleration, pulse width settings, written loads of debug code . I must have compiled the stuff 50x trying to find out the problem. I then looked on Amazon and checked what I had brought. This is the diagram I saw Note the words "Screw Spacing: 2mm". Now I thought this meant that one turn means 2mm, it doesn't mean that at all, what I should have looked for was this highlighted below. As I've been working in single steps on the motor, which is too small to see, I never noticed it was all wrong and 4x too much. It was actually one line of code to change a parameter from 2mm to 8mm and it now homes properly. I wonder if I'm actually gone mad and this is all a bad dream Why can't I have have dreams with enormous amounts of alcohol, fabulous food and beautiful women hanging on my every word. Why do I have dreams about debugging things? Off to take the dog for a walk and clear my head. Rob 3 Quote Link to comment Share on other sites More sharing options...
Richard R Posted February 8 Share Posted February 8 So what the heck is "screw spacing"? Quote Link to comment Share on other sites More sharing options...
rwillett Posted February 9 Author Share Posted February 9 Just worked it out. There are four threads on the rod and each thread is 2mm apart. Each thread has a pitch of 8mm but as there are four threads it looks like tighter thread. The brass nut has a internal pitch of 8mm. I suppose the only advantage I can see is that the four threads mean the nut can join in four places at the start, but since that's a one off activity, that can't be it. The solution is to buy an 8mm lead screw with a 2mm pitch. All the other stuff stays the same. Should be relatively easy. Anyone want an 8mm lead screw with an 8mm pitch? Rob Quote Link to comment Share on other sites More sharing options...
sandy_r Posted February 9 Share Posted February 9 (edited) 13 hours ago, rwillett said: Off to take the dog for a walk and clear my head. Hmmm - tricky - that's a TWO dog-walk problem to my fuzzy old brain! The way i see it, it's all about interlaced threads and the thread angle: if there's only 1 thread (helix), then the pitch is equivalent to the screw spacing; If there are 2 interlaced threads (like DNA) then the size of each thread (screw spacing) remains the same, but the threads have to be stretched to interlace and so the angle of the thread doubles - meaning that a 'nut' on the screw would travel twice the distance in one revolution Since you can get lead screws with 1, 2, 3, 4, etc interlaced threads your pitch becomes the screw spacing multiplied by the no. threads I guess the implication of using a multi-thread lead-screw is that you're losing some of the precision in your hard-earned stepper-motor spec (and presumably you need a nut with the same thread angle?) Edited February 9 by sandy_r Quote Link to comment Share on other sites More sharing options...
rwillett Posted February 9 Author Share Posted February 9 I think your explanation is spot on. It's an easy fix, but at the moment I'll keep the threaded rod with an 8mm pitch. Bit annoyed but I'll live. Biggest problem now is that writing even three characters to the lcd at a 1-2 second interval, can sometimes stop the looping motor. No idea why and need to dig in. I'm suspecting a timing issue but the code is so trivial, I can't see why. If I don't update the lcd display, it just works. I have changed the lcd library I use but they all appear to be mostly blocking calls, hence why I suspect a timing issue. 1 1 Quote Link to comment Share on other sites More sharing options...
sandy_r Posted February 9 Share Posted February 9 9 minutes ago, rwillett said: Biggest problem now is that writing even three characters to the lcd at a 1-2 second interval, can sometimes stop the looping motor. No idea why and need to dig in. I'm suspecting a timing issue but the code is so trivial, I can't see why. If I don't update the lcd display, it just works. I have changed the lcd library I use but they all appear to be mostly blocking calls, hence why I suspect a timing issue. Is the software system Interrupt-driven? If not, can it be enabled? ...just an idea Quote Link to comment Share on other sites More sharing options...
choob.squeemer Posted February 9 Share Posted February 9 Shame about the thread - hope the sacrifices in accuracy will still be workable in this precision winding exercise and that the pickups will indeed be repeatable - waiting on baited breath Quote Link to comment Share on other sites More sharing options...
rwillett Posted February 9 Author Share Posted February 9 16 minutes ago, sandy_r said: Is the software system Interrupt-driven? If not, can it be enabled? ...just an idea No it's not interupt driven. The view from Arduino crowd is that interupts are not a good idea on the whole, though there are exceptions. At the start I assumed interrupts would be the way to go, but the recommendation was "no". I do recall TSR programs for DOS and they were a pain so not too worried about not using interupts. Even thing like checking for the limit switch being activated is done through pollng. I think the reason is that the Arduino doesn't have an OS, though there is is RTOS (https://www.arduino.cc/reference/en/libraries/freertos/) which is too big a rabbit hole for me to go down, but is on my backlog. All you have is a call to setup() and a call to loop(), so when you press the reset button or startup, you get setup() called and then the system repeatedly calls loop(). All the main code is in the loop and the key is to keep the loop code down to the minimum, that part is fine. I call the init code for everything in setup() and then I have as little code as possible in loop(). Think of loop() as a ticker. You set the stepper motors up and then make a call to the API to do the work, the Accelstepper library API works out if there is a motor step due and if so does it. The rule is to call the code to checkl and move motors at least one per call to loop (). Making calls to the LCD is exceptionally time sensitive, so the strong recommendations for using the LCD library are: 1. Do not use lcd.clear() under any circumstances, if in doubt write spaces to clear the display. 2. Write non changing parts of the LCD once and then only change the parts of the LCD display that actually change. I'm down to changing just three characters 3. Write the changing parts as infrequently as possible, e.g. don't try and update the display 50x a second as thats pointless. I update the LCD display using a timer about every two seconds and thats just to change three characters. 4. Think about diferent displays that are quicker, some LCD displays take 200ms to update. Thats a fifth of a second. Thats crap. Suspect I may have one. 5. Use a different LCD library that is faster, so I now use https://www.arduino.cc/reference/en/libraries/hd44780/ as opposed to the standard LD library and that made a big difference, but I still get the motor stalling. I am seriously considering a wholly separate Arduino driving the LCD display and using some sort of serial comms to link them together. What puzzles me is that my Prusa printers use similar tech and have no issues updating the LCD and the motors never stall. I'll keep digging. Rob 1 Quote Link to comment Share on other sites More sharing options...
rwillett Posted February 9 Author Share Posted February 9 33 minutes ago, choob.squeemer said: Shame about the thread - hope the sacrifices in accuracy will still be workable in this precision winding exercise and that the pickups will indeed be repeatable - waiting on baited breath I'm not downhearted. This is normal TBH on project development. I can easily replace the 8mm pitch with a 2mm pitch that will just slot straight in. I'm hanging on as the options are: 1. Replace the 8mm with a 2mm one. Cost £10-£20. I'd prefer a ball screw but they are a lot more money but are quieter, smoother and more accurate. 2. Use micro stepping, so I can drive the motor at 1/2, 1/4, 1/8, 1/16 and I believe 1/32 steps. So I add 2-3 jumper and go from 400 steps to 800, 1600, 3200. 6400 and possibly 12800 stepers per 360 degree rotation. So the 8mm pitch is cancelled out by going to 1/4 microsteps which costs a few jumpers on the driver board. Since I've not done it yet, I have no idea of the downsides as there will be some Repeatedability is still key Rob 2 Quote Link to comment Share on other sites More sharing options...
sandy_r Posted February 9 Share Posted February 9 (edited) 1 hour ago, rwillett said: All you have is a call to setup() and a call to loop(), so when you press the reset button or startup, you get setup() called and then the system repeatedly calls loop(). All the main code is in the loop and the key is to keep the loop code down to the minimum, that part is fine. I call the init code for everything in setup() and then I have as little code as possible in loop(). Think of loop() as a ticker. Sorry, my days of wrangling multitasking and pseudo-threaded software is long past, and my use of Arduinos very cursory - my brain only just recognises this as a frequently-met obstacle resulting in much up-rolling of sleeves and grim determination not to be outwitted by some upstart binary digit I would love to get stuck-in to debugging Arduino code ("Is that true, Kepple? - No Sir, it's not", Bernard and the Genie) I have total confidence in your ability to overcome this current and temporary setback - we are all rooting for you (...i say that in a totally non Unix context 😉) Edited February 9 by sandy_r 1 Quote Link to comment Share on other sites More sharing options...
rwillett Posted February 9 Author Share Posted February 9 My background is Unix, started with very early version of stuff on Vax 11/750's and 11/780's. We used to get 1" (?) tape from Bell Labs, I recall a certain Mr Kernighan sending stuff to us on occassion. My final year thesis was on Lisp and garbage collection and was done on a 64KB (yep 64KB) UNIX box from Motorola with a M68000 processor (might have been a variant as I suspect it had paging built in). Long time ago though,. The Arduino's are quite simple in some respects, limited memory 256KB, only 16Mhz CPU, lots of bit banging to get keyboards and LCD's working as keyboards and displays are very optional extras. I'm having to recall stuff from a long time ago as I'm writing the code, but working in limited ram space is not too bad, at least once the LCD display is connected I can get something out and be seen, the Arduino IDE has a serial IO system, so I can write debugging back. I can remember writing kernel code and using a single led on a control panel to check things were working and building things up from there. The other problem I have is that the guitar winder is downstairs as my office desk is full so I can only work on stuff in the evening. It also requires a dedicated Macbook for the IDE. Glad you have confidence in me. I don;t Rob 1 Quote Link to comment Share on other sites More sharing options...
SamIAm Posted February 9 Share Posted February 9 6 minutes ago, rwillett said: My background is Unix, started with very early version of stuff on Vax 11/750's and 11/780's. We used to get 1" (?) tape from Bell Labs, I recall a certain Mr Kernighan sending stuff to us on occassion. My final year thesis was on Lisp and garbage collection and was done on a 64KB (yep 64KB) UNIX box from Motorola with a M68000 processor (might have been a variant as I suspect it had paging built in). Long time ago though,. The Arduino's are quite simple in some respects, limited memory 256KB, only 16Mhz CPU, lots of bit banging to get keyboards and LCD's working as keyboards and displays are very optional extras. I'm having to recall stuff from a long time ago as I'm writing the code, but working in limited ram space is not too bad, at least once the LCD display is connected I can get something out and be seen, the Arduino IDE has a serial IO system, so I can write debugging back. I can remember writing kernel code and using a single led on a control panel to check things were working and building things up from there. The other problem I have is that the guitar winder is downstairs as my office desk is full so I can only work on stuff in the evening. It also requires a dedicated Macbook for the IDE. Glad you have confidence in me. I don;t Rob A real old school IT geek ... me too! I can remember using punched paper tape to store/upload programs LOVE it! Sam x Quote Link to comment Share on other sites More sharing options...
sandy_r Posted February 9 Share Posted February 9 4 minutes ago, rwillett said: Glad you have confidence in me. I don;t You have the Right Stuff, Mr Willett - to paraphrase someone else: "The Dude will prevail !" Quote Link to comment Share on other sites More sharing options...
rwillett Posted February 9 Author Share Posted February 9 32 minutes ago, SamIAm said: A real old school IT geek ... me too! I can remember using punched paper tape to store/upload programs LOVE it! Sam x I have never used punch cards or tape. Well that's not strictly true, they did get used on a Friday night when around 2cm x 2cm squares were ripped out, rolled up and Mr Rizla helped out. The year ahead of me used punch cards, but we moved to micro's and CP/M, I'm reasonably certain I have never directly programmed a main frame apart from writing six Cobol programmes in my second year. All UNIX, networking, Lisp and interesting stuff. Odd how I've moved from multi GB UNIX systems back to 256KB, a 4x4 keyboard and directly programming pins. Rob 1 Quote Link to comment Share on other sites More sharing options...
nekomatic Posted February 9 Share Posted February 9 Arduino-compatibles are cheap, aren't they? Get a second one, have the first one shoot the data you want displayed to the second one over a serial connection or something which will take a millisecond, let the second one write it to the LCD in its own sweet time. Maybe there's a neater way of doing it with interrupts, or with the second core on a Pi Pico or something (I dunno, I never got into Arduino as it looked too much like C) but you can save that for the second revision! Quote Link to comment Share on other sites More sharing options...
rwillett Posted February 9 Author Share Posted February 9 @nekomatic Sitting on my desk as I speak are: 1 x Raspberry Pi 3, 1 x Raspberry Pi 5 1 x Leonardo Uno (Arduino) 1 x Uno (No name) but it's a nice shade of blue 1 x Keystone 16x2 LCD display with 5 press buttons 1 x CNC Shield V3 3 x DRV 8226 stepper drivers 1 x Freenove Smart Car Shield for Raspberry Pi 1 x Keystudio Motor driver board 1 x WiFi proxy gateway for FIL to get streaming services from our IP address. I know I have a few more Uno's and Pis somewhere as they came with something but got put in a box. Equipment I have, time to write a comms protocol to exchange information to drive a separate LCD display on a different Arduino, not so much. 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.