Monday, January 15, 2018

LOOM ROW COUNTER: Simple Programming With BBC MICRO:BIT



BBC Micro:bit is a micro controller for kids with a shinning BBC brand, integrated with buttons, blue-tooth, LED display and a bunch of other sensors built-in.  And it is the first micro controller I got to experiment with half a year ago. It is a nice little package and I like it a lot. But over time, I have my hands on other arduino based boards and soon my micro:bit is kind of left rusting in a box, which is sad.

Recently I have been working on looming a scarf for my girlfriend's birthday. It is not my idea at all and she seems to really enjoy knowing me working my ass off on something that I have never tried before. Fine. But the thing is, with the most simple pattern, there are a list, with row numbers, to knit, like this:



The thing is, while looming (and watching YouTube or listening to podcast) it is very hard to remember which row I am on and got mixed up. On my first try I was working on a scarf just like this video above, things were, still manageable. But my second try the project is way more bigger and more complex, with 16 rows. I need something that is just a simple counter to help me remember where I am.

Of course I could whip out a set of arduino boards, display modules, batteries, debounced buttons, but hey, I could do the same with less, in fact, with a simple micro:bit. I dig it out last night and after just about 10 minutes I got what I want:


And on such a simple project, I went with micro python. Come on I don't have to worry about LED multiplex in arduino or, do I really need to cross-compile this using Yotta? Guess not. Here is the code:

from microbit import *
a = 1
while True:
    if button_a.was_pressed():
        a = a + 1
    elif button_b.was_pressed():
        a = a - 1
    if a == 17:
        a = 1
    display.scroll(str(a), delay=150)
   
What it does is bare minimal as well. Left button add 1 to the display, and if I add too much I can use the right button to subtract 1 from the display. Simple. But works. (One thing I got to say is those button_a.was_pressed() methods really works well on this project. I really don't have to worry debouncing my buttons at all)

I mean, this is exactly the reason why I love to play with micro controllers like micro:bit here. I can program things instead of having to live with a computer or cloud. And it really helps in daily life, even if it's the most simple program.

Monday, November 27, 2017

Portable Word Processor CONCEPT

I just love things that are simple and stupid, like a simple portable word processor unit in the old days.

Of course they can still be bought, like Z88. Plug in the battery, flip on the switch and taps on.

Been thinking about doing something like this for a while, just for the fun of it. What it takes:


  1. keyboard, that can talk to:
  2. MCU
  3. decent display, mono, low power, no need for back light
  4. SD card, for data transfer

After digging around, there happens to be a blue tooth keyboard somewhere at home, after cracking it up, there is one NRF chip inside:



Nah... don't want to work with BT if I can help it. So, I just bought another cheap ass USB keyboard for almost nothing. And here is its guts:




There is already plenty of MCUs around for me to play with, but none of them have USB host capabilities, and this one is a USB keyboard.... But wait, on PCB it says PS2/USB, huh...

After some digging around, it turns out that this might just be a PS2 keyboard after all. It appears that some keyboards, like this one, may have a USB connector, but in fact, it's just a connector. For example inside a PS2 to USB connector:




If this is the case ( it probably is, for the price what can people expect ) then it would be much easier, for a USB host board is not only expensive and hard to find around here.

And there is some serious sounding PS2 library : PS2KeyAdvanced. Of course I have to test the keyboard myself, probably under some logic analyzer, because I have a feeling that this keyboard might have a much higher CLK speed than what a cheap 8 bit AVR MCU can handle. 

As for display, I want something that is big, preferably something like this:




I really love something bigger, without back light, yet cheaper and easier to find. One good thing about those LCDs is that they need little RAM to work with, I just need to use command mode and save some RAM for SD card interface and such. 

Last thing is the case. Hacking together all above is not hard, what is hard for me is the casing. Ideally, the casing should be part of the keyboard itself. I just need to make some modifications and such. But in order to keep things small and portable, there is no such space on a small keyboard. 

There WILL be some serious casing modification going on.

LOOM ROW COUNTER: Simple Programming With BBC MICRO:BIT

BBC Micro:bit is a micro controller for kids with a shinning BBC brand, integrated with buttons, blue-tooth, LED display and a bunch o...