BBC Micro:Bit

66252304_2329475737122168_1827825187962224640_oThe BBC Micro: Bit is, to say the least, an outstanding product.  Designed to give the youth of Great Britain a headstart in the world of computing, the device made its way outside of the UK and has been available in the US for a time now.  I decided to give it a spin and, boy, talked about impressed.  It’s very small, very simple and very po67347291_2344305822305826_4275078865820319744_owerful. For under twenty US dollars, you get a micro that contains two buttons, a 5×5 LED matrix, ample RAM and EPROM, a simple but effective bus, battery power as an option via a built in connector, accelerometer, Bluetooth and more.  This thing is super simple to program as well (which was the goal.)  You can use Microsoft’s MakeCode IDE, the MakeCode website, A micro Python development IDE (via the WEB) and even Arduino IDE.  MakeCode is, perhaps, the easiest to use. It appears to work and look like the Scratch environment where you, literally, drag and drop controls to connect them together and form your program. You can get surprisingly sophisticated with this.  Each Micro: Bit is capable of communicating with other Micro: Bits, which allows for multiuser games or other uses.

66336575_2329475810455494_7193210424181915648_o

There is also a fair amount of third party support for Micro: Bit.  Add on LCD screens (which I have purchased one), controllers, cases, etc. I am in the process of reviewing a few and will write about them later. 

I am using these (I bought three, one for each of my younger children and one for myself—naturally.)  Both of my young ones seem to have taken to the device, with my youngest, who is six, being the most fascinated with the device.66520223_2334648659938209_3996346474836262912_o

The pricing for the device, under twenty US dollars, is perfect and the accessories are inexpensive as well.  Getting into hardware and software is easier and cheaper than ever.  This is a great way to enter the field.

Stay tuned for code, more photos and other tidbits on this terrific little device.

Advertisements

Sony PlayStation Retro Console…Thoughts

So, Sony decided to enter the retro ‘mini’ console craze that has seen the likes of Atari, Intellivision, Colecovision, Commodore, Sega and Nintendo become fun again.  They released a mini console replica of the original Playstation console from the nineties.  Now, I am not going to go into detail over what games came bundled or how much fun they are (a LOT) but, instead, I want to comment on the design, ease of use and a few nits over what is, otherwise, a decent product. Purists will bitch about it and the gaming press has villified Sony over the console, but, I am not (!) going to do that.

The NITS…

First, let me get my complaints about the console out of the way. 

Number 1: No power supply. Yes, this thing ships with ONLY a USB cable for power. Sony assumes you will plug it into your modern television’s USB port.  However, that did not work for me. I am not sure why, the set I use it on has a powered USB port, but, the console refused to get its power from there.  A normal USB wall wort worked fine.

Number 2: The unit took forever (OK, a few added seconds) to power up. When I plugged it into the wall wort, nothing appeared to happen. But, after a few seconds, the LED lit up an amber color. Pressing the power button turned the LED green and the console came to life.  It works fine.  So, I tried the USB port on the set again…nada, zero, zilch.  Didn’t get power from there.  The old Roku, though, did.  Odd.

Number 3: The interface is terrible.  The circular carousel isn’t the issue, its the quality of the presentation.  Yes, I get that it emulates something from the 90s, but, on a larger screen, it’s difficult to read.  The HDMI output is greatly appreciated, but, the presentation should match. The games, don’t necessarily have to, but everything else should. And, this leads to Number 4 and 5…

Number 4:  Why HDMI only?  The set I was going to put it on has bad HDMI inputs (yes, all three ports are dead) so, I wanted to use COMPOSITE, but, no, no composite output.

Number 5: Sony should release more games (as some other company has) for the console.  The 20 games included are fun, but, it would be nice to have more.

Number 6:  Last, the size of the console is a problem for me.  While it is cute, its a bit small (the controllers are, however, full size) and very light…which is the issue.  The attached controllers (both are USB and I am grateful for that) and if you move excitedly, you end up pulling the console with you.  A minor thing, but, annoying nonetheless.

