OpenAccess 3.0 replacement software

This is the main, and possibly final entry on the open-access project I participated in.  I have linked all the previous parts of this series at the bottom and will add a link to this page at the bottom of those entries once it’s published.  The last state this was in before I gave up on ever using this project in production was to include a beaglebone white as the network connection with scripts for pushing and pulling data out of the arduino mega controller.  No part of this was ever successfully completed due in part to the rapidly aging support and documentation for the beaglebone white making it all but unusable as part of a modern project without a particular interest and knowledge of using it.  The OpenAccess 4.0 did exactly what we planned on doing, but with a pi.

early project revision (note incorrect voltage divider resistors)

In this entry I will be going over what is needed to operate this project in its most complete state.  The two files that are designed to work together are this one on the uart lcd and this one on the arduino mega.  The front panel controller was discussed in a previous article, the last one is what we’re here to discuss.

Here are some odd little functions in the code:

int freeRam(void)
{
extern int __bss_end;
extern int *__brkval;
int free_memory;
if((int)__brkval == 0) {
free_memory = ((int)&free_memory) – ((int)&__bss_end);
}
else {
free_memory = ((int)&free_memory) – ((int)__brkval);
}
return free_memory;
}

I had a serious problem with memory leaks, that function helped me find them.

char *ftoa(char *a, double f, int precision)
{
long p[] = {
0,10,100,1000,10000,100000,1000000,10000000,100000000 };

char *ret = a;
long heiltal = (long)f;
itoa(heiltal, a, 10);
while (*a != ‘\0’) a++;
*a++ = ‘.’;
long decimal = abs((long)((f – heiltal) * p[precision]));
itoa(decimal, a, 10);
return ret;
}

This function converts a float to a character array, I had so much trouble printing floats you have no idea…

// This gets set as the default handler, and gets called when no other command matches.
void unrecognized()
{
Serial.println(“What?”);
}

This is, well, it responds to unknown serial commands with this.

// reads battery voltage
void check_battery()
{
battery_start = millis();
float voltage = ((float)(analogRead(A15)*20)/1024.0);
if(voltage<voltage_threshold)
{
battery_dur = (1000*60*5); //set to 2 mins
logging(logDate());
logging(” – “);
loggingln(“battery voltage dropped below threshold”);
}
else
{
battery_dur = (1000*60*15); //set to 1 hour
}

char volt[8];
ftoa(volt,voltage,2);
//dtostrf(voltage,8,2,volt); should work?
printname = “Battery voltage: “;
printname += volt;

logging(logDate());
logging(” – “);
loggingln(printname);
}

That checks the battery voltage and is run on command or periodically (the period increases decreases as the battery drops in voltage).

//battery stuff
float voltage_threshold = 13.6; //threshold to throw an error at
unsigned long battery_start = 0; //used for count down timer
unsigned long battery_dur = (1000*60*15); //time between battery checks (fifteen minutes default)

Battery declaration stuff, sets when to check more often (and alarm) and the variables where the timer is stored.

I broke the rest of the code up into sub-articles.  They all link back here, and here’s the index of them:

Recommended reading: wiki for the project, this is my non-blog documentation of this project.

Other blog entries:

RS485 displays

4017 keypad and 74595 display

arduino uart display and keypad

wiegand keypad

RFID decoding info

dot matrix printer logger

main board hardware

Other links:

wiki from manufacturer

my code repository

my image repository (some schematics)

19 Responses to “OpenAccess 3.0 replacement software”

  1. OpenAccess Serial commands | Evan's Techie-Blog Says:

    […] Hacks, repairs, arcade games, sci-fi, and some very bad ideas with possibly humorous consequences « OpenAccess 3.0 replacement software […]

  2. OpenAccess I/O functions | Evan's Techie-Blog Says:

    […] The I/O may not seem important, but it’s there so why not use it.  This is part of the larger OpenAccess project. […]

  3. OpenAccess main logic | Evan's Techie-Blog Says:

    […] That’s the salient parts of the main code.  I hope that’s enough to get some of you started in the OpenAccess project. […]

  4. OpenAccess privlige functions | Evan's Techie-Blog Says:

    […] The evaluation of keypresses to get into and out of those modes will be discussed elsewhere.  This is part of the greater OpenAccess project. […]

  5. OpenAccess printer and log functions | Evan's Techie-Blog Says:

    […] This is a derivative of the dot matrix printer driver I used before and part of the OpenAccess project. […]

  6. OpenAccess temperature functions | Evan's Techie-Blog Says:

    […] That variable “current_temperature” is used nowhere else and need not be declared globally.  This is part of the greater OpenAccess project. […]

  7. OpenAccess RTC functions | Evan's Techie-Blog Says:

    […] That’s it, that’s what the RTC is for: timestamps on things. This is part of the greater OpenAccess project. […]

  8. OpenAccess RFID functions | Evan's Techie-Blog Says:

    […] This is part of the greater OpenAccess project. […]

  9. OpenAccess LCD functions | Evan's Techie-Blog Says:

    […] That’s my LCD functions, you can see that I compartmentalized it a lot so it is easy to change the protocol or library of your display. This is part of the greater OpenAccess project. […]

  10. OpenAccess Keypad functions | Evan's Techie-Blog Says:

    […] Clearing a pin is easy, set back to unprintable.  These steps are done in the key taking process which is longer and in the main logic code.  This is part of the greater OpenAccess project. […]

  11. OpenAccess Exit button/relay | Evan's Techie-Blog Says:

    […] That’s all there is to the exit button and exit relay code.  It can also be called like any other relay from the I/O section, but it operates on its own unlike the others.  This is part of the OpenAccess project. […]

  12. OpenAccess eeprom functions | Evan's Techie-Blog Says:

    […] This may seem like a lot, and you may not need much of it but I think it’s nice to have.  This is part of the OpenAccess project. […]

  13. Arduino to dot matrix printer | Evan's Techie-Blog Says:

    […] was implemented as an output for the future i3 Detroit rfid entry system, but can really be used anywhere 10 IO are free (or, if you want to be a little ironic, use a 74595 […]

  14. 4017 based keypad matrix scanner | Evan's Techie-Blog Says:

    […] was to be used in the OpenAccess system, but it was abandoned like lots of other […]

  15. RFID card ID formatting | Evan's Techie-Blog Says:

    […] to blog more, and I keep getting side-tracked.  There will be more regular updates after the Open Access Control 3.0 system is hacked together had installed at i3 Detroit, you can follow along with the updates as they are […]

  16. Arduino library for SCC 1080 displays | Evan's Techie-Blog Says:

    […] project was originally started as part of the i3 Detroit OpenAccess control system for RFID entry.  I promise I’ll write an entry on that soon, but I’ve got to shake […]

  17. Wiegand keypad | Evan's Techie-Blog Says:

    […] far with the OpenAccess system I’ve talked about the rs485 terminals I tried to use, a clever low pin count display and […]

  18. Arduino keypad and display | Evan's Techie-Blog Says:

    […] project was originally started as part of the i3 Detroit OpenAccess control system for RFID entry.  I promise I’ll write an entry on that soon, but I’ve got to shake down all […]

  19. OpenAccess 3.0 hardware quirks | Evan's Techie-Blog Says:

    […] sci-fi, and some very bad ideas with possibly humorous consequences « Wiegand keypad OpenAccess 3.0 replacement software […]

Leave a reply to OpenAccess RFID functions | Evan's Techie-Blog Cancel reply