New to STM32 and projects on it

davemorl
Wed Sep 06, 2017 5:25 pm
Hi all,

This is my first post on here so firstly I would like to say a hello to everyone.

I have some questions about stm32 and arduino.

I am building a pipe bender at the moment with a 3 phase motor and gearing which is almost complete. I am planning once it is complete attaching an 600p/r incremental encoder to the main bending shaft via a gt2 pulley at a 1:1 ratio and making the bender CNC as such.

My question is as I only have very basic knowledge in arduino and I will be learning a lot doing this most likely would trying to learn stm32 at the same time be a big jump and learing curve? I plan on having an LCD display with buttons to increase and decrease the angle needed, a back to zero degree button, stop button, jog forward and back, also a zero current angle button. On the LCD will display current angle and the adjustable desired angle. The 3 phase ac motor will be controlled by 6 relays from the IO pins to enable reverse and forward on the motor.

I have no experience with encoders or LCD’s as of yet. But have been reading up on them and dont seem to difficult.

Oh and the encoder will only be rotating at approx 1rpm so the pulses from the encoder wont be that fast.

I look forward to your replies.

Dave


martinayotte
Wed Sep 06, 2017 6:29 pm
If the gearing ratio is high, maybe placing the encoder/sensor on motor side would be easier.
And it will provide a better accuracy …

davemorl
Wed Sep 06, 2017 6:37 pm
Hey!

Thanks for the input. :)

I don’t think it needs to be that accurate like a servo. As long as it’s within half a degree that will be adequate. Plus with all the gearing and backlash it wouldn’t be very accurate i wouldn’t imagine. Also the motor isn’t braked so it would complicate things I’d imagine with switching off the motor in time for it to stop at the right angle. I’m assuming that when the desired angle is reached the relays will trip and the motor will only move it a small amount more with it being around 1500:1 ratio.

Dave


zmemw16
Wed Sep 06, 2017 9:13 pm
once upon a time a non-practising mechanical engineer always working as a software/hardware engineer was informed that we don’t need to consider backlash as it’s a no backlash gear box. i ignored that.
fit a marker switch and let it do a revolution forward and backward, i think in my case it was a 15-20 count.
enough to affect the model in the wind tunnel, so depending on the model angle required, the motor/gearbox had the slack taken out by approaching the zero from the appropriate direction.

are you monitoring the angle of the tube itself ? when i’ve bent pipes in a manual bender, i ended up approaching the bend angle incrementally as i needed to back off and repeat as the bend in the tube opens a fraction.

how are thinking of handling that bounce back in the tube when you release the bending force / drive ?

can you monitor the motor current/loading and mark that position as there’ll be some lack in the mechanical bits ?

stephen


davemorl
Wed Sep 06, 2017 9:21 pm
Hi Stephen,

I was planning on using the same tube over and over again so the spring back will be very similar. So with a bit experimentation I could bend a 90 degree bend by bending it to say 92 degrees for example. Once I know this I can just note down for each angle what angle bend is needed. Then it should be bery repeatable. I imagine a 45 degree bend will spring back less than a 90 degree bend.

So do you think the programming of an stm32 would be a bit ambitious considering this will be a steep learning curve on an arduino still for me? I would rather learn the stm32 board as it’s more advanced for future projects. It’s just the time scale that is putting me off as I’d like to get this up and running asap really.

Dave


zmemw16
Wed Sep 06, 2017 10:03 pm
if you could do it on an arduino having all the required libraries then i can’t see a reason not to use stm32.

flies in the ointment
one or more libraries requires some porting. there is a section for libraries and problems. plenty of them already are; i use them as tutorials & for guidance.

voltages and sensors, keep in mind that stm32 is predominantly 3v3, although some pins(quite a few) are 5v tolerant.

go for a simple display, lcd 20×4 (fit a backpack? makes it simpler, i2c/spi/serial) – a graphical one can come latter

determine what you need in peripherals, spi, i2c, serial and general i/o pins. then double :D
look at board prices, the mcu families. if a board has a display socket or header(32/34/36/40ways), then it’s always there for the future.
usually such boards are more than a 103c8.103cb, typically minimum of medium 103r

look at the wiki http://wiki.stm32duino.com/index.php?title=Main_Page

there is considerable effort being applied to f4 and f7 series cores and libraries, pretty much the same peripherals & gpio are available, but more of them and much faster. pricing is trending downwards and the gap from high end 103 to that of a decent/high end f4xx is not that much
i’d suggest getting more than less in the mcu.

stephen


davemorl
Thu Sep 07, 2017 5:58 am
I suppose it’s just a bit daunting starting to learn a new board. What are the libraries like now for the stm32? Will I likley come across any issues with this sort of project or have all the issues been ironed out now?

