I swallowed the red pill.

Post Reply
Howard Hill
Posts: 3
Joined: Sun Aug 18, 2019 4:49 am
OS: Linux
IDE: Geany use arduino to upload
Core: Rogers
Board: Bluepill

I swallowed the red pill.

Post by Howard Hill » Sun Aug 18, 2019 6:20 am

Hi all.

First I'd like to thank all those involved in bringing the stm32 into the world of novices like me.
The work and time you have put in is just incredible, I tip my hat to you all.

So I swallowed the red pill and bought myself a bunch of blue pills :)

I've been working on my own home automation system on and off for about 5 years now.
It's taken a little longer than I liked, had some health problems that slowed me up for quite some time but now I'm back into it.
I've written a complete pub/subscribe server routine similar to mqtt that can run on a ras-pi using my own ideas.
I sometimes find it easier to write my own stuff than to spend countless hours trying to lean other peoples thinking.
I guess you could say I suffer from NIH syndrome mixed with a bit of OCD :)

Im in no way a programmer or an electro head, I don't even work in the trade. Just a self taught jack of all trades, master of none, so excuse me in advance if I ever ask any dumb questions :)

Anyway, I started with Arduino's and was using RS485 for all communications, mainly because ethernet things for arduinos were through the roof price wise. I often thought they must have been made with printer ink.
So now I've discovered the bluepill with wz5500 ethernet boards from ali express, total of 6 bucks for one unit, just wonderful.
I found a library on Roger's old forum ( What a shame, by the way ) that allowed the stm32f103 to run a websocket server, I was in heaven.
I can't remember who wrote it, he didn't put his name on him anywhere in the code. He's a regular on the forum I know that much. I'd like to thank him for that, it works fantastic.

Anyway, I have a couple of questions about the stm32 hardware I'll post later. Seeing some weird stuff happening with analog read.

Again, thanks to all who have given so much.

stevestrong
Posts: 60
Joined: Tue Mar 05, 2019 7:49 am
Location: Munich
OS: Win7 & 10
IDE: Arduino 1.8.8, Sloeber
Core: Libmaple
Board: Bluepill, Generic F4VET6 black & mini
Contact:

Re: I swallowed the red pill.

Post by stevestrong » Sun Aug 18, 2019 9:08 am

I had a websocket project posted on the old forum, my source code is available here: https://github.com/stevstrong/WebSockets.

Howard Hill
Posts: 3
Joined: Sun Aug 18, 2019 4:49 am
OS: Linux
IDE: Geany use arduino to upload
Core: Rogers
Board: Bluepill

Re: I swallowed the red pill.

Post by Howard Hill » Sun Aug 18, 2019 10:16 am

Yes that's the one. I'm still in the middle of prototyping up a controller board that talks to my master server using your library. They're quite a different beast to arduinos.

Thank you, stevestrong, your code is gold. I hope some day I can give something back in return.

mrburnette
Posts: 90
Joined: Fri Mar 29, 2019 2:22 am
Answers: 1
OS: Linux
IDE: Arduino
Core: Any
Board: Blue, MM, Black

Re: I swallowed the red pill.

Post by mrburnette » Mon Aug 19, 2019 2:07 pm

Howard Hill wrote:
Sun Aug 18, 2019 6:20 am
...
I've written a complete pub/subscribe server routine similar to mqtt that can run on a ras-pi using my own ideas.
I sometimes find it easier to write my own stuff than to spend countless hours trying to lean other peoples thinking.
...
Anyway, I have a couple of questions about the stm32 hardware I'll post later. Seeing some weird stuff happening with analog read.
I think much knowledge can be gained from a roll-your-own solution. That being said, a mature product such as mqtt offers more than can be seen: a well established development and test cycle being just one benefit. Another is the ability to share your concept with others using non-homegrown code. Sounds to me that you just want your own needs satisfied and are not planning on a product, so I can certainly understand the "... implement what and only what I need..."