The GOOD

There is a lot to like about the console.  It is unobtrusive (to a fault) and easy to set up. The controllers are familiar, so there is zero learning curve if you have played Playstation at all.  The selection of games is nice and, Tekken 3, is the bomb. The games, to me, are faithful enough and seeing the Sony logo is really cool (even though I am not much of a Sony guy) as it reminds me of the fun I had on my PS ONE.

Even with the paltry 20 games that are included, they are good games…but…if you want more from Sony, that is a no go, HOWEVER…if you search on Amazon, you can find a few products that add more games.  I ordered one

such device (a USB stick and a four port USB hub) that added 51 fighting gams (most of the Street Fight type) and an additional product that adds another 101 games.  So, for under 80 dollars, you can relive the early to mid nineties PlayStation experience. 

Even with my six ‘nits’ against the device, it was well worth the forty bucks I paid on Prime Day (it doesn’t cost much more if you shop around) and it even excited my two younger kids, both of which grew up on XBox 360 and Nintendo Wii and Switch.  Their initial thoughts…”wow, those are OLD” But, they loved the games. And, really, that’s all that should matter.

The Mini PlayStation is great deal.  Contrary to what has been written about it, it comes packed with nostalgia, good games and a nifty little case that is a tad on the small side.  You and your kids will love it.

Building your own programmable clock

20180120_204454Wow, it’s been quite a while since the last posting.  I thought we would start the year off with a cool project, a reboot of my Half-Byte Clock, featuring Embedded Tiny Basic. This time, I use an Arduino Nano and a nice canvas/wooden ‘case’ to house it all.

Instead of using the somewhat large Half-Byte Console board, I use the Nano so it fit inside the wooden frame. The frame is roughly one inch thick, just big enough for the Nano and all of the components to fit. On this particular iteration, the light sensor and speaker are on the back of the frame and, because of poor planning, the temperature sensor sticks out of the side. I intend to remedy that, but that will be later.  I am too busy to worry about that right now.

The Components

For the project, you will need:Samsung 6980

    • Arduino Nano or similar 328 based microcontroller board
    • HC-06 Bluetooth module
    • DHT-11 Temperature sensor
    • Light Sensor (I used the OSEP LIGHT 01 module)
    • Two or Three 8×8 LED Matrix displays, assembled with controller
    • DS3231 RTC for Arduino (Real Time Clock)
    • Small speaker (I stole this out of a toy cell phone I purchased at Dollar Tree)
    • Case/Frame/Canvas

My total cost is about twenty five dollars. The most costly part was the canvas frame-$8.95 at Target. All other parts were sourced from Hobby Town or Amazon.

Features

The clock features programmability via Half-Byte Embedded BasiSamsung 6945c, though you can use whatever code you like. This project, though, is aimed at a reprogrammable device that can display the time/date, temperature/humidity, output sound, use the ambient light to brighten or darken the display and be programmable over Bluetooth.  You have about 1k of RAM to store your Basic code and, once saved, will remain in memory, even if you unplug it. Upon power up, if there is something in memory, it will auto start after five seconds.

Wiring it Up

I was going to get all fancy and draw a diagram, but I think the pin connections will make more sense to more people, so that’s what I am going to do.  There are also photos you can look at.  As my hands aren’t as steady as they once were, my soldering leaves a lot to be desired.

DHT 11:

  • Data line to pin 2 of Nano
  • (+) to +5v on NanoSamsung 7010
  • (-) to GND on Nano

 

RCT:

  • SCL to A5
  • SDA to A4
  • GND to GND
  • VCC to +5v

 

Light Sensor:

  • Pin S to A0 on NanoSamsung 7008
  • (+) to 3.3v on Nano
  • (-) To GND on Nano

 

LED Array:

  • data to pin D12    DIN pin of MAX7219 module
  • load to pin D10    CS pin of MAX7219 module
  • clk to pin D11       CLK pin of MAX7219 module

 

