School Crossings

mushroom

New Member
PROJECT PURPOSE
I work for a small company. (under 10 workers).
We often are contracted to install flashing pedestrian crossings, called wombat, koala or school xings. That's always on,
daytime on, or on before and after school / lunchtime using timeclocks. There are also short term temporary crossings for
public events. Existing methods involve deep burying of conduits accross roads, crossing piped infrastucture such as gas,
water, electrical, fiber optics etc. These road xing are risky and time consuming. I'm examining other options. I'm
initially focusing on school xings. Existing systems run on 240 VAC or 42 VAC. I'm designing a 12 VDC system powered by a
very large gell battery at each pole, charged via solar panel or mains. (I'm experienced with using solar charging through
installing remote people and veihcle counters in National Parks from deserts to snow mountains). Communication between
poles would be via a radio link. I'm not a 'company man'. I'm interested in time paid knowlege expansion for self for my
out of work projects, smart house and other things. Unfortunatly I'm seriously chalenged with programing.

PROJECT TO DATE
I'm developing on 'universal' boards I've designed. One with a 20X2 chip, another with 40X2, and another with 8 mosphets for
switching, with on board LEDS and screw connecters. Boards work well. Blanks made in China. I'll post pics of boards soon.
I aim to ultimately make purpose built boards containing everything on board except the radio modules. The setup will be a
Master / Slave setup, one pole being the master. Currently I have two boards talking via a 2.4 GHz NRF24L01 radio link
flashing their lanterns in sink.

NEXT STAGE
I have bought Sparkfun DeadOn Ds3234 real time clock modules for date, day and time of day switching of crossings, chosen
for their accuracy, PCI bus, and all on chip design. (including Crystal). I've had trouble finding posts on these modules.
Any help here would be appreciated. I am about to attempt programming to use these with data sheets and posts I've seen.
Expect to see posts as I encounter enevitable problems.
My thoughts are also with storage of dates for activations. Thinking of Using SD cards with a 'times' chart loaded from a
computer for ease of change. Have thought of sparkfun OpenLog modules. I've vague memories of hearing that it's possible
to use them to retrieve data, and not just log. Does anyone know, or have an alternative SD card module to suggest, or are
SD cards 'too hard'.
I'm hoping this project to be of interest to people with benificial elements for the community, so as to stimulate
discussion. What do you think??
 

erco

Senior Member
Sounds great and useful, and potentially a liability nightmare from what I know about US laws. I have lots of thoughts about intelligent traffic lights and such, but it would be a nightmare to run the gauntlet of approvals just to start. Good luck and I hope you find a receptive audience in your country.
 

mushroom

