The ATTiny 85 Handheld Game – New Games

The ATTiny 85 Handheld Game – New Games

Half-Byte ATTiny-85 Hand Held Game, based on the WebBoggles design

There are several new games contributed to the hand held game devised by Webboggles (and adapted by me for the Half-Byte Handheld Game.) Check them out by going here: https://drive.google.com/open?id=0BxGfuaPdM4n0Nkt5TDI4azd1Rmc

Among the new games are:

  • PONG
  • FROGGER
  • SPACE INVADERS
  • TETRIS
  • and the original games in bundles of two

There are variations of the hardware, for example, the PONG game really needs a potentiometer or paddle control. Schematics are included.

The games are free for personal use.  

Please show WebBoggles your appreciation.

Tetris Schematic:

Tetris Multi-Button

Frogger Schematics:

Frogger Attiny Schematic

Running Tiny Basic on the Micro: Bit

I was looking for some things to use in teaching my kids some programming with the BBC Micro: Bit and came across Tiny Basic on the Micro: Bit.  The implementation of Tiny Basic is a cross between Arduino Tiny Basic and Palo Alto Tiny Basic.  It’s very comprehensive and includes things like LED control, sensor reading, and serial communication via USB.  This is a great way to introduce kids and adults alike to the wonderful world of programming, hardware and the Micro: Bit. 

Full source is available, unfortunately, the GITHUB is in Japanese.  HOWEVER, you can use Google or Bing translate to translate the page for you. 

I have taken the liberty of bringing some of the information to you.  I had a bit of an issue making it work, so, here’s what I found so you don’t have to worry about it.

WHERE TO DOWNLOAD

You can, of course, download the full source and associated libraries and compile it yourself and then import into the Micro: Bit.

BUT….