Speaker:

  • GND to GND
  • + to Pin D8 on NanoSamsung 7014

 

HC-06 Bluetooth:

  • VCC to +5v
  • GND to GND
  • RX to TX on Nano
  • TX to RX on Nano

Sample Embedded Basic Startup Apps:

Example 1:

100 PRINT "Welcome to Half-Byte LED Programmable Clock"
110 SCROLL " HALF-BYTE  "
111 SCROLL " Clock."
112 IF HOUR(0)<12 SCROLL " Good Morning! "
114 IF HOUR(0)>11 IF HOUR(0)<18 SCROLL " Good Afternoon! "
116 IF HOUR(0)>17 IF HOUR(0)<=23 SCROLL "  Good Evening!  "
120 TIME
125 IF IN(0)<>-1 GOTO 600
130 SCROLL ".   Temp is "
140 TEMP
145 SCROLL "F  "
150 SCROLL "Humidity is "
160 HUMID
170 SCROLL "  Hello!  "
180 IF IN(0)<>-1 GOTO 600
190 IF RND(99)>50 GOTO 110
200 SCROLL "       "
205 O=MINUTE(0)
210 W=15
220 H=7
230 X=RND(W)
240 Y=RND(H)
250 P=RND(W)
260 Q=RND(H)
265 IF IN(0)<>-1 GOTO 600
290 SET X,Y,0
300 SET 16+(X),Y,1
310 SET 16+(X),H-Y,1
320 SET 16+(W-X),Y,1
330 SET 16+(W-X),H-Y,1
340 IF IN(0)<>-1 GOTO 600
350 SET 16+(P),Q,0
360 SET 16+(P),H-Q,0
370 SET 16+(W-P),Q,0
380 SET 16+(W-P),H-Q,0
390 IF IN(0)<>-1 GOTO 600
400 K=MINUTE(0)
410 IF K-O>1 GOTO 110
590 GOTO 230
600 SCROLL "DONE  "

Example 1 will randomly display random dot pattern for about a minute. It also analyses the time and inserts ‘Morning’, ‘afternoon’ or ‘evening’ in the greeting.  If you are connected via USB or Bluetooth, you can interrupt the app by sending a character followed by the ENTER key.

EXAMPLE 2:

200 SCROLL "        "
210 W=15
220 H=7
230 X=RND(W)
240 Y=RND(H)
250 P=RND(W)
260 Q=RND(H)
300 SET 16+(X),Y,1
310 SET 16+(X),H-Y,1
320 SET 16+(W-X),Y,1
330 SET 16+(W-X),H-Y,1
340 IF IN(0)<>-1 GOTO 600
350 SET 16+(P),Q,0
360 SET 16+(P),H-Q,0
370 SET 16+(W-P),Q,0
380 SET 16+(W-P),H-Q,0
390 IF IN(0)<>-1 GOTO 600
590 GOTO 230
600 SCROLL "DONE  "

Example 2 is the kaleidoscope from Example 1

EXAMPLE 3:

100 SCROLL " Half-Byte Clock "
110 H=HOUR(0)
120 IF H<12 SCROLL " Good Morning! "
130 IF H>11 IF H<18 SCROLL " Good Afternoon! "
140 IF H>17 IF H<=23 SCROLL "  Good Evening!  "
150 TIME
160 IF IN(0)<>-1 GOTO 600
170 SCROLL " Temp is "
180 TEMP
190 SCROLL "F  "
200 SCROLL "Humidity is "
210 HUMID
215 SCROLL "%         "
220 SET 20,2,1
230 SET 23,2,1
240 SET 20,4,1
250 SET 23,4,1
260 SET 21,5,1
270 SET 22,5,1
280 FOR X=1 to 5
290 DIRECTION 2
300 SCROLL"  "
310 DIRECTION 1
320 SCROLL"  "
530 IF IN(0)<>-1 GOTO 600
540 NEXT X
580 SCROLL "       "
590 GOTO 110
600 PRINT "INTERRUPTED "

