Snap Circuits - PICAXE Project to Reprogram M8 Fan Phrases

I have been introduced to the PICAXE microcontroller via the use of Snap Circuits kits, whilst trying to learn more about electronics and coding. This project was an attempt to learn a little more about coding with PICAXE by setting a fairly simple task with a specific goal in mind. To reprogram the phrase set, in the Snap Circuits ‘6SCM8 Programmable Fan’ with a little automation.

The fan has five terminals, two for power and, 3 for programming. It comes from The Snap Circuits Arcade kit (SCA-200) which also contains the ‘6SCU29 LED Display and Microcontroller’. The microcontroller happens to be a PICAXE 08M2, which has just enough inputs/outputs for this idea.
You can download the manual from the Elenco website but it’s probably quicker to use google and search for ‘SCA-200 Manual’. From this manual, Project 15 details how to create a basic circuit to use and program the fan by hand and, instructions on the sequences required to program.

The character set used in my code only includes the capital letters of the alphabet and not all numbers and special characters that the fan can use. This is in part to simplify the code as there no simple conversion from ASCII characters to those used in the fan’s character set.
Before any coding could take place a method to interface the fan to the microcontroller was required. The ‘MODE’, ‘UP’ & ‘DOWN’ fan buttons connect the internal circuit to ground. My first attempt was to connect the U29 module to the fan inputs directly and keep all required pins high until a button press was needed. This did not work. The fan would not respond if any more than one button at a time was connected with this method, hence the addition of the diodes between the U29 outputs and the M8 inputs. I do not fully understand why but all works with the diodes in place. Three connections are required to program but an output was needed to switch the fan on and off, to reset all phrases to “ ” and ensure a datum point.

Once the circuit was made, and confirmed to work, the programming could begin. The fan buttons do have an auto-repeat function but it is not possible to set the characters using time (press and hold for so long to get a specific character), so separate pulses are required for each button press. The delays used are quite long, but shortening them, between the button presses and releases, causes the fan programming to become unreliable. This means that, even with this automated process, there is a significant time required to program all six phrases.

This project is likely to have more entertainment value than practical but, I have found it useful for setting a goal and, hopefully, moving beyond just following example programs.

Reference

Google search
LED-MC-info.pdf for information on the internal structure for U29
SCA-200 Manual.pdf for Snap Circuits Arcade Project Book

Code:
'M8 Programmable Fan Program to re-enter the default phrases'
'Changed code to use text instead of ASCII values
'Error checks to ensure only space / upper case characters are used
'The M8 fan has a larger character set but it's not compatible with ASCII codes
'USE ONLY CAPITAL LETTERS AND SPACES 
'Code works with U21 & U29 uProcessors

#picaxe 08M2
'bytes 420 of 2048
#no_data


disconnect        ;***Start program download  before powering m/c!***
let dirsC = %00010111      ;C.0, C.1, C.2 & C.4 set to output
    

symbol upbtn = C.1
symbol modebtn = C.2
symbol fanswitch = C.0
symbol nextbtn = C.4
symbol shrtpause = 140
symbol medpause = 2000
symbol lngpause = 4000

symbol btnPress = b0    'to help with debug
symbol charNum = b1
symbol charPosNum = b2
symbol phraseNum = b3
symbol charAscii = b4

setint %00000000, %00001000

high modebtn
high upbtn
high fanswitch
high nextbtn


Main:

pause 2500

low nextbtn        'show next phrase if no button is pressed before 2500 ms @ 
pause shrtpause
high nextbtn
goto main
end

interrupt:
    gosub setphrases
    setint %00000000, %00001000
    return

setphrases:

low upbtn        'reset all phrases
pause lngpause
high upbtn
pause medpause    'switch fan off to finalize reset
low fanswitch
pause lngpause
high fanswitch
pause medpause

gosub setpmode

snap:            'six phrases to program six alternate phrases 

select phraseNum
case 0 lookup charPosNum,(" SNAP CIRCUITS "),charNum ; put ASCII char into b1
case 1 lookup charPosNum,("     ARCADE    "),charNum
case 2 lookup charPosNum,("   BY ELENCO   "),charNum
case 3 lookup charPosNum,(" LEARN BY DOING"),charNum
case 4 lookup charPosNum,("FUN ELECTRONICS"),charNum
case 5 lookup charPosNum,("  YOUR PHRASE  "),charNum
endselect

gosub chkchar
if charPosNum < 15 then snap ; loop

if charPosNum = 15 and phraseNum = 5 then
gosub setpmode 
else gosub nextphase
end if

inc phraseNum

if phraseNum < 6 then snap

return    

chkchar:                ;check capitals or space characters only
    inc charPosNum        ;increment position
    charAscii = charNum    ;hold ASCII value for Debug
    select charNum
    case 32 charNum = 0
    case 64 to 91 charNum = charNum - 64
    else charNum = 27        ;use '*' for any other character
    endselect
    gosub setletter
    return

nextphase:            'move to next phase
    gosub setpmode
    low nextbtn
    pause shrtpause
    high nextbtn
    pause shrtpause
    gosub setpmode
    return

movefwd:            'move Forward
    low modebtn
    pause shrtpause
    high modebtn
    pause shrtpause
    return

setletter:            'program fan for spaces / letters
    if charNum = 0 then
    gosub movefwd
    else
    for btnPress = 1 to charNum
    low upbtn
    pause shrtpause
    high upbtn
    pause shrtpause
    next 
    pause shrtpause
    gosub movefwd
    endif
    return
    
setpmode:            'enter / exit Programming Mode
    low modebtn
;    pause medpause
    pause medpause
    high modebtn
    pause medpause
    charPosNum = 0
    return
Snapshot_3 - Compressed.jpg

https://youtu.be/RvvTJTYCCNo
 

hippy

Technical Support
Staff member
That's an interesting project. I was a little confused by "fan" having not heard of it but seeing it's a dual 'fan" and "spinning bar with LED's on", creating a Persistence of Vision display, it all made sense.
 
Err… Yep. P.o.V.

It wasn’t until I tried to describe the project that I realized a photo wouldn’t be enough and decided to make a video. I’ve never made a video like this before so quite a steep learning curve, to make and edit the video. Then, start a YouTube account and upload the video.

The video becomes an important part of the post / description for this project but using the term ‘Persistence of Vision’ would have made the description better.

Thanks hippy, for feedback
 
Top