I would only need 2 pins really 5v for the encoder to be honest. Or just use a voltage divider to convert to 3.3v. As long as it has 2 interrupt pins for the A and B pins for the encoder and maybe another for the stop button that should for suffice.

I would probably go for a very basic LCD with spi or i2c to be honest as there will be less ports being used up. Is the wire library supported now? When you say porting do you have to go into the header files and change the registers? As I have no experience at all with this and I think I’d struggle greatly at the moment.

I think I’m gonna go for using the stm32 and see how I get on. Hopefully I haven’t bitten off more than in can chew. Hahaha!


RogerClark
Thu Sep 07, 2017 6:57 am
Wire and SPI both work fine, (Master only)

Plenty of libs for displays work. The ILI9341 SPI colour LCD seems to be the most popular display.


davemorl
Thu Sep 07, 2017 8:22 am
Hi Roger,

Thanks. I did consider using a touch screen instead of normal switches.

I think I’m going to just order some bits and pieces have a bit of a play and see how I get on. Maybe see if I can get the hang of a basic touch screen display with a basic project first. Then do some basic with the incremental encoder second. Then once I feel comfortable with both try and merge what I’ve learnt and give it a whirl.

I think breaking this down and learning each part first is the most sensible option than trying to learn it all in one go.

Wish me luck! ��


ahull
Thu Sep 07, 2017 10:26 am
I’m probably over thinking the problem, and this idea may not work in an environment where there is a lot of other metalwork around, but if you are looking for a sealed sensor that can accurately measure relative angles, then a digital compass like the HMC5883L might be adaptable to your needs.
My experience of metalworking shops is that optical sensors, unless completely sealed from their environment are not very reliable, hall sensors are better (but watch out for metal dust screwing them up).

They are pretty cheap too, so maybe worth picking up for a bit of experimentation.

https://www.ebay.com/sch/i.html?_from=R … 3L&_sop=15


davemorl
Thu Sep 07, 2017 12:47 pm
Thanks!

No harm in having a play and see how it goes for a couple of quid.

I was thinking off adding a couple of hall sensors in parallel as a bit of protection for the end limits as a bit of a safety measure. I think this will be advisable with almost 25,000Nm of calculated torque.


ahull
Thu Sep 07, 2017 2:18 pm
[davemorl – Thu Sep 07, 2017 12:47 pm] –
I think this will be advisable with almost 25,000Nm of calculated torque.

:o You certainly don’t want that much oomph pinging lumps of metal round the workshop.


zmemw16
Thu Sep 07, 2017 3:47 pm
could you post a sketch of what you have in mind for the mechanics ?

you say torque, so it’s acting on an arm of some sort. pushing or pulling something (constrained in a guide?) against the pipe ?

stephen


davemorl
Thu Sep 07, 2017 4:12 pm
I’m currently on an oil rig in the north sea, i’ll try and upload a screenshot of the CAD drawing later, I may even have a pic of the progress on my phone if you are interested. Its basically a 4 step spur gear reduction with another worn wheel gearbox between that and the motor.

Apologies I had a big brain fart its not 25,000Nm its actually around 5,000Nm god knows where that figure came from its been a long day :o


davemorl
Thu Sep 07, 2017 6:13 pm
Here is what I have on my phone! It’s a bit further on than this though!

davemorl
Thu Sep 07, 2017 6:16 pm
This is the cad drawing I’ve mate! There will be a few things different. Especially on the adjustable follower.

zmemw16
Thu Sep 07, 2017 6:28 pm
oh, i tend to restrict myself to 10, 15 & 22mm and in plastic :)
also say you meant worm and not worn ? backlash is not a big enough term for that lot.
and up to what size tube ? actually anything from the look of that setup :!:
so the motor came off a 3d printer ?

stephen


davemorl
Thu Sep 07, 2017 6:47 pm
Yeah worm, bloody predictive haha!

Yeah I’m not to worried about backlash as I’ll be taking up the slack in the system and then zeroing then bending to the desired bend with the addition of the spring back which will be determined from a few tests.

I’ve got the die made for 60x30mm oval tube with 3mm wall thickness so that’s the first test. I’ll just make new dies as I need them which won’t be to hard.

I’m putting a 1kw 3phase 4pole motor on it so will be pretty beefy! I’m hoping that the motor will stall before anything snaps especially the gears. I’ve calculated it this way so hopefully I have done it right ��

So I’m hoping to get the hang of the stm32 and get this up and running asap. In the mean time I’ll just try it manually with fwd and back buttons.


Leave a Reply

Your email address will not be published. Required fields are marked *