Example 3 displays the date and time as well as the humidity and temp. It also shows an animated smiley face.

EXAMPLE 4:

100 SCROLL ” Half-Byte Clock ”
110 H=HOUR(0)
120 IF H>=0 IF H<12 SCROLL ” Good Morning! ”
130 IF H>11 IF H<18 SCROLL ” Good Afternoon! ”
140 IF H>17 IF H<=23 SCROLL” Good Evening! ”
150 TIME
155 IF H=17 IF MINUTE(0)>=0 IF MINUTE<=10 SCROLL ”  TIME FOR name TO COME HOME!”: TONE 8,3000,3000
160 IF IN(0)<>-1 GOTO 600
163 SCROLL ” ”
170 SCROLL “Temp is ”
175 TEMP
177 SCROLL “F  Humidity is ”
180 HUMID
190 SCROLL “%”
200 SCROLL ”   ”
220 SET 20,2,1: SET 23,2,1
240 SET 20,4,1: SET 23,4,1
260 SET 21,5,1: SET 22,5,1
280 FOR X=1 TO 5
281 DELAY 40
290 DIRECTION 2
300 SCROLL ”  ”
310 DIRECTION 1
320 SCROLL ”  ”
530 IF IN(0)<>-1 GOTO 600
560 NEXT X
580 SCROLL ”       ”
590 GOTO 110
600 SCROLL “Interrupted!”

Example 4 is an example of an ‘alarm’. It evaluates the hour and minute and displays a custom message and then generates a tone. It also features the animated smiley.

Samsung 7025With some clever coding, you could write a game, create an interesting art display, message board and more.  There are unused pins on the Nano that you can also use to wire up something to control (like a pet watering device, lights, etc.)  All of the sensors are available in Basic or, if you choose to write your own custom code, use the pin outs above to read or write to them. You are only limited by your imagination. And, well, that tiny bit of RAM that these things have. C’mon, we went to moon on less.

Using Half-Byte Embedded Tiny Basic to Teach

HBPortableLabIt is 2017 and we have a slew of low cost or free tools available that teach anyone how to program a computer.  Just for Windows, we have something called Small Basic, from Microsoft. It is free and has a bunch of material you can use to teach anyone, especially children, how to code. There is also Python, Minecraft and a host of other, modern tools.

So, why use something as crude as Tiny Basic? One that requires a terminal? Well, there are a few reasons you may want to do this.

Cost, for one. 

It is free. It runs on Arduino and Arduino clones.  You can use it to also teach basic electronics.

And, that is what I am doing…using it to teach not only programming, but also how computers work.  It is really more for the latter as Small Basic cannot manipulate sensors and other hardware like Tiny Basic can.  Since Tiny Basic includes instructions for reading temperature sensors and a real time clock, it is perfect for teaching things like turning on something on if the temperature gets above a given number or it if is 5 o’clock, turn off something.

I recently started doing this with my step son.  We used Embedded Tiny Basic on my ‘portable’ lab, which contains an Arduino UNO clone, a 2 x 16 LCD, breadboard and voltmeter.  We first made one green LED blink, then added a second, red LED blink.  I used Tiny Basic to explain how to talk to the LED’s and used the DELAY instruction to make the LED’s blink at a constant interval.  I also took the opportunity to teach him binary.  We had discussed it previously, but I don’t think he really got it. Until now.  Using the DWRITE statement, which takes two parameters…pin number and a zero for off or 1 for on.  Having him use that code got him to understand the concept.  Small steps.

His mind is wandering now…’I can build a robot…a game…something to tell me when Xander is coming down the hall…’ Xander is his four year old brother. 

There are those of you out there who are thinking that this is a terrible idea, using Tiny Basic, that is.  Well, no, not really.  He is getting real instruction with a more object oriented and modern language while using Tiny Basic to learn the nitty gritty of the hardware.  You do not need a modern, object oriented language to blink an LED. 