The original Maple Mini was a 4-layer board with separate Analog and Digital ground planes. The Maple Mini Clone by Baite was a 2-layered designed and is the board initially suggested by the forum. But the Blue Pill seems to be the mainstay primarily due to price.

In resolving analog issues, first profile your analog source: voltage divider, sensor, pules integration, etc. Then try to identify areas where 'noise' could be a problem; as an example, AC hum and long wiring runs (here, a long run may be just a couple of feet.) RF noise can be caused by WiFi and a cold-solder point can act as a rectifier. Most critical is the stability of the analog reference... it if is not perfectly clean, the analog readings will be affected.
A number of application notes are available to read (and likely put you to sleep) and some good articles on the www:
STM's own AN2834
https://www.eevblog.com/forum/microcont ... adc-noise/
https://embdev.net/topic/stm32f0-adc-in ... stigations
https://www.analog.com/en/analog-dialog ... noise.html

Also, look at your boards under a magnifier. Cheap circuit boards are often contaminated with flux, oils, and a variety of salts. I always give my clone boards a nice bath in IPA 100% https://www.amazon.com/MG-Chemicals-824 ... B005DNQX3C
Remove the alcohol quickly using hot air or a hair dryer... remember the stuff is flammable! If you allow the alcohol to evaporate, the board will cool and condensation can occur and liquid water presents an issue with copper oxidation in areas where the solder mask is weak.

Depending on your environment, you may want to consider a conformal coating:
https://www.google.com/search?&q=confor ... al+coating
Little things like the above can make for long-term stability. Remember, the analog circuit in the uC looking out to the world wants to see a 10K or lower impedance, so voltage dividers with very high resistors need to be redesigned or select from SPI or I2C sensors.

Ray

Howard Hill
Posts: 3
Joined: Sun Aug 18, 2019 4:49 am
OS: Linux
IDE: Geany use arduino to upload
Core: Rogers
Board: Bluepill

Re: I swallowed the red pill.

Post by Howard Hill » Tue Aug 20, 2019 2:03 pm

I think much knowledge can be gained from a roll-your-own solution. That being said, a mature product such as mqtt offers more than can be seen: a well established development and test cycle being just one benefit. Another is the ability to share your concept with others using non-homegrown code. Sounds to me that you just want your own needs satisfied and are not planning on a product, so I can certainly understand the "... implement what and only what I need..."
Yes, a lot of people put their trust in mqtt, it is a mature working product and I'm sure it fits the needs of most people really well.
I wanted to do my own because I wanted to improve my python skills and knew I could do it, always a challenge when you do new things you have no idea about :)
Mine is quite a bit different than others in that I have incorporated it into my home media solution which I also wrote myself.
At a glance I can see and control everything in my home and workshop from my TV, computer, phone, tablet, we have one in every room, TV and computer that is. It has a builtin rules/scheduler and all can be configured and controlled via the TV remote while lying in bed if you want :)
It was much easier for me to write a custom solution than to try and shoehorn stuff into someone else's code, plus I get bragging rights :)

And yes I never intended it be be a salable product, I fully intend to release it as open source code when I'm finished and thoroughly run it through its paces. People can then do with it what they like, maybe it will be useful to someone. I'm not at all comfortable collaborating with others, especially on stuff I'm only learning about myself.

As far as my problems with analog read, I solved my issue by changing the values of my voltage divider. Not used to working with 12bit resolutions, it's a touchy little bugger :)
What had me confused was when I turned on a pwm pin, I was getting a reading on the analog pin next to it which was triggering a routine attached to that pin. Ive never had that problem before. Also having had problems with pwm shutting down the ethernet controller earlier, until I set the pwm frequency to saner values, I thought that maybe this little beast is a lot touchier than the little 16mhz Arduinos. Anyway, all is good for now.

Thanks for your detailed response, Ray, much appreciated.

Post Reply