Author Topic: Use for a (very) cheap or low spec microcontroller  (Read 2687 times)

0 Members and 1 Guest are viewing this topic.

Offline romhunterTopic starter

  • Regular Contributor
  • *
  • Posts: 104
  • Country: vn
Use for a (very) cheap or low spec microcontroller
« on: March 12, 2019, 09:13:42 pm »
I'm just asking if anyone know anything to do with those (very) cheap micro that got absolutely next to no peripheral? I'm just looking for idea, since I'm so bored working on the large 64 pins ones (heck, I don't even use past 10 or 20 pins of those).

I mean the barebone one, like PIC10F200? ATTiny4? Padauk (god, OTP with strange C)? 89S52? What are they good for?

Any suggestion is welcome!
 

Offline JPortici

  • Super Contributor
  • ***
  • Posts: 3573
  • Country: it
Re: Use for a (very) cheap or low spec microcontroller
« Reply #1 on: March 12, 2019, 09:45:10 pm »
reprogrammable glue logic, "intelligent" ADC, UART multiplexer are three things i've used super simple MCUs for

reprogrammable glue logic:
-customer has lots of black boxes that do something
-customer wants the output to behave differently (inver in certain conditions)
-could be done with a couple of gates max, but i know that the customer will have different requirements on the next order and even different on the following one
So one modification, change the firmware accordingly

Intelligent ADC:
channel scan, filtering, SMB, internal diagnostic or things like that

UART multiplexer:
one full duplex stream (remote) that goes to different units. remote send a special command to change the mux selection
« Last Edit: March 12, 2019, 09:49:42 pm by JPortici »
 

Offline mariush

  • Super Contributor
  • ***
  • Posts: 5170
  • Country: ro
  • .