I will post future updates on our progress as well as sample code.  Below is the code we used to blink the LED’s.

100 PRINT “INTERVAL”;: INPUT I
110 FOR X=1 TO 50
120 DWRITE 3, 1
130 DELAY I
140 DWRITE 3,0
150 DELAY I
160 NEXT X

(For single LED-it was on digital pin 3)

Verizon takes an OATH: the death of AOL and YAHOO!

Two of the Internet’s oldest and most well known names, Yahoo! and AOL, will soon cease to exist.  With their purchases by Verizon, both companies will be merged into something called OATH.  While it remains to be seen just how well the combined company will do, one is for certain, neither company is anything like the companies we knew and loved or loathed, back in their heyday.

Indeed.

Yahoo! was THE search site. Period.  It was the Google of the late nineties and very early double-aughts. If you needed to find something, you went to Yahoo!.  I used Excite, a lot, but, like today and Bing, I found myself always using Yahoo!  Then, at some point, it became Yahoo! Powered by Google.  What? What’s this ‘google’?  I know it is a very big number that Carl Sagan used to talk about…but, what’s this ‘powered by google’?  So, I used Yahoo! to search for google.  The aforementioned number was the top choice, then…Google.com. I click the link and…viola! This empty page, except for the search bar and ‘google’ popped up.  Well, it looks like Yahoo! has company.  I eventually gravitated to Google for my searches.  Excite went belly up, as did most of the other search engines.  But, Yahoo! and Google were there.  Oh, this ‘MSN Search’ thing too…it eventually became useful and its name changed to Bing!, but that was years later.

Yahoo! lingered on…buying up hot properties in a desperate attempt to remain relevant, but…to no avail.  It became relegated to a collection of has-been properties, a few of which are still regarded in some fashion.

Only a few short years ago, Yahoo! was worth tens of billions of dollars.  Microsoft offered something like thirty billion to buy them, but then-CEO Jerry Yang figured that he could get ‘a better deal’ and held out.  He didn’t. He lost his title.  Marissa Mayer was brought in to right the ship…she couldn’t either.  Verizon got it for a tenth of what Microsoft had offered, not even a decade ago. I won’t even talk about the lack of security. Yikes.

America Online.

What can I say? I loved AOL.  I joined in 1992.  It was my favorite past time, well, other than a certain type of human interaction, that is.

Wow, just think, I could click a button, this loud, screaching sound came out of somewhere and, in a minute, I was ONLINE!  I had all kinds of things to do…look stuff up, download pictures, software, source code, short video clips…man, that was cool.  Sure, it took a LONG time to download files that, today, are smaller than most images on a web page, but, this was the early 1990’s and the Internet was new and not widely available. Bulletin boards were the hot things and these ‘chat rooms’ on AOL…yeah, those were cool. Perhaps the ability to share my knowledge with anyone was my favorite thing to do ‘online’.  I had written several demos and applications in this Visual Basic for DOS thing that was, for a few days, HOT.  Yep, HOT.  At least in the VB ‘room’ on AOL.  My demos and app were downloaded were downloaded…what, a dozen times.  Wow.  There was one demo, a phone dialer, that was downloaded about fifty times…I thought I was IT. Yep, fifty times. How freaking cool?

Well, as time went on, this Internet thing got big. REALLY BIG. And so did AOL.  AOL WAS THE INTERNET. For many, many people.  Think about that.

By 1998 or 1999, AOL was bigger than most tech companies. So big, in fact, that it bought Time-Warner Communications in 2000.  What a colossal mistake.  What AOL never counted on was the quick adoption of  high speed internet.  And the internal resistance within the Time Warner part of the company was overwhelming.  “these snot nosed punks aren’t coming in here to tell me what to do.”

By 2005, AOL was dead.  At least, to most they were. The company was still doing OK. It eventually spun off from Time Warner.  It became a collection of popular blogs and, believe it or not, they still had a sizable dial up customer base.  However, it wasn’t enough.

Verizon bought them.