New Member
Erco. You are right about liability nightmare, however much of our work is contracted from the government department in control of traffic, who thoughly test equipement to be used, and once approved is their risk. I already have an 'approved' flasher in current school xings I designed several years ago that we sell around Australia, and all control boxes we buy for use in our xing installations have my flasher inside when we recieve them. The government department buy them and the traffic lanterns off us. They have got wind of what I'm researching, and are pushing us to continue and produce a result, as they also see varied application of these radio controlled signals saving time and increasing safety where current major roads projects require existing intersections to remain continually opperational as new road works and signals are installed. (temperary poles).
Worth mentioning I am not in the US. I live Downunder, Downunder. (that's South Australia).
 

David HK

New Member
This is a first class idea and should be developed as far as possible.

I am now in my mid 60's and if I had time over again I would exploit two further ideas:-

Road side lighting poles/standards -- use these long term standing items to host autonomous transmitters to send speed limit information to a receiver in any vehicle - could be audio noise, speech defined, or LED display. Would have to be developed with smart car manufacture. Will happen one day.

The bathroom tap is either on or at various degrees of flow. The time is ripe to develop speech demand for control of water flow for Mum, Dad, Children 1,2,3,4,5 etc, selection - for brushing teeth, shaving and so on. If only I had the time.

David



Mushroom, do not stop you're onto a winner.

If this post is out of kilter, please delete it.
 

hippy

Technical Support
Staff member
My thoughts are also with storage of dates for activations. Thinking of Using SD cards with a 'times' chart loaded from a computer for ease of change. Have thought of sparkfun OpenLog modules. I've vague memories of hearing that it's possible to use them to retrieve data, and not just log. Does anyone know, or have an alternative SD card module to suggest, or are
SD cards 'too hard'.
Any complexity of dealing with SD Cards will be handled by the interface module which should provide a simpler, easier to use, interface for the PICAXE to use.

Whether SD cards are the best or most appropriate means of storage or for programming rather depends on what information is to be held. It seems to me there might be a lot less data necessary than one might initially imagine.

I would doubt there is really a need to store a year's worth of data ( as suggested in the other thread ) and could be a lot less such as data just for weekdays and weekend which is repeated ad-infinitum, with a list of known holidays or exceptions. The PICAXE will be able to calculate date, day of week, and adjust DST.

It might be possible to simply use internal Data Eeprom storage and have that programmed via serial by plugging a laptop in to it.

Bottom line is; yes, OpenLog or something similar should work, but it is well worth defining what your actual requirements are before deciding how best to do it.
 

mushroom

New Member
Sorry for the delay. We've had a disaster with one of our work colleges. (not at work). Our work force has reduced to 8
people.

PROJECT UPDATE:- First Thanks for all your comments. David HK, yes there are many great ideas in community heads that
may not progress beyound an idea. Wouldn't it be great if we had a 'Brain Storming' forum slot where good ideas expressed
could be developed and not lost. Manuka, Post read. We do have many '25km when children present'signs now in SA. Could
easily trap good drivers. A bad concept. Hippy, your comments are gems, as always. I'm prone to finding complex solutions
for problems, without pursuing obvious simplification. When I post self written code this will become evident.

I've altered a program posted by 'Simmicht' on using a DS3234 RTC with a 28x2. It now works with a 20X2 chip and gives me
time and temperature on the terminal program. Time is only base time and counting from when I inserted the battery. I'm
looking at time setting and 'exclusion times' storage today. Time setting ideas would be appriciated. Some useful info
has been posted by 'Marks' on use of DS3231 RTC. It's a Hi2C chip, not SPI bus, however full of useful ideas. In
Simmicht's program he comments at a point of hitting F5 on his computer to load computer time to the RTC. Does anyone have
an explanation for this?
Any comments on reading and writting to the time clocks 256 bytes of battery backed SRAM?

Below is working code for ds3234 RTC using a 20X2 chip. It's not tidied yet. Just had pin changes to suit the chip and
had some code commented out that didn't apply. Hope it's useful to some. Improved versions to come.

Code:
#PICAXE 20X2
#terminal 19200
#no_data
#no_table




SYMBOL StdFreq = M16         
setfreq StdFreq    


SYMBOL abyte      =         B55   ' W27    
SYMBOL aWord    =        W27

SYMBOL SS =            B10
SYMBOL NN =            B11
SYMBOL HH =            B12
SYMBOL DOW =        B13
SYMBOL DD =            B14
SYMBOL MM =            B15
SYMBOL YY =            B16
SYMBOL T    =        B17
SYMBOL TF    =        B18


'===-[ DS3234 RTC Pins ]-========================================
symbol CS_RTC  =             B.2    ' DS3234 RTC chip select
'symbol SData  =             C.5    ' MAX7219 serial data
'[symbol CS1   =             B.2    ' MAX7219 chip select
'symbol CS2    =             B.6    ' MAX7219 chip select
'symbol CS3    =             B.7    ' MAX7219 chip select

SYMBOL MOSI    =             C.1    ' Pin  9 hspi sdO   to MOSI
SYMBOL MISO    =             pinB.5 ' Pin 13 hspi sdI   to MISO
SYMBOL CLK     =             B.7    ' Pin 11 hspi sck   to SCK
    
'-------------------------------------------------
'Variable
Symbol     _Tmp_1         = b0
Symbol     _Tmp_2         = b1
Symbol     _Tmp_Data_Snd     = b2
Symbol     _Tmp_Data_Rcv     = b3
Symbol     _TMP_bit         = b4 ' MISO Bit Value
Symbol     _Register_Name     = b5 ' Register Name
Symbol     _Register_Value_W = W3 ' Register Value as WORD
Symbol     _Register_Value_L = b6 ' Register Value LSB
Symbol     _Register_Value_M = b7 ' Register Value MSB


'set HIGH  CS pin
HIGH CS_RTC





Test1:

_Register_Name=0x81
_Register_Value_L=0x30

'LOW CS_RTC
'SHIFTOUT CLK,SDATA,1,(maxreg,maxdata)
'HIGH CS_RTC



'TRY TO SET the MINUTES to 0 just to see if i can set something
'HIT F5 about 14 seconds before the time you wish to set (on my PC)

SS = 0x30                        'Seconds in BCD
NN = 0x48                        'MINUTES IN BCD
HH = 0x15                        'HOUR       IN BCD    
DOW= 0x03                        'Day of week 1 to 7
DD = 0x07                        'Date of month in BCD
MM = 0x06                        'Month of year in BCD
YY = 0x11                        'YY of the year in BCD


LOW CS_RTC
_Tmp_Data_Snd=0x80
gosub Snd_Rcv
_Tmp_Data_Snd=SS
gosub Snd_Rcv
_Tmp_Data_Snd=NN
gosub Snd_Rcv
_Tmp_Data_Snd=HH
gosub Snd_Rcv
_Tmp_Data_Snd=DOW
gosub Snd_Rcv
_Tmp_Data_Snd=DD
gosub Snd_Rcv
_Tmp_Data_Snd=MM
gosub Snd_Rcv
_Tmp_Data_Snd=YY
gosub Snd_Rcv

HIGH CS_RTC




do




'Read from Temperure registers
    _Register_Name=0x11                'Send start register to read from
    _Register_Value_L=0x00

    LOW CS_RTC
    _Tmp_Data_Snd=_Register_Name
    gosub Snd_Rcv
    _Tmp_Data_Snd=0
    gosub Snd_Rcv:T  =_TMP_Data_Rcv        'Read Temp
    gosub Snd_Rcv:TF =_TMP_Data_Rcv        'Read fraction of degree
    HIGH CS_RTC

'    sertxd(" tempMSB reg 0x0E =",#T)
'    sertxd(" LSB reg 0x0E =",#TF)
    SerTxd(" TEMP = ")                'Display the temperature
    aWord=T
    GoSub SerTxdWriteWord00
    SerTxd(".")                        'And the decimal part of the temp 0.25 deg res
    TF=TF>>6                        'shift from bits 7 and 6 to bits 1 and 0
    TF=TF*25                        'Scale it
    aWord=TF                        
    GoSub SerTxdWriteWord00
    SerTxd("C",cr,lf)





    'READ Time and DATE
    _Register_Name=0x00
    _Register_Value_L=0

    LOW CS_RTC
    _Tmp_Data_Snd=_Register_Name            'Send register to start readign from
    gosub Snd_Rcv
    _Tmp_Data_Snd=0


    gosub Snd_Rcv:SS =_TMP_Data_Rcv        'multibyte reads
    gosub Snd_Rcv:NN =_TMP_Data_Rcv
    gosub Snd_Rcv:HH =_TMP_Data_Rcv
    gosub Snd_Rcv:DOW =_TMP_Data_Rcv
    gosub Snd_Rcv:DD =_TMP_Data_Rcv
    gosub Snd_Rcv:MM =_TMP_Data_Rcv
    gosub Snd_Rcv:YY =_TMP_Data_Rcv

    HIGH CS_RTC

    SS = BCDTOBIN SS                    'Bit of converson of BCD to Decimal
    NN = BCDTOBIN NN
    HH = BCDTOBIN HH

    DD = BCDTOBIN DD                    'Bit of converson of BCD to Decimal
    MM = BCDTOBIN MM
    YY = BCDTOBIN YY


                            'write out the values    
    'sertxd(#SS,":",#NN,":",#HH,cr,lf)
    aWord=HH
    GoSub SerTxdWriteWord00
    sertxd(":")
    Aword= NN
    GoSub    SerTxdWriteWord00
    sertxd(":")
    aWord=SS
    GoSub SerTxdWriteWord00
    sertxd(" ",#DOW," ")

    aWord=DD
    GoSub SerTxdWriteWord00
    sertxd("/")
    aWord=MM
    GoSub SerTxdWriteWord00
    sertxd("/")
    aWord=YY
    GoSub SerTxdWriteWord00
    Sertxd(cr,lf)


    pause 2000
loop







'=======================================================
Snd_Rcv:
' Send Receive Data With Spi Clock
For _Tmp_2=1 to 8 ' 8 bit Frame
    LOW CLK
'Send Data MOSI ------------------------------------
    _Tmp_1=128
    _TMP_bit=_Tmp_Data_Snd & _Tmp_1
    _Tmp_Data_Snd=_Tmp_Data_Snd<<1

    IF _TMP_bit = 128 then
        HIGH MOSI
    Else
        LOW MOSI
    Endif
'Receve Data MISO ------------------------------------
    High CLK
    _Tmp_Data_Rcv=_Tmp_Data_Rcv<<1

    IF MISO = 1 then            'MOSI
        _Tmp_Data_Rcv=_Tmp_Data_Rcv+1
    Endif
Next _Tmp_2 ' Next Bit of Frame

RETURN







'=======================================================
'Pad to left with 0
SerTxdWriteWord00000:
B0= aWord / 10000
B0 = B0 + 48
SerTxd (B0)                 ; output 10 thousands value data

SerTxdWriteWord0000:
aWord = aWord //10000
B0= aWord / 1000
B0 = B0 + 48
SerTxd (B0)                 ; output Thousands value data

SerTxdWriteWord000:
aWord = aWord //1000
B0= aWord / 100
B0 = B0 + 48
SerTxd (B0)                 ; output Hundreds value data

SerTxdWriteWord00:
aWord = aWord //100
B0= aWord / 10
B0 = B0 + 48
SerTxd (B0)                 ; output Tens value data

SerTxdWriteWord0:
aWord = aWord //10
B0= aWord
B0 = B0 + 48
SerTxd (B0)                 ; output units data
RETURN
Sorry for my posts formatting errors above. Lesson learnt. Will not copy and paste from notepad again.
 
Top