30w low voltage PWM controller

Advert

30w low voltage PWM controller

Home Forums Electronics in the Workshop 30w low voltage PWM controller

Viewing 12 posts - 51 through 62 (of 62 total)
  • Author
    Posts
  • #802684
    Michael Gilligan
    Participant
      @michaelgilligan61133

      It has been interesting to observe the ‘drift’ in this innocent little thread

      … of course I have no objection; it’s what happens on the forum

       

      Meanwhile … the humble 555 approach does look rather promising

      Today’s delivery by EVRi was Qty. 8 of the higher-power module … shipped half way round the world for an inclusive cost of £8.92

      Appearances are excellent, and hopefully I can try one tomorrow

      MichaelG.

      .

      Ref. This appears to be almost identical

      https://www.okystar.com/product-item/dc-motor-speed-controller-module-oky3463-3/

      Advert
      #802686
      IanT
      Participant
        @iant

        They look great Michael – How do I talk to them with my phone?  😉

         

        IanT

        #802691
        John Haine
        Participant
          @johnhaine32865

          Couple of days ago I noticed I coul buy some surplus OCXOs from  a seller on AliExpress.  They are quite a good type which I’d bought before for over £10 each.  Ordered 5 for slightly less than £1 each delivered! Crazy.

          #802692
          Michael Gilligan
          Participant
            @michaelgilligan61133
            On IanT Said:

            They look great Michael – How do I talk to them with my phone?  😉

             

            IanT

            I’m sure you could proceed in the usual fashion, Ian

            … The trickier bit would be getting them to listen to you.

            MichaelG.

            #802695
            Robert Atkinson 2
            Participant
              @robertatkinson2

              Dave,

              By a “simple” I mean not processing large amounts of data or having complex graphical user interfaces.
              A dictonary definition of a microcontroller is “a control device which incorporates a microprocessor.” I’d also say that anything which has to have external memory to operate is not a microcontroller. That rules out all the Pi’s dispite the RP2040 being descibed as a microcontroller by them. It needs exturnal Flash as supplied (if you wan’t a few million I’m sure thwy would change the mask ROM for you. I currently has the bootloader and USB code.
              All microcontrollers have a microprocessor on the chip but a microprocessor is not a microcontroller. A Intel 4004 is a microprocessor but it has less performance than even the most smallest PIC. The Ardunio Due is multi-tasking it has two cores.
              The comment ” They grow or have requirements that might be hard to fit in the space available or get to run fast enough. I guess Robert hasn’t been burned yet, but that’s luck rather than judgement.” about projects is not a given.  I’m not a programmer and never claim to be. But I write code. Including, as part of my job, developing commercial products with embedded microcontrollers using PBP. Mostly for prototypes but not all. Never had any trouble fitting it into the chip. On the contary when passing a prototype, with working PBP code to the “professional” programmers to write code in C or C++ they have requested more memory and faster processor to suppoert their bloted code. Using comms libaries to bit-bang a pin rather than using the USART on the chip and floating point libaries because the converted raw data to engineering units and than did the math. This totally ignored the fact that the ADC and DAC reference was 4.096V so each bit was a whole unit scaled so the required division and multiplication could be done with bit shifting.
              The production units shipped with my PBP code.

              Many libaries are open source but not all. Even the open source ones may be obfuscated. And how many hobbyists bother to look at what is in the libary? And is it good code?

              Don’t forget this started as thread about PWM generation. As classic job for a PIC. Writing a GUI isn’t.

              Robert.

              #802704
              SillyOldDuffer
              Moderator
                @sillyoldduffer
                On Robert Atkinson 2 Said:

                Dave,

                By a “simple” I mean not processing large amounts of data or having complex graphical user interfaces.

                That’s not my definition of simple!  I mean logically complex and time critical.  Actually, with an SD card or two, a PIC can process large amounts of data – not difficult.

                 

                 

                 

                 

                A dictonary definition of a microcontroller is “a control device which incorporates a microprocessor.”

                You introduced the distinction, not me,  I said the difference was blurred.

                 

                The Ardunio Due is multi-tasking it has two cores.

                No, it only multitasks if code is written do do that.  Though best avoided, most micros with a timer can be programmed in C to multi-task.  Might be possible in PBY too – how does it handle interrupts?

                The comment ” They grow or have requirements that might be hard to fit in the space available or get to run fast enough. I guess Robert hasn’t been burned yet, but that’s luck rather than judgement.” about projects is not a given.

                Not a given, but what’s been said suggests it!

                … On the contary when passing a prototype, with working PBP code to the “professional” programmers to write code in C or C++ they have requested more memory and faster processor to suppoert their bloted code. Using comms libaries to bit-bang a pin rather than using the USART on the chip and floating point libaries because the converted raw data to engineering units and than did the math. This totally ignored the fact that the ADC and DAC reference was 4.096V so each bit was a whole unit scaled so the required division and multiplication could be done with bit shifting.

                This is a programmer problem not a language issue.   Interestingly, John Haine’s example makes the same mistake with: analogWrite(ledPin, val * 0.25) Though functionally correct, it adds about 1000bytes to the executable compared with val / 4.   The C compiles converts / 4 into a shift, but because most AVR chips don’t have hardware floating point 0.25 loads the floating point software library.  I expect PBY does the same.   0.25 isn’t a problem on a Nucleo because it has FP hardware.  This stuff matters when space and speed are tight.

                Many libaries are open source but not all. Even the open source ones may be obfuscated. And how many hobbyists bother to look at what is in the libary? And is it good code?

                Obfuscated code isn’t open source!  Not many dig into libraries because it’s rarely necessary, but if there’s any doubt about quality, we can.   And re-write it if necessary.

                Don’t forget this started as thread about PWM generation. As classic job for a PIC. Writing a GUI isn’t.

                I haven’t forgotten!  Early on I pointed out that most microcontrollers do PWM,  Certainly not exclusive to PIC.  Touch screens are a common interface these days.  If a customer wants one, it’s our job as programmers to provide.  The bigger PICs can run a GUI, all that’s needed is skill and tools.

                Have a look at the ESP8266.  Does PWM, and comes with WiFi and a basic web server.  Allows motors to be controlled from a web browser rather easily.  But not if one insists that PBY and PIC are the answer…

                If anyone wants to traverse a mill table with a wiper motor, then MIchael’s NE555 module is good enough.   microcontrollers are for more difficult requirements,  like a multi-axis CNC.  Our difference boils down to this:  I disagree that simple tools are all that’s needed!  If BASIC was able to meet all programming needs, it would rule the roost.  The truth is BASIC has serious limitations*.   To me, the recommendation to use BASIC is equivalent to being told I don’t need a milling machine because files are cheap and simple.

                🙂

                Dave

                * So does c/c++, but there are fewer of them!

                #802731
                Robert Atkinson 2
                Participant
                  @robertatkinson2

                  Dave, I Use Pic Basic Pro, PBP not sure what PBY is othey than the american name for a Catalina 🙂

                  The comment “Interestingly, John Haine’s example makes the same mistake with: analogWrite(ledPin, val * 0.25) Though functionally correct, it adds about 1000bytes to the executable compared with val / 4. The C compiles converts / 4 into a shift, but because most AVR chips don’t have hardware floating point 0.25 loads the floating point software library. I expect PBY does the same. 0.25 isn’t a problem on a Nucleo because it has FP hardware. This stuff matters when space and speed are tight.”

                  shows the difference bettween a C programmer taught on a PC and a assembler or PBP programmer taught on embedded hardware. In PBP to divide by four just shift the bits right two places ( value >> 2 ). fast and resource efficent. PBP has conventional divide and  16 bit multiply that produces a 32bit (two word) result. It also has a 32 bit divide to act on the result. These use a lot more resource.

                  Clearly a PIC and PBP woud not be the choice for a web controlled motor. However if you use an ESP8266 you are, in thery at least, required to make your project compliant with the Radio Equipment Regulations 2017. Yes, even for a personal project.

                  Microcontrollers (in the conventional definition) are NOT for multiaxis CNC machines. They are EXACTLY for tasks like controlling a wiper motor driven table on a mill. Single knob speed contol like the 555 but with the easy addition of safe start up, easy addition of limit switches, ramped start and stop etc.
                  Buying genuine components from recognised distributors a PIC solution is likely to be cheaper than a 555.

                  At least the boards Michael bought have mounting holes. so much of this maker tat does not even have a sensible means of mounting just to squeeze as many boards on to a manufacturing panel as possible.

                  Robert.

                   

                  #802745
                  John Haine
                  Participant
                    @johnhaine32865

                    In my defence as I was editing the statement it was fewer keystrokes to type 0.25* than scroll to the end of the line to insert a “/4”.

                    Really I think this is a sterile argument.  The history of technology is for ever more complexity to be hidden away in apparently simple devices.  Sometimes the technology is all to do with the way the device is made, sometimes in the device itself, more usually in both.  Back when I started doing electronics for my bread-and-butter in about October 1971 microprocessors were only an Intel fever-dream but in 1981 the Nordic Mobile Telephone (NMT) system was launched with a micro in every phone.  Now your average phone probably has 4 cores for apps plus another couple for the modem.  A short while back Michael started this post:

                    https://www.model-engineer.co.uk/forums/topic/electromagnetic-pendulum-thing/

                    …which had a link to a pendulum impulser that used a double-wound coil and one transistor.  My latest circuit uses a Pico plus a couple of transistors and some other stuff – overkill perhaps but it wraps in a few other functions such as amplitude control and “gearing” to adjust the pulse rate to the dial.  But in apparent hardware terms it isn’t that much more complicated, just takes advantage of what’s now possible.

                    #802766
                    SillyOldDuffer
                    Moderator
                      @sillyoldduffer
                      On Robert Atkinson 2 Said:

                      Dave, I Use Pic Basic Pro, PBP not sure what PBY is othey than the american name for a Catalina 🙂

                      Correct,  PBY is a typo (or brain fart!)

                      The comment “Interestingly, John Haine’s example …

                      shows the difference bettween a C programmer taught on a PC and a assembler or PBP programmer taught on embedded hardware.

                      No it doesn’t!  C compilers automatically convert any integer divide and multiply by a power of two into a logical shift.   C is a systems language, specifically close to the machine for efficiency, and it can compile to minimise code size, or to maximise speed.  If needed, the optimisations are individually selectable. The compiler supports programmers who need that level of control: PBP doesn’t.  The Arduino-IDE presets optimisation to minimise executable size, but if execution speed is important the programmer can open the bonnet and change it to optimise for speed.   Optimisations can be fine tuned too – if needed.  It is necessary for the programmer to understand the limitations of the platform.  Not many on a PC, plenty to worry about on a small embedded chip.

                       

                      In PBP to divide by four just shift the bits right two places ( value >> 2 ). fast and resource efficent. PBP has conventional divide and  16 bit multiply that produces a 32bit (two word) result. It also has a 32 bit divide to act on the result. These use a lot more resource.

                      C does more!  An 8 bit Arduino Nano supports uint64_t if needed, and all the other standard integer sizes, and they all do the usual logic and arithmetic.

                      … if you use an ESP8266 you are, in thery at least, required to make your project compliant with the Radio Equipment Regulations 2017. Yes, even for a personal project.

                      So what?  We’re debating software development tools, not whether or not a particular hardware module complies with the regulations.

                      Microcontrollers (in the conventional definition) are NOT for multiaxis CNC machines. They are EXACTLY for tasks like controlling a wiper motor driven table on a mill. Single knob speed contol like the 555 but with the easy addition of safe start up, easy addition of limit switches, ramped start and stop etc.

                      I disagree.  That’s an artificial limitation invented by your good self.  I prefer Wikipedia’s definition.    A high-end PIC is a potent beast, fully capable of advanced projects – unless the programmer restricts himself to BASIC!  Why close doors?  Try Arduino.  Or mbed.    If you can program in BASIC, you can learn C.

                       

                      Robert.

                       

                      Might be fun, for Ian, Robert and I to illustrate the pros and cons of Micromite BASIC, vs PBP vs Arduino by showing how they meet the same requirement.  Others welcome to join in.

                      The project shouldn’t need much hardware. How about a simple alarm clock of no particular accuracy that only turns the alarm buzzer off when an accelerometer detects it’s been thrown at least 2.5 metres twice, sideways, not up down.  The alarm and time can be set by any means.  No display, let’s beep the time in morse code if the box is tapped.   The complications are:

                      • power management, the clock has to run for at least 48 hours on a battery!  Extra points for longevity!
                      • Getting sense out of the accelerometer.
                      • Calculating distance from acceleration and time of flight. I will get the maths wrong!

                      Not difficult to mechanically protect the alarm clock  by mounting it inside an egg-box.  And let’s smash a few – we all agree microcontrollers are cheap.

                      🙂

                      Dave

                       

                      #802769
                      IanT
                      Participant
                        @iant

                        Sure :

                        ‘ Check for sideways throw (X or Y axis)
                        IF ABS(distance_x) > THROW_THRESHOLD OR ABS(distance_y) > THROW_THRESHOLD THEN
                        throw_count = throw_count + 1
                        distance_x = 0
                        distance_y = 0
                        last_vx = 0
                        last_vy = 0
                        IF throw_count >= 2 THEN
                        alarm_active = 0
                        PIN(BUZZER) = 0
                        ENDIF
                        ENDIF

                        last_vx = vx
                        last_vy = vy
                        ENDIF

                        last_ax = ax last_ay = ay PAUSE INT(1000 / SAMPLE_RATE) LOOP

                        ‘ Beep time in Morse code BEEP_TIME: ‘ Beep hours h1 = hour \ 10 h2 = hour MOD 10 IF h1 > 0 THEN GOSUB BEEP_MORSE(h1) GOSUB BEEP_MORSE(h2) PAUSE 500 ‘ Beep minutes m1 = minute \ 10 m2 = minute MOD 10 IF m1 > 0 THEN GOSUB BEEP_MORSE(m1) GOSUB BEEP_MORSE(m2) RETURN

                        ‘ Beep Morse code for a digit BEEP_MORSE: FOR i = 1 TO LEN(MORSE$(ARG)) IF MID$(MORSE$(ARG), i, 1) = “0” THEN PIN(BUZZER) = 1 PAUSE 100 PIN(BUZZER) = 0 PAUSE 100 ELSE PIN(BUZZER) = 1 PAUSE 300 PIN(BUZZER) = 0 PAUSE 100 ENDIF NEXT i PAUSE 300 RETURN

                        Have’nt tested this of course….  🙂

                         

                        Regards,

                         

                        IanT

                         

                        #802777
                        Robert Atkinson 2
                        Participant
                          @robertatkinson2

                          Hi Dave,
                          “… if you use an ESP8266 you are, in thery at least, required to make your project compliant with the Radio Equipment Regulations 2017. Yes, even for a personal project.
                          So what?  We’re debating software development tools, not whether or not a particular hardware module complies with the regulations.”

                          Well you brought up the ESP8266 not me.

                          I disagree.  That’s an artificial limitation invented by your good self.  I prefer Wikipedia’s definition. https://en.wikipedia.org/wiki/Microcontroller   A high-end PIC is a potent beast, fully capable of advanced projects – unless the programmer restricts himself to BASIC!  Why close doors?  Try Arduino.  Or mbed.    If you can program in BASIC, you can learn C.

                          Ah, If using Wikipedia definition then none of your targets (Arduino, RPi, Pi Pico etc are microcontrollers, they are microcomputers.

                          https://en.wikipedia.org/wiki/Microcomputer

                          PBP in no way restricts the capabilities of the microcontroller.

                          Can you really say all C compilers will convert a divide by 2,4,8 or 16 into a bit shift? Why don’t they do the same with multiply by 0.25? There is a whole spectrum of compliers from free to thousands and terrible to outstanding. What constitutes “outstanding” depends on your requirements and expectations…..

                          I’m really not interested in a new project but I find your requirement of ” clock of no particular accuracy” interesting. It is actually quite hard to do an accurate clock with a complex microcomputer and high level language. You need to get into the weeds of the code or use hardware timers to keep accurate time.  That is fairly easy in PBP because it is optimised to use hardware counters. A PIC will beat any of your platforms on cost and power consumption for the original topic of a PWM output controlled by a pot.

                          Robert.

                           

                          #802795
                          IanT
                          Participant
                            @iant

                            (Just Back from lunch!)

                            I did of course cheat Dave! From seeing your post to responding to it took me three minutes. I cut n’ pasted your ‘application’ into GROK (AI) and asked it to give me a programme in Picomite Basic – which it did – in about 30 seconds…

                            On a (slightly) more serious note – I have done this before. NOT being a professional programmer, I quite often struggle to get going with a solution. A few months ago, for a mental ‘leg-up’ I asked GROK to write a programme for me (which to my suprise it did!). It didn’t work of course but I cut and pasted it into MM Edit (saving a lot of typing in the process) and then debugged it and managed to get a usable solution.

                            I think this also illustrates something else that is happening. My Grandkid’s Dad is (suprisingly to his Mum & Dad) the CIO of a large (well known) company. To the best of my knowledge, he’s never written a line of code in his life, however I’m sure he does manage people who do. He’s been to India recently to meet with staff and sub-contractors out there. I suspect very little ‘of their coding’ (as such) is now done in this country. I also mentioned to him my suprise at the AI writing a programme (in MMB) for me. His comment was that the AI they use (which is the “expensive kind”) is very powerful, extremely useful and improving rapidly.

                            I’m now well past my three score and ten Dave and my time is precious. Anything that makes life simpler & easier is to be welcomed. I’m afraid this is all the code you are going to get from me – as I have a very important (to my wife) lawn to mow!

                            It seems we keep debating the same thing over but from different perspectives. So I thought I’d asked the AI what it thought. It produced several pages of detailed analysis but here is it’s conclusion (unedited)

                            Conclusion

                            Choose PicoMite (MMBasic) if: You want a simple, beginner-friendly platform for rapid prototyping on the Raspberry Pi Pico. You prefer BASIC or have nostalgia for it. You need built-in support for common peripherals like displays, SD cards, or sensors without managing libraries. Your project prioritizes ease of use and quick iteration over raw performance.

                            Choose Arduino if: You need support for a wide range of microcontrollers beyond the Raspberry Pi Pico. Your project requires high performance, multi-core support, or complex libraries (e.g., Wi-Fi, Bluetooth). You’re comfortable with C/C++ or want to learn an industry-standard language. You want access to a massive community and ecosystem for diverse projects.

                            Both platforms are powerful, but PicoMite’s MMBasic shines for quick, simple projects with minimal setup, while Arduino offers greater flexibility and performance for complex applications. If you’re working with a Raspberry Pi Pico and value ease of use, PicoMite is likely the better choice; for broader hardware support or advanced projects, Arduino is superior.

                            I could critique this of course  – for instance I use both Bluetooth & WiFi with some of my Mites – but I think it’s a pretty good comparison in general terms.

                            Regards,

                             

                            IanT

                             

                          Viewing 12 posts - 51 through 62 (of 62 total)
                          • Please log in to reply to this topic. Registering is free and easy using the links on the menu at the top of this page.

                          Advert

                          Latest Replies

                          Viewing 25 topics - 1 through 25 (of 25 total)
                          Viewing 25 topics - 1 through 25 (of 25 total)

                          View full reply list.

                          Advert

                          Newsletter Sign-up