New to STM32 and projects on it

Post here first, or if you can't find a relevant section!
davemorl
Posts: 10
Joined: Wed Sep 06, 2017 5:03 pm

New to STM32 and projects on it

Post by 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

User avatar
martinayotte
Posts: 1229
Joined: Mon Apr 27, 2015 1:45 pm

Re: New to STM32 and projects on it

Post by 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
Posts: 10
Joined: Wed Sep 06, 2017 5:03 pm

Re: New to STM32 and projects on it

Post by 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
Posts: 1494
Joined: Wed Jul 08, 2015 2:09 pm
Location: St Annes, Lancs,UK

Re: New to STM32 and projects on it

Post by 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
Posts: 10
Joined: Wed Sep 06, 2017 5:03 pm

Re: New to STM32 and projects on it

Post by 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
Posts: 1494
Joined: Wed Jul 08, 2015 2:09 pm
Location: St Annes, Lancs,UK

Re: New to STM32 and projects on it

Post by 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 20x4 (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
Posts: 10
Joined: Wed Sep 06, 2017 5:03 pm

Re: New to STM32 and projects on it

Post by 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!

User avatar
RogerClark
Posts: 7498
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: New to STM32 and projects on it

Post by 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
Posts: 10
Joined: Wed Sep 06, 2017 5:03 pm

Re: New to STM32 and projects on it

Post by 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! 😁

User avatar
ahull
Posts: 1663
Joined: Mon Apr 27, 2015 11:04 pm
Location: Sunny Scotland
Contact:

Re: New to STM32 and projects on it

Post by 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
- Andy Hull -

Post Reply