And, now, they will be called Oath.

Admittedly, there’s a certain nostalgia surrounding both companies. That sound from-whatever-when you logged into AOL.  The anticipatory ‘You’ve got mail’. The excitement when the AOL home screen popped up (and, boy, that original DOS AOL client was both beautiful and cool) and, later on, the AOL Browser.  Yahoo! on AOL.

You know, now that I think of it, I kind of miss that sound from whatever and that anticipatory ‘You’ve got mail.’  Only kind of, though.

 

Assembling the NKC 65k Color LCD Shield

Assembling the NKC 65k Color LCD Shield

The NKC 65k Color LCD Shield isn’t difficult to assemble, it is, however a bit time consuming.  The most difficult part of the assembly is soldering the connector board to the LCD itself. You must carefully line it up on both the LCD AND the shield board itself.  More on that in a moment.

To begin, first make sure you have all of the parts. Compare the packing list with what you have. Once you are sure you have every thing, you need to start with the LCD.  Take the very small connector board and, carefully, solder one of the strips to the LCD. You will know where, it’s kind of obvious, but, in case you can’t, on the shield board, look for the outline

lcdconnectorboard.jpg

LCD Connector Board

of the LCD.  On the component side, you will see several solid tracks that appear to go nowhere. This is what you will have to line up.  Once you place the LCD on the Shield board and line them up…the LCD has a tit that goes through the board on one side, line it up using that. Once satisfied, remove the LCD and continue to solder the connector board to the LCD. When you are done, place the LCD back on the shield, make sure the board lines up and then solder it to the shield board.  Congratulations, this was the toughest part of the assembly.

 

The official instrucWP_20170201_21_48_05_Pro.jpgtions say to solder the header now.  I would advise to wait. The problem is that the resistors are difficult to solder if you insert and solder the headers first. So, I would solder those outer resistors next.  Those are the 1K and 10K resistors. While you are at it, solder all of the small, .1uf capacitors (the little bright blue capacitors) into place. A few of these are also next to the headers and in difficult spots if the headers go first.

Solder the remaining resistors into place.  The board is clearly marked, so it should be very easy to figure out where to solder them.

The two large 10uf capacitors are polarized, meaning they must be soldered in a specific way. Notice they both have a gray arrow on them, that is the negative side and must be soldered in with the arrow pointing to the negative sign or round hole on the board.C1 would have the gray arrow facing the LCD and C7 has it facing the Max232 Integrated Circuit.

For the large LM317, place in the three holes, flat side facing toward the Max232.  Solder the center pin.  Carefully, bend the LM317 backward so it is as flush to the board as you can get and solder the remaining pins.

If you have a 16 pin, through hole IC socket (one does not come with the kit) I would suggest you use it in the assembly. It is ok if you do not, it makes it easier if, for some reason, you should ever have to swap the chip out.  If you have the socket, go ahead and solder it to the board, paying attention to pin one.  If you do not have the socket, insert the chip with pin one facing the edge of the board. Pin one is where the ‘u’ shape is on the outline of the chip on the board. Once you are satisfied that you have pin one in the proper place, solder the chip to the board.

The only things left should be the headers. An easy way to solder them in is to place them in your Arduino UNO and then carefully place the board over them, making sure the pins penetrate the board. Solder them.

WP_20170201_22_30_35_Pro.jpg

The Completed Board

 

 

Wow, you’ve assembled your board.  Now you need to test it.  There is a demo sketch (two of them) on the NKC Electronics web site.  Download them and then up load to your Arduino. If all went well, you see a short demo on the screen.

This is a busy but useful board and a ‘fun’ project. It shouldn’t take more than a couple of hours to assemble and test.  There are better panels out there, but this kit is currently $4.95 and could be useful in a monitoring project, a game or for an at a glance status for one of your project.

Have fun!

Official assembly guideWP_20170201_22_36_47_Pro.jpg

Demo 1 - direct I/O

Demo 2 - using digital read/write