All you really need is the compiled HEX file.  To get that…

  1. Download
    https://github.com/Tamakichi/ttbasic_microbit/archive/master.zip

  2. Connect the  micro:bit.
    You should see the Micro:bit drive “MicroBIT”
    Unzip the download file ttbasic_microbit-master.zip.
    From the bin folder, copy the file  ttbasic_microbit.ino.hex to the micro:bit (you can drag and drop it into the Micro: Bit folder.

  3. When the program write is finished, connect the serial with terminal software (TeraTerm, for example) etc.

  4. Set up your terminal software as follows:

    Terminal communication conditions Communication speed 115200bbs, parity none, stop bit 1, flow control: No; set the transmission delay to 1 ms/character.

Once you have downloaded the hex file to the micro: bit and setting up and connecting to your favorite terminal app, you should reset the micro: bit and see something like:

tinybasicformicrobitThe dialect of Tiny Basic is similar to Half-Byte Tiny Basic, but, it has far more capability.  With more memory to work with, no graphics and Micro: Bit hardware, there are a bunch of things you can do.

The following is copied directly from the web site.

Available keys

  • Cursor Move Cursor Key
  • Delete, CTRL-X: Delete characters at cursor position
  • BackSpace: Delete characters before cursor and move forward
  • PageUP, PageDown, ctrl-r: Refresh the screen
  • HOME, END: Move cursor to left or right edge in row
  • INS: Toggle toggle switching for insert sand
  • Enter: Line entry confirmed
  • Press ESC twice, ctrl-c: suspend execution program
  • CTRL-L, F1: Clear Screen
  • CTRL-R, F5: Screen Refresh

Pin-assigning and pin-specifying

  • Pin: Specified by PN0 through PN32, or 0 through 32
  • Pin mode specification command :GPIO pin , OUTPUT | INPUT_PU INPUT_PD INPUT_FL”
  • Digital Output:OUT Pin, HIGH| LOW|0|1
  • Digital input: variable =IN(pin)
  • Analog input: variable =ANA(pin)

Sample Program

Colored text on the screen

10 FOR I=0 TO 10
20 FOR J=0 TO 10
30 COLOR RND(8): ? "*";
35 WAIT 100
40 NEXT J
50 ?
60 NEXT I

Flashing LEDs on board


5 MATRIX OFF
10 GPIO 3,OUTPUT
20 OUT 3,LOW
30 GPIO 26,OUTPUT
35 "@loop"
40 OUT 26,HIGH
50 WAIT 300
60 OUT 26,LOW
70 WAIT 300
80 GOTO "@loop"

Analog value display

10 CLS
20 A=ANA(PN0)
30 LOCATE 5,5:?A;"    "
40 GOTO 20
Button input determination
10 CLS
20 IF !IN(BTNA) ?"Button A"
30 IF !IN(BTNB) ?"Button B"
40 WAIT 200
50 GOTO 20
LED Matrix Dot Display
10 CLS 1
20 D=1
30 FOR Y=0 TO 4
40 FOR X=0 TO 4
50 PSET X,Y,D
60 WAIT 100
70 NEXT X
80 NEXT Y
90 IF D D=0 ELSE D=1
100 GOTO 30
LED Matrix Message Display
10 CLS 1
20 MSG LEFT,200,"Hello"
30 FOR I=O TO 30
40 MSG DOWN,50,I/10
50 WAIT 50
60 MSG LEFT,100,I%10
70 NEXT I
80 WAIT 500
90 GOTO 20
Assign ed.m. character A to display
10 POKE FNT+ASC("A")*5+0,`00000000
20 POKE FNT+ASC("A")*5+1,`01010000
30 POKE FNT+ASC("A")*5+2,`00000000
40 POKE FNT+ASC("A")*5+3,`10001000
50 POKE FNT+ASC("A")*5+4,`01110000
60 MSG TOP,0,"A"
ASSIGN A FONT TO LED MATRIX CHARACTER A AND DISPLAY (2)
10 SETFONT ASC("A"),$00,$50,$00,$88,$70
MSG TOP,0,"A"
Neopixel Blue Trajectory Rotation
10 'Neopixel(1)
20 NPBEGIN 0,16
30 NPCLS
40 FOR I=0 TO 7
50 NPRGB I,0,0,(2<<I)-1
60 NEXT I
70 NPSHIFT 1
80 WAIT 50
90 GOTO 70
4x4Keypad input key determination (simple chattering measures available)
10 'Keypad 4x4
20 G0=-1
30 @(10)=1013,920,840,780,670,630,590,560,502,477,455,435,400,320,267,228
40 G0=G
50 G=GRADE(ANA(1),10,16)
60 IF G<>G0 WAIT 1 GOTO 40
70 IF G>=0 ?"KEY=[";G+1;"]"
80 GOTO 40
Time display (display the time when you press A button)
1 'トケイ
10 MATRIX ON
20 SETDATE 2018,1,16,12,0,0
30 IF !IN(BTNA) GOSUB "@ShowTime"
40 WAIT 200
50 GOTO 30
60 "@ShowTime"
70 GETTIME T1,T2,T3
80 MSG LEFT,80,#-2,T1;":";T2;":";T3;" "
90 RETURN
(new!) Browsing Misaki Font Data
1 '美咲フォントの利用
10 S="あ"
20 A=WADR(WASC(S))
30 FOR Y=0 TO 7
40 D=PEEK(A+Y)
50 FOR X=0 TO 7
60 IF D&($80>>X) ?"■"; ELSE ?"  ";
70 NEXT X
80 ?
90 NEXT Y
(new!) Character display with NeoPixcel (8×8 matrix type)
10 'NeoPixelで文字表示
20 SETFONT 0,$50,$A8,$88,$88,$70
30 MSG TOP,0,CHR$(0)
40 NPBEGIN 12,64
50 NPCLS
60 S="こんにちは☆さい玉":C0=RGB8(0,2,3)
70 FOR I=1 TO WLEN(S)
80 A=WADR(WASC(S,I))
90 FOR Y=0 TO 7
100 D=PEEK(A+Y)
110 FOR X=0 TO 7
120 IF D&($80>>X) C=C0 ELSE C=0
130 IF Y&1 POKE MEM+Y*8+X,C ELSE POKE MEM+Y*8+7-X,C
140 NEXT X
150 NEXT Y
160 NPPUT 0,MEM,64,1
170 WAIT 400
180 NEXT I
190 GOTO 70
(new!) LED Matrix Font Creation Tool (Created by Mr. Goeda)
1 'PCG EDIT
5 ATTR 0:COLOR 7
10 CLS:CLS 1:CLV:LET @(20)=79,42
20 FOR I=0 TO 4:FOR J=0 TO 4
30 LOCATE I,J:?CHR$(@(20));:NEXT J:NEXT I:GOSUB 500
40 K=INKEY()
50 X=X+(K=KRIGHT)*(X<4)-(K=KLEFT)*(X>0)
60 Y=Y+(K=KDOWN)*(Y<4)-(K=KUP)*(Y>0)
70 LOCATE X,Y:C=VPEEK(X,Y)
75 ATTR 2:?CHR$(C):LOCATE X,Y:WAIT 100:ATTR 0:?CHR$(C):LOCATE X,Y
80 IF K=32:IF C=@(20) P=@(21) ELSE IF C=@(21) P=@(20)
90 IF K<>32 GOTO 40
100 ?CHR$(P);
110 FOR I=0 TO 4:D=0
120 FOR J=0 TO 4:C=VPEEK(J,I)
130 IF C=@(21) D=D+(1<<(7-J))
140 NEXT J:@(I)=D
150 NEXT I
160 GOSUB 500:GOTO 40
500 LOCATE 0,10:?"SETFONT ASC(";CHR$(34,90,34,41);
510 FOR I=0 TO 4:?",$";HEX$(@(I),2);:NEXT I
520 SETFONT ASC("Z"),@(0),@(1),@(2),@(3),@(4)
530 MSG TOP,0,"Z"
540 RETURN

From then on is the original document

TOYOSHIKI Tiny BASIC for Arduino

The code tested in Arduino Uno R3. Use UART terminal, or temporarily use Arduino IDE serial monitor.

Operation example

> list 10 FOR I=2 TO -2 STEP -1; GOSUB 100; NEXT I 20 STOP 100 REM Subroutine 110 PRINT ABS(I); RETURN

OK >run 2 1 0 1 2

OK >

The grammar is the same as PALO ALTO TinyBASIC by Li-Chen Wang Except 3 point to show below.

(1) The contracted form of the description is invalid.

(2) Force abort key PALO ALTO TinyBASIC -> [Ctrl]+[C] TOYOSHIKI TinyBASIC -> [ESC] NOTE: Probably, there is no input means in serial monitor.

(3) Other some beyond my expectations.

(C)2012 Tetsuya Suzuki GNU General Public License

RCA Voyager III Tablet Mini Review

MVIMG_20190727_221225Tablets seem to be more of a commodity product than the revolutionary product they were a decade ago.  Indeed, it seems that everyone has a branded tablet and the company that owns the RCA name now also has a tablet: The RCA Voyager III. This tablet is powered by a quad core processor with a 1024 by 600 pixel display (IPS…boo) and runs Android 8.1. Oh, it’s $49.95 from Wal-Mart.  As of this writing, it was being sold as an impulse item in the ‘back to school’ section near the front of the store.  It’s bargain bin price reflects it bargain bin quality and performance.

The device has 16gb for storage, but is upgradable via MicroSD.  When installed, the SD card can either be formatted and made ‘internal’IMG_20190727_231620 to the device, which means no other device can read its contents OR you can use it as a separate storage for your own media.  That’s how I am using the 2 gb card I put in it.

Even though it is a fifty dollar tablet, it does have some things to like.  For example, out of the box setup was quick and easy.  As it runs Android 8.1 AND has the full Google suite, it has Google Play and, thus, a ton of software. As with my phones, the first thing I did was install Launcher 10 to add a more sensible shell in the guise of Windows Mobile 10.  Gotta have my tiles.

The tablet’s screen is responsive, touch wise.  Any lags are due to the slowness of the processor, I think.

Now, speaking of the screen, this leads me into what is not good about the device.

  • The screen is, simply put, awful.  It is fuzzy, low res and muted.
  • Performance is also mediocre.  Tapping an icon to start an app results in a few second delay followed by the app actually staring, if it can.
  • The feel of the device is, well, cheap.  It is all plastic. At least Kindles have a more ‘premium’ feel, well, compared to this, anyway.
  • The cameras are terrible.
  • Sound is tinny as hell.
  • Did I mention the cameras?
  • Battery life seems a tad lower than the advertised time of 6 hours.  It’s probably more like 4 to 5 with real world use.
  • And, perhaps, the worst thing of all: a proprietary power adapter. RCA eschewed the USB charging scheme for a small mini plug, like you would have found 15 years ago.  UGH.

MVIMG_20190727_231604

Now, in summary, don’t get me wrong: the tablet is not a great product on it’s own: you must keep in mind that it is cheap and, as such, does not make use of new tech or high quality parts.  BUT, keeping that cheapness in mind, it’s not a bad buy.  If you are out and about and need something a bit bigger than your phone, and you do not care about quality, this tablet won’t let you down.  It is adequate for light web surfing, listening to a podcast, simple games and checking that credit card balance. An Amazon Fire 7 may be a better buy, for the same price.  On second thought, the Fire 7 probably should be your first choice.  IF you cannot pick up a Fire 7 AND you have an immediate need for a crappy tablet, this thing is probably a good bet.  Perhaps.

UPDATE! – March, 2020

I am surprised and please to share that RCA has sent several over the air updates to firmware AND Android.  I am not yet sure about the updates, but, the tablet does seem a bit more responsive and stable.  Stay tuned, I will update with more.

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.

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.

Upgrading your car: replacing that old CD Player with a new touchscreen system with Bluetooth and more

AltimaHybridI have a 2007 Nissan Altima Hybrid. It is nothing fancy, and isn’t in the best shape. Oh, the body is in good shape, it needs a little TLC, like paint and other cosmetic fixes.  Creature comfort wise, though, it came with a workable CD/Radio, cruise, power seats and…that’s about it.  Well, I also have a 2007 Infiniti with a lot of bells and whistles.  So, I wanted some of that in my Nissan.  I set about to see what I could do.  I found out that there are A LOT of possibilities.  And, they don’t cost an arm and a leg.  So, I swam through a sea of similar head end units and found one for under $40 (US).  The unit has MP3 audio, SD and USB ports, plays a plethora of video formats, FM Radio, backup camera support, 7 inch, HD touch screen, Bluetooth and supports video in and out.  Wow. For forty bucks.  Well, in order to install this, you need an installation kit. So…I got one of them AND the correct wiring harness for the 2007 Altima with digital enviro controls.  The installation kit was twenty five dollars (US) and fits the car perfectly. 

The items arrived, days apart, of course.  I tested the headend and it appeared to be fully functional so I preassembled the installation kit and mounted the head in the kit.  I then soldered the harnesses so they would be ready.  20181023_201024

Installation was relatively easy…except, the head was about 5 mm too wide and, maybe one mm too high for the kit.  I was able to make it work by trimming the bezel and, since the kit is plastic, was able to slightly bend one bracket just enough to where the mounting holes lined up. The bezel that goes on the front had to be trimmed a bit for the knob.

received_328936107898619Installing the whole thing in the car was even easier.  Pop off the vent cover, pull off the bottom cover (just under the enviro controls and remove the two screws at the top and two at the bottom and pull the unit out.  You then have to remove the environ controls. There is one Torx screw on each side. Take them out, then bend the tabs up that hold it in the cage and pull it out. It snaps into the new cage. Screw the Torx screws back in and then connect all of the harnesses and the antenna.  Put the whole unit back in, screw in the four screws and then put the vent cover back.  Start the car and setup the unit.  Simple. It took me about thirty minutes.

Setup

Setup is fairly easy: tap the setup icon, set the language, FM Frequency, Video standard (NTSC or PAL) and set received_529731680832352the Boot logo if you want (enter 1983 on the keypad and look for your car manufacturer.) You can set the time by tapping on the clock and setting the date and time.  Its a bit cumbersome, but easy to do.

Pairing your phone is simple.  On your phone, look for GTB-KIT or something like CARKIT. You can import your phone book and phone log once paired.  It is the easiest pairing in a Bluetooth device I have seen.

The FM radio has three ‘banks’ of presets. You can let the device do it for you by pressing the PS button on the FM screen. You can then add or delete all you want.  NOTE: there is no AM radio on most of these cheap devices. Mine is the MP5-7023B and looks to be a clone of nearly all of the cheap head ends out there. The user interface, while looking OK, is not that easy to understand. Discoverability is not, apparently, a concern for the developers.

20181023_202611The MP3 player, photo viewer and movie player all require a USB stick or SD card, even though that is labelled ‘TF Card’. You need to create three folders: Music, Video and Photos.  Photos ONLY works with JPG files.  PNG and BMP(!) do not appear to work.  Video works with pretty much every codec and container out there. Music plays MP3, OGG, WAV and a few others.  Oh yeah, FLV video is supported.

I didn’t want the default non-Logo to display when the unit starts, I wanted the Nissan logo. Fortunately, in setup, there is a logo feature that allows you to pick one of couple of dozen or so manufacturer logos. Many are European or Asian and unfamiliar to me.  The Nissan logo was there, so I picked it.  To get to the page, go into setup, tap the Logo button and enter 1983. The page will display. Simply select the logo you want by tapping it.  Hit the Home button to save. Boom, done.

What I don’t like

The user interface is really wonky.  It is pleasant enough, with a kind of Windows 8 look for the home screen.  Lots of blue is used.  This is all fine, but, it is REALLY sluggish.  The touch screen is not very sensitive either.  In bright light, it washed out, big time.  The knob serves many purposes, but is mainly confusing. Not only can you turn it, like a real knob, but you can also push it in. It is context aware, but inconsistent.

The equalizer function works for all music playback, but is only available on screen if you are in the FM Radio app. 20181023_211917 Otherwise, you must press the knob, several times, to get to the very small icon for the EQ, then you turn the knob for one of four or so presets.  You cannot create your own sound, though.

The remote woks great, but, the buttons are difficult to press and you must be in line of sight with the IR receiver. And, why the remote? I would rather have had a steering wheel control.  However, the remote does make navigating the touch screen much easier.

Bluetooth works fine, but the music playback from your phone is not complete. All you get is Previous, Next, 20181023_201049Pause and Play. You get no info about what is playing or the album art. 

What I like

For the price, everything. This thing was forty bucks.  Yes, it is far from perfect and, likely, won’t last.  I am OK with that, as long as I can get six months or more.  I plan to get a nicer one with DVD and GPS, but, this will work in the interim.  Speaking of GPS, I am working on a DIY GPS that will utilize a Raspberry Pi and GPS module I got from Radio Shack, years ago, for my Arduino stuff. The MP5 has an external video input that I will use for the GPS.  I also have a backup camera I am going to install in the car. The unit supports this as well.

If you have an older vehicle that could use an upgrade like this, you can certainly do it on the cheap.  The thing to keep in mind, though, is the installation kit. More common cars, like the Altima, will probably have the kits readily available. Otherwise, you might have to get creative.   All in all, it is a worthy upgrade and didn’t break the bank or take hours to do.

20181023_194524

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.