Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 18:52 20 Nov 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : PicoMite PWM

Author Message
Rickard5

Guru

Joined: 31/03/2022
Location: United States
Posts: 463
Posted: 05:30am 31 Mar 2022
Copy link to clipboard 
Print this post

Hi all, sorry if this is a silly Question but I'm new to the PicoMite.

Is there a way to control PWM output from MMBasic on the PicoMite? like to control a Servo or Brightness of a LED?
I may be Vulgar, but , while I'm poor, I'm Industrious, Honest,  and trustworthy! I Know my Place
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9757
Posted: 05:50am 31 Mar 2022
Copy link to clipboard 
Print this post

No question is silly when you are a newbie - you have to learn somehow.

You can control all 16 PWM pins inside MMBASIC.
See the PicoMite user manual, page 27: Pulse Width Modulation.

  Manual said  
The PWM (Pulse Width Modulation) command allows the PicoMite to generate square waves with a program  controlled duty cycle. By varying the duty cycle you can generate a program controlled voltage output for use  in controlling external devices that require an analog input (power supplies, motor controllers, etc). The PWM  outputs are also useful for driving servos and for generating a sound output via a small transducer.
The PWM outputs consists of up to 8 channels (numbered 0 to 7) with each channel having two outputs (A and B). For each channel the frequency can be selected and for each output a different duty cycle can be set.  Up to 16 pins can be configured as PWM outputs using the SETPIN command.

Smoke makes things work. When the smoke gets out, it stops!
 
phil99

Guru

Joined: 11/02/2018
Location: Australia
Posts: 2832
Posted: 05:54am 31 Mar 2022
Copy link to clipboard 
Print this post

Some bits from the manual.

  Quote  
PWM outputs can be used to create various sounds,
control servos or generate computer controlled voltages for driving equipment that uses an analogue input
(e.g. motor controllers).

Pulse Width Modulation
The PWM (Pulse Width Modulation) command allows the PicoMite to generate square waves with a program
controlled duty cycle. By varying the duty cycle you can generate a program controlled voltage output for use
in controlling external devices that require an analog input (power supplies, motor controllers, etc). The PWM
outputs are also useful for driving servos and for generating a sound output via a small transducer.
The PWM outputs consists of up to 8 channels (numbered 0 to 7) with each channel having two outputs (A and
B). For each channel the frequency can be selected and for each output a different duty cycle can be set.
Up to 16 pins can be configured as PWM outputs using the SETPIN command.

Commands
PWM channel, frequency,[dutyA] [,dutyB]
PWM channel, OFF
There are 8 separate PWM frequencies available (channels 0 to 7) and up to
16 outputs with individually controlled duty cycle. You can output on either
PWMnA or PWMnB or both for each channel - no restriction.
Minimum frequency is 15Hz. Maximum speed is OPTION CPUSPEED/4
At very fast speeds the duty cycles will be increasingly limited


The manual is very comprehensive and excellent reading.
 
lizby
Guru

Joined: 17/05/2016
Location: United States
Posts: 3480
Posted: 12:52pm 31 Mar 2022
Copy link to clipboard 
Print this post

Here's a youtube video of the PicoMite doing many things, including LED dimming and brightening, and servo twitching.

Gerbers, code, and other info linked here.


PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed
 
Paul_L
Guru

Joined: 03/03/2016
Location: United States
Posts: 769
Posted: 04:51pm 31 Mar 2022
Copy link to clipboard 
Print this post

Hi Lance, cool bunch of flashing lights in your sequence of videos.

After they were done YouTube decided to show me something really interesting. SwiftSolar, a company in Silicon Valley, is working on thin film Perovskite solar cells which will soon increase the efficiency of solar cells by 50%, and can be painted on most smooth surfaces! Take a look.

https://www.youtube.com/watch?v=tQmFVcD-Mbo

Paul in NY
 
lizby
Guru

Joined: 17/05/2016
Location: United States
Posts: 3480
Posted: 06:27pm 31 Mar 2022
Copy link to clipboard 
Print this post

Hey, Paul. Good to see you on TBS lately. Interesting Perovskite video. Can't be commercialized too soon.
PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed
 
Paul_L
Guru

Joined: 03/03/2016
Location: United States
Posts: 769
Posted: 06:01pm 01 Apr 2022
Copy link to clipboard 
Print this post

Hi Lance,

I'm here just watching mostly.

I'm a little disappointed that more people didn't express interest in the DBMS idea. Most of the readers seem to be interested in simple physical controls for water supplies or heating. MMBasic is ideal for these applications running on the smaller chips. I'm convinced that MMBasic could easily handle bigger applications, like the DBMS. The code for its primitive functions seems to be extremely efficient.

Meanwhile my geothermal system is percolating along very nicely on the antiquated controls. I still would like to get a better control system working however.

Our local utility, Central Hudson Gas & Electric, has been bought by FORTIS, which started out in life as St John's Electric Light which became New Foundland Power. They have screwed up the IT department, particularly the billing functions. Our bills now average about $0.22 / KWH for electric power and from $0.30 to $0.90 (seasonally variable, highest in March) per Therm (100K BTU) for gas.

This house requires an overall average of about 23,000 BTU/hr (0.23 Therms/hr or 6.75 KWH/hr) for about 6,500 hours during the heating season (September through May around here). That's about 150M BTU-hrs or 1500 Therms or 43,900 KWH which would cost between $450 and $1350 (seasonal pricing) per year if we burn gas or $9650 if we use electric resistance heat, or about $3300 per year if we use the geothermal system with its coefficient of performance of 3 to 1.

The choice is obvious -- we burn gas! The geothermal system is mostly being used for cooling during the summer months.

Paul in NY
 
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025