Demo 1 is much faster and is what I would use 
for things that need speed.

Embedded Tiny Basic: build apps for your projects

Embedded Tiny Basic: build apps for your projects

I, recently, embarked on building a useful if not glitzy digital clock. My first idea involved something retro: using four, seven segment, LED’s to look like something from the late 1970’s.  At the same time, I was also playing around with 8×8 LED Arrays, using the MAX7219 chip.  While playing with that, I connected one of my 1307 RTC’s to the array and loaded up a sketch to show the date and time on the arrays.  Then, it hit me…this is a much cooler clock and I can do more with it.

So, I built a prototype using one of my Half-Byte Console boards, minus the video, audio and Nunchucky connector.  Hardware wise, it was really simple…connect the arrays to pins 10, 11 and 12, the RTC to A4 and A5 and, for extra coolness, a BMP180 temp and humidity sensor to the sca and scl on the RTC.  Viola! modify the code to handle the BMP180 and Presto! A cool clock.

wp_20170121_01_55_22_pro

Prototype clock for developing Embedded Tiny Basic

I decided to build a second one to take to work.  I thought it might be useful to be able to throw up a custom message to scroll for when, say, I was in a meeting. The more I thought, the more I was convinced this thing needed some kind of control program that would be easily modified from, say, a smartphone and Bluetooth.

Well, I already had the genesis of that control program: Half Byte Tiny Basic.

So, I looked at the source and made a copy.  I then went in and removed stuff I would not need, like all of the graphics statements and functions. I removed the TVOut library, and  all of the video handling code. And TONE.  I miss TONE.

I did not need the Nunchuck code, so it was gone as well.  What was left was a nice, small shell of my control program.  I added the libraries for the 8×8 LED Array (MAXMATRIX) and added statements to manipulate the arrays: SCROLL to display text, SET to turn on or off individual LEDs, and DIRECTION to tell the arrays  which way to scroll the text.  I already had code to handle the DHT-11 temperature sensor, so I left that in (and decided to use it instead of the BMP180) and added T

wp_20170122_21_13_11_pro

Random dots on the clock

EMP and HUMID to scroll those values across the arrays, and added code for the RTC.I was going to add a mechanism that would interrupt the running program if a signal from the serial device was detected, but, there was already one there…the IN(0) function. So I left it. I now had a decent little programming language for the clock.  With HB Tiny Basic’s ability to autorun whatever is in the EEPROM, if it lost power, th

wp_20170119_15_23_11_pro

Clock, in action

e clock would just start running on its own. Sweet!

 

The HC-06 Bluetooth module works very nicely. It connects to the serial pins and communicates as if the device were connected directly to the controlling device-a PC or smartphone.  Everything fits nicely into these cheap pencil boxes I picked up from Wal-Mart for a buck each. They are just big enough for the HB Console board and are wide enough for the LED Arrays.  They don’t look all that impressive, until you power up the clock…the bright LED’s shine through the translucent plastic nicely.

Embedded Tiny Basic is useful for giving some level of intelligence to other wise dumb devices.  While you only have about 1K of RAM to use for Embedded Tiny Basic, I think that will be adequate for most things.  There is, currently, no motor control, but it could be quickly and easily added.  The functionality that is there is probably going to be good for quite a few projects.  If not, it can be modified quickly.  I am already seeing where it can be modified, even for just this particular project.  I have a few others in mind, so stayed tuned for those.

In the mean time, below is a list of the additions and a release date for the language is forthcoming.  I need to clean up the code-a bunch-before releasing it and, as well, making sure I have all you will need in order to compile and use Embedded Tiny Basic.

 New statements and function:
  • SETTIME hours,minutes,seconds,day,month,year
    • sets the time and date for the RTC
  • SET col,row,on or off
    • Turn on or off the LED at column, row
  • X=HOUR(0)
    • Get the current hour
  • X=MINUTE(0)
    • Get the current minute
  • X=MONTH(0)
    • Get the current month
  • X=DAY(0)
    • Get the current day
  • SCROLL var or “text”
    • Scrolls whatever is in the quotes
    • If there are no quoted strings, a variable value or number is displayed
  • DIRECTION 1-4 (1 is left, 2 is right, 3 is up and 4 is down)
    • Specifies the direction of the scrolling text, 1 is the default.
  • TIME (sends the date and time to the LED array)
    • Scrolls the current date and time
  • HUMID (sends humidity to LED array)
    • Scrolls the current humidity
  • Temp (sends the temp to LED array)
    • Scrolls the current temperature
  • X=TEMP(0 or 1)
    • Get the current temperature and put it in variable 'x'
    • A zero means use Celsius, a one means Farenheit
  • X=HUMID(0)
    • Returns the humidity to the variable 'x'

Below is the listing for the current “HELLO” app:

100 PRINT “Welcome to Half-Byte LED Programmable Clock”
110 SCROLL ” HALF-”
111 SCROLL “BYTE Clock…..”
112 IF HOUR(0)<12 SCROLL ” Good Morning! ”
114 IF HOUR(0)>11 IF HOUR(0)<18 SCROLL ” Good Afternoon! ”
116 IF HOUR(0)>17 IF HOUR(0)<=23 SCROLL ”  Good Evening!  ”
120 TIME
125 IF IN(0)<>-1 GOTO 600
130 SCROLL “.   Temp is ”
140 TEMP
145 SCROLL “F  ”
150 SCROLL “Humidity is ”
155 SCROLL “%”
160 HUMID
170 SCROLL ”  Hello!  ”
180 IF IN(0)<>-1 GOTO 600
190 IF RND(99)>50 GOTO 110
200 SCROLL ”       ”
205 O=MINUTE(0)
210 W=15
220 H=7
230 X=RND(W)
240 Y=RND(H)
250 P=RND(W)
260 Q=RND(H)
265 IF IN(0)<>-1 GOTO 600
300 SET 16+(X),Y,1
310 SET 16+(X),H-Y,1
320 SET 16+(W-X),Y,1
330 SET 16+(W-X),H-Y,1
340 IF IN(0)<>-1 GOTO 600
350 SET 16+(P),Q,0
360 SET 16+(P),H-Q,0
370 SET 16+(W-P),Q,0
380 SET 16+(W-P),H-Q,0
390 IF IN(0)<>-1 GOTO 600
400 K=MINUTE(0)
410 IF K-O>1 GOTO 110
590 GOTO 230
600 SCROLL “DONE  “

A note about how the arrays are referenced, using SET.  Embedded Tiny Basic is setup to handle up to four arrays. My clock only uses two, but Basic does not know this, so individual LED addressing has to be offset by 16.  Normally, with four arrays, the upper left LED would be 0,0. In my clock, it would be 16,0 since I am only using the RIGHT MOST TWO arrays, each are 8 across and 8 down.

Some other things to note from the listing above…the line IF IN(0)<>-1 GOTO 600 that is sprinkled through out the program will poll the serial port to see if there is a key press. If there is a keypress, we want to stop execution and goto line 600.  In this case, it just says ‘Done’ and stops. Lines 205, 400 and 410 make up a timer. Lines 200 through 590 just displays a random dot pattern, as a distraction.  We don’t want this all day, so we only let it run for about a minute.  Line 205 records the minute it started and line 400 gets the minute after each pattern is displayed.  Line 410 evaluates the elapsed time by subtracting the start time from the end time. If the result is greater than a one, it goes back to the clock routine.  Otherwise, it displays a new pattern. Lines 112 through 116 determines if it is morning, afternoon or evening.

The Scroll statement is lacking and somewhat buggy. I am working on fixing it, and adding more functionality to it, to make it more versatile, like PRINT currently is. I also want to add a mechanism to the language to allow it to receive messages, via Bluetooth, from, say, a smartphone.  Limited gameplay may also show up in a future release.

Embedded Tiny Basic will be released soon.