Re: Use for a (very) cheap or low spec microcontroller
« Reply #2 on: March 12, 2019, 09:58:09 pm »
noise generators,
motion sensors (for example detect if door opens by contacts being separated or infrared beam being broken) ,
on/off/wakeup controllers (hold button x seconds to turn on or off main device or a relay),
switch between battery and dc input, enable charging of battery when dc input plugged in
if it has adc with internal reference, maybe battery monitor ex chip reads battery voltage and lights up 1 to 4 leds, or blinks color of a led (red. yellow, green) or beeps every n minutes if battery goes below some threshold.
replacement for old chips that are no longer made (like let's say 4 bit or 8 bit input to 7 segment hex digit),
conversion between interfaces for example convert some proprietary display stuff to 4bit/8 bit lcd display (2x16 / 4x20) 


« Last Edit: March 12, 2019, 10:02:46 pm by mariush »
 

Online DaJMasta

  • Super Contributor
  • ***
  • Posts: 2392
  • Country: us
    • medpants.com
Re: Use for a (very) cheap or low spec microcontroller
« Reply #3 on: March 12, 2019, 09:58:54 pm »
Basic programmable timer circuits and things too - stuff you could do with analog, but you save on some passives (more like saving on production time) and can reconfigure in software as needed.  A lot of small electronic toys have a micro in them for blinking lights, making a sound, running a motor for 10s, etc. because it's actually cheaper to do and easier to reconfigure than making equivalent basic analog circuits.
 

Offline chickenHeadKnob

  • Super Contributor
  • ***
  • Posts: 1062
  • Country: ca
Re: Use for a (very) cheap or low spec microcontroller
« Reply #4 on: March 13, 2019, 01:31:37 am »
Basic programmable timer circuits and things too - stuff you could do with analog, but you save on some passives (more like saving on production time) and can reconfigure in software as needed.  A lot of small electronic toys have a micro in them for blinking lights, making a sound, running a motor for 10s, etc. because it's actually cheaper to do and easier to reconfigure than making equivalent basic analog circuits.

^ This

Jportici gives many good ideas, but the one area where a single chip micro realty improves on the "old ways" is for those  applications which used to be implemented with a 555 timer + some logic. Back in the 1970's micro's were too expensive and new, so glitchy 555 timer circuits abounded. I hate these with a passion! With even the simplest micro you can code rather comprehensive state machines that take into account the variability in the analog world. Tempco's, key debouncing, elimination of trimpots and manual calibration, ect. can be done in software. And accomplished at automated test time in production, rather than require manual setting.

 It helps of course if the micro has PWM and an ADC, and possibly some comparator pins - not a stretch as these features are now basic on some of the simplest micros
 

Offline Nitrousoxide

  • Regular Contributor
  • *
  • Posts: 156
  • Country: au
Re: Use for a (very) cheap or low spec microcontroller
« Reply #5 on: March 13, 2019, 06:41:21 am »
Long/short button press detector.
 

Offline Nominal Animal

  • Super Contributor
  • ***
  • Posts: 7187
  • Country: fi
    • My home page and email address
Re: Use for a (very) cheap or low spec microcontroller
« Reply #6 on: March 13, 2019, 09:26:13 pm »
A LED night light brightness controller using a tiny MCU and an AL8805.  On/off and brightness control via a rotary encoder.

Almost all adjustable LED current supplies seem to have a very annoying hum/whine (from mains if triac based, or from PWM).  Horrible for a bed reading light.  A 12V 0.5A wall wart is silent, and the AL8805 can adjust the current with few additional components, from a 0.4V - 2.4V voltage control signal.  The MCU can generate the control voltage using PWM and filtering.

This is actually something I've been thinking about, with an ATtiny and two encoders and AL8805s, for a bedtime reading lamp (and a floor reading lamp with two goosenecks).  I'm just not an EE myself, so I'm going about it rather trial-and-error.  The reason for the MCU is that I want very soft-on and soft-off, ramping at a slow rate over a second or so.  Otherwise you could just use a potentiometer in a voltage divider to control the AL8805.  The MCU won't use much power, but it'd be nice if it could be powered from the same supply as the LED(s), 6V to 36V.
 

Offline romhunterTopic starter

  • Regular Contributor
  • *
  • Posts: 104
  • Country: vn
Re: Use for a (very) cheap or low spec microcontroller
« Reply #7 on: March 14, 2019, 03:58:56 am »
I'd like to add a few idea of my own:

- 1-wire sensor(s) to UART/SPI/I2C converter. As much as I love 1-wire, they just suck if you decided to use a RTOS on your micro, or just have too much interrupt. And they can't generate interrupt themselves.

- Rotary encoder debouncer: Debounce the rotary encoder signal (after using RC filter) and send a clean signal to the main micro.
 

Offline chickenHeadKnob

  • Super Contributor
  • ***
  • Posts: 1062
  • Country: ca
Re: Use for a (very) cheap or low spec microcontroller
« Reply #8 on: March 14, 2019, 10:56:15 pm »
I'd like to add a few idea of my own:

- 1-wire sensor(s) to UART/SPI/I2C converter. As much as I love 1-wire, they just suck if you decided to use a RTOS on your micro, or just have too much interrupt. And they can't generate interrupt themselves.

- Rotary encoder debouncer: Debounce the rotary encoder signal (after using RC filter) and send a clean signal to the main micro.

Along these lines I remembered a project from Matseng on the Dangerous prototypes forum/blog. I think he is also a member here. He called it a Digi-pot:
http://dangerousprototypes.com/blog/2013/01/17/digipot-assembled/
http://dangerousprototypes.com/blog/2012/12/24/pcb-a-week-2-digipot/

Unfortunately the LED 3 digit 7-segment display requires more cpu pins than your pin budget allows. As I pointed out to Mats  It could also be turned into a PID controller, but that would be creeping feature-itis. I find software only debouncing very reliable and prefer it to hardware debounce.
 

Offline romhunterTopic starter

  • Regular Contributor
  • *
  • Posts: 104
  • Country: vn
Re: Use for a (very) cheap or low spec microcontroller
« Reply #9 on: March 15, 2019, 04:10:19 pm »
I find software only debouncing very reliable and prefer it to hardware debounce.

I find it to be opposite. I hate doing software debounce, and avoid mechanical switch at all cost.

Do you mind sharing your debounce function? I'd love to see your implementation (I never has a good software debounce experience before, it always bouncing around).

And I just found out I've been IP banned from DP forum. Like, why? Do they just randomly pick my IP and ban me from their forum because... well, they want to? Cuz I remember the last time I went to DP forum was around 2-3 months ago, and I don't even mess around! Just purely looking at the page!
 

Offline rhodges

  • Frequent Contributor
  • **
  • Posts: 354
  • Country: us
  • Available for embedded projects.
    • My public libraries, code samples, and projects for STM8.
Re: Use for a (very) cheap or low spec microcontroller
« Reply #10 on: March 15, 2019, 04:54:38 pm »
Do you mind sharing your debounce function? I'd love to see your implementation (I never has a good software debounce experience before, it always bouncing around).

Here is the polling function from my 4x4 keypad library. The poll function is called every millisecond, but actual polling of 4ms and a 40ms debounce works well.
Code: [Select]
#define KP_DEBOUNCE     40      /* debounce count in milliseconds */
#define KP_KEY_REL              /* notify when key is released (bit-7 set) */
#define KP_POLL_MS      4       /* actual key polling rate, milliseconds */

void keypad_poll(void)
{
    char        key;

    poll_count--;
    if (poll_count)
        return; /* no need to check every millisecond */
    poll_count = KP_POLL_MS;

    key = check_key(); /* get key from current column, if any */
    if (!key) {
        if (!bounce) /* key released? */
            return;
        bounce--;
        if (bounce) /* not debounced yet */
            return;
#ifdef KP_KEY_REL
        add_key(curkey | 0x80); /* notify that key is released */
#endif
        curkey = 0;
        return;
    }
    reset_cols();
    bounce = (KP_DEBOUNCE / KP_POLL_MS);
    if (curkey == key)          /* key still pressed */
        return;
    curkey = key;
    add_key(key);
}
Currently developing embedded RISC-V. Recently STM32 and STM8. All are excellent choices. Past includes 6809, Z80, 8086, PIC, MIPS, PNX1302, and some 8748 and 6805. Check out my public code on github. https://github.com/unfrozen
 

Offline IDEngineer

  • Super Contributor
  • ***
  • Posts: 1950
  • Country: us
Re: Use for a (very) cheap or low spec microcontroller
« Reply #11 on: March 15, 2019, 07:30:25 pm »
Think of them as "Reconfigurable glue circuitry so the inevitable Sales&Marketing-driven revisions can be prototyped, tested, and put into production in far less time, at far less cost, and without revving the PCB and schematic".

...or "A single, shared PCB and schematic that can be shared across multiple products to drive down the number of distinct SKU's, drive up volumes on that smaller number, and thus leverage economy of scale".
 

Offline Warhawk

  • Frequent Contributor
  • **
  • Posts: 836
  • Country: 00
    • Personal resume
Re: Use for a (very) cheap or low spec microcontroller
« Reply #12 on: March 15, 2019, 07:32:47 pm »
I use the 10F322 in this project: http://panacek.net/post/magsw2a/
You can also compare it against the v10a version with a D-flipflop which is shown in a different artile on that very page.

Offline mariush

  • Super Contributor
  • ***
  • Posts: 5170
  • Country: ro
  • .
Re: Use for a (very) cheap or low spec microcontroller
« Reply #13 on: March 16, 2019, 12:33:04 am »
I use the 10F322 in this project: http://panacek.net/post/magsw2a/
You can also compare it against the v10a version with a D-flipflop which is shown in a different artile on that very page.

It's a bit off topic, but is there any particular reason you didn't use something like PIC10F320 (/2) or PIC12F1571 and just skip the 3.3v linear regulator altogether?

The PIC12F1571 has 10bit ADC and you can set the internal voltage reference to 1.024v or 2.048v and runs with up to 5.5v and it seems that DRV5032 can also work with up to 5.5v
And this chip has 256 bytes of SRAM and 128 bytes of 100k write flash, so you could probably also add a feature like log the last 50-100 measurements that are different (within +/- a few bits of tolerance) and when you push a button, the led could be used to flash the values (a basic led to 9600 baud serial or whatever adapter would be super cheap to make)
 

Offline Warhawk

  • Frequent Contributor
  • **
  • Posts: 836
  • Country: 00
    • Personal resume
Re: Use for a (very) cheap or low spec microcontroller
« Reply #14 on: March 16, 2019, 12:29:54 pm »
I use the 10F322 in this project: http://panacek.net/post/magsw2a/
You can also compare it against the v10a version with a D-flipflop which is shown in a different artile on that very page.

It's a bit off topic, but is there any particular reason you didn't use something like PIC10F320 (/2) or PIC12F1571 and just skip the 3.3v linear regulator altogether?

The PIC12F1571 has 10bit ADC and you can set the internal voltage reference to 1.024v or 2.048v and runs with up to 5.5v and it seems that DRV5032 can also work with up to 5.5v
And this chip has 256 bytes of SRAM and 128 bytes of 100k write flash, so you could probably also add a feature like log the last 50-100 measurements that are different (within +/- a few bits of tolerance) and when you push a button, the led could be used to flash the values (a basic led to 9600 baud serial or whatever adapter would be super cheap to make)

Good comment. The main reason for the LDO is that the input can go up to 18 V, Even the typical R/C system operates with voltages close to 6V when the receiver battery pack is fully charged. Also, more and more fiends have been using 2x LiFe battery. The second reason is that the internal voltage reference is incredibly inaccurate. I was surprised that Microchip specifies -8 + 6% tolerance for the 10F322 and +/-4 % for the 12F1571! This is rubbish. The LDO I am using is 1% tolerance output.
I have always wanted to do something with the 10F family and this was the first project where it actually made sense. There is something special regarding the 6-pin microcontroller.  8) I also have a more adanced version with even current sensing and that one uses 12F1572  ::)

 
« Last Edit: March 16, 2019, 12:31:27 pm by Warhawk »
 

Offline RES

  • Regular Contributor
  • *
  • Posts: 109
  • Country: 00
Re: Use for a (very) cheap or low spec microcontroller
« Reply #15 on: March 16, 2019, 03:32:03 pm »
I'm just asking if anyone know anything to do with those (very) cheap micro that got absolutely next to no peripheral?

I mean the barebone one, like PIC10F200? ATTiny4? Padauk (god, OTP with strange C)? 89S52? What are they good for?

Create a complex sound effects generator (PWM+RC filter output(s) based on a software DDS (direct digital synthesis).
You could, for example, replicate sounds from an old SN76477: https://en.wikipedia.org/wiki/Texas_Instruments_SN76477

Offline Assafl

  • Frequent Contributor
  • **
  • Posts: 603
Re: Use for a (very) cheap or low spec microcontroller
« Reply #16 on: March 19, 2019, 06:53:15 am »
I was annoyed with a timer on a coffee grinder... It was annoying that you had to set a time which was either too long or too short.

So I used an ATTiny, a Hall Effect current sensor, and a relay to measure current, calculate RMS current (it used chopped DC so had to use RMS) to decide when the grinder was done and stop it.

Simpler than a timer, cheaper than a timer, is never too long or too short.

And, since I had a CPU I added: a diagnostic LED, variable threshold, pulsing the grinder twice after grind to clear stuck grounds...

 
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf