Coding needed.

Discussion in 'Programmer's Corner' started by R!f@@, Nov 3, 2011.

  1. R!f@@

    Thread Starter AAC Fanatic!

    Apr 2, 2009
    8,754
    760
    OK Mark..

    Here is what I am talking about.

    This is a prototype offer I got to make. And I am sure about the pay too.
    I will post a schema once you finalized the PIC to be used.

    I will make the test circuit, you have to code the chip. Code needs to be via PM, But I will post the schema here, and the rest can be discussed openly.

    What it is will be left anonymous for the time being. I believe it will be a hit.

    Circuit details
    .

    Circuit will evolve as it progresses.
    The circuit consists of a PIC μC controller preferably with USB hardware for the near future.

    It should have display. It can be a LCD or 7 segs, can use which ever is easier to work with.

    Input is through 3 push buttons, which will be used daily. So we call this the 3 user inputs

    The circuit will work this way :
    When u press an input the program should identify which one from the three is pressed. Next it should prohibit the use of the other two inputs which ever that is from using for at least 10 seconds. After this delay the program should be ready to scan the keys again.

    Next is the press indication and can be stored in a memory in three registers.
    3 registers are for each switch. The register is updated respectively for consequent inputs. The register should store it in a non volatile memory for power failure reasons.
    The register will be counting the number of presses the three inputs are giving through out a time span of 1 month or longer if necessary.
    The count can be from 0 to 9999 counts.

    So in short the memory will have a graph or table of the number of times the user input has been pressed for a month or two.

    This count needs not to be displayed for the users.

    After the end of the month, a person in charge will be noting down the counts for whatever reason he needs it.
    He should be able to scan through the three input tables and should be able to see the count hit each user input has gone through. It should display the initiated date to the current date he is checking. Only he can reset the count registers after noting down the ended month details.

    To display the count details a 20 character by 2 row LCD can be used or 7 segs, which ever is easier.

    The person in charge controls will be hidden inside a locked console together with display. What is available will only be the three user inputs.

    You can determine how many keys the in charge will need to scan through the tables and reset it. A numeric keypad is preferable to pass code lock it prohibiting the use of unauthorized access to the tables completely. This will increase security.

    The USB interface is necessary if further advancement to display the chart in a PC program. But this can be done much later.

    One more important to note about the user keys is that they will be placed at around 20 to 40 feet away. So use of minimum no. wires going to the users is needed. Something like 2 line input for multiple keys, the voltage divider method.
    And yes a led out to indicate the key press needs to go to the user pad as an indication for the button pressed together with a buzzer.
    So I believe I will be going for the cat5 or 6 cable for the user pad. I need ur thought on this.

    Further more this thread is open for discussion on how to go about it.
     
    Last edited: Nov 3, 2011
  2. nerdegutta

    Moderator

    Dec 15, 2009
    2,517
    785
    Not really my business, but instead of USB, could it be RS-232?

    Interesting project! I'd like to follow this, if I may?:)
     
    R!f@@ likes this.
  3. t06afre

    AAC Fanatic!

    May 11, 2009
    5,939
    1,222
    This is an assignment Should not this be in the homework section.:p
    Ok joking asside. I think a LCD display will be most easy work with. You should also notify Mark if the input switches will be debounced or not. Or you two may decide in PM. Many 18F series PICs do have onboard USB controllers so that should be OK. But Using USB will require more programming on on both the PC side and the gizmo side. Compared to RS232. In some cases i find a key switch better than using a keypad. More rugged. But it is no golden rule on this.
     
  4. thatoneguy

    AAC Fanatic!

    Feb 19, 2009
    6,357
    718
    Those long wires will make good antennas for interference.

    PIC18F2455 would do it (18F4455 if you need more I/O), has USB and 256 bytes of EEPROM should be able to store the data, otherwise an off-chip SPI EEPROM of 1G could be used. Or an SD card slot could be provided that could simply be plugged into a computer for the data dump.

    Enclosure securely lockable?

    Sounds like a fun project!
     
  5. Markd77

    Senior Member

    Sep 7, 2009
    2,803
    594
    I'm still thinking about it, I have to go out for a bit.
    I've never used PICs with USB or LCD screens, but if you are happy with a 4 digit 7 segment LED and a few LEDs to show which count is being displayed, it would be something I could do.
    Displaying the date would be a pain, because it would need a real time clock, ways to set it, etc. Is that vital?
    Serial I can do, and serial to USB chips are available which should be fine for the tiny amount of data involved.
    CAT5 is 8 wires I think, so there is enough for ground, 3 LEDs, 3 switches and a buzzer.
     
    R!f@@ likes this.
  6. t06afre

    AAC Fanatic!

    May 11, 2009
    5,939
    1,222
    Oh did not see that. In that case I would have used a micro controller on the button box also. Then used RS485 style signaling to transfer data to the counter box
     
    R!f@@ likes this.
  7. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,394
    1,606
    I'd just start with a board that already has everything you need on it. It's going to be hard to get a custom PIC designed and assembled for under $100 so just buy one, say like this one.

    You get USB, and SD card, and a graphic touchscreen hence infinite buttons so there need be no lock and key for supervisor mode.

    If you really want to do a RS-232 for the remote buttons for $150 it comes on this model.
     
    R!f@@ likes this.
  8. R!f@@

    Thread Starter AAC Fanatic!

    Apr 2, 2009
    8,754
    760
    BRB.....got a babe. It's my birthday u know..nov 4th. bzy bzy...but will reply properly after a few hours. :D
     
  9. nerdegutta

    Moderator

    Dec 15, 2009
    2,517
    785
    Even with shielded twisted pair cable? Like this illustration:
    [​IMG]

    Isn't the shield supposed to protect it from interference?

    Congratulations on your birthday.
     
    R!f@@ likes this.
  10. Georacer

    Moderator

    Nov 25, 2009
    5,142
    1,266
    Hey, happy birthday Rifaa! Wish you the best (and a jar of clean water).
     
    R!f@@ likes this.
  11. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,394
    1,606
    I would think it would. Buttons are a very slow speed form of communication. You could also add significant (overkill) filtering to remove any induced noise.

    Of course, a long length of wire does increace your suceptability to lightning strikes.
     
  12. R!f@@

    Thread Starter AAC Fanatic!

    Apr 2, 2009
    8,754
    760
    Birthday was a blast but rather dramatic or sentimental in the end....wifey is crying for reasons unknown :confused:....oh well....tht's life ....now back to work.

    Of course Jens...you can throw in ur 50 bucks worth and I am not kiddin here. :D

    U little rascal, this is not home work and I am not in school. umm.!!. wait.. scratch the last part.
    U still are taking me for a dummy..of course debounce will be used ..DUH!!!
    But the 10 sec delay is to prohibit continues input from that user terminal.
    one rate per customer u know. No cheating.

    USB or serial I don't care...it can be chosen much much later or might even can be omitted it for now. But if omitted, PC recording will need major over haul ..NO..


    This is gonna be a blast the way I see it..it's really big. :cool: but hush hush....ingey..
    Any PIC can be chosen...sky's the limit. Any thing that is easy to work with.
    Enclosure will be locked. I asked for pass code due to the fact that u know teenagers.. so a pass code is advised.

    7 segs or graphic don't care. If you can display the count then it's good.
    Date part was a typo..no need for that. Just all the counts after the last reset.

    Serial and USB option are for later ...so leave it for now.

    Network cables should do.

    Nice....but it's not for this app. thanks though..I found them useful,

    Another Circuit design Idea


    I was too fast too clumsy..I explained it almost half way..oooops.

    The change :
    The user input is a terminal. A terminal has 3 switches and 3 led indicator and a buzzer. The terminal can be any where. So network cable is preferred for the inter connect. The terminal can be set up as a module with RC45 connector.
    I am thinking of using power and serial data from the terminal to be sent over to the recording console .. This way we can put the console any where and the terminal can be any where with in 100 feet.

    Terminal can be any number. For now I like to go for 10 terminals.

    So one unit can have, 1 main controller or recorder we can call it, which is key or pass code locked and has the display and admin control switches.
    And 10 terminals for user input.
    Terminals are connected with in 100 feet max by cat5 to the controller.

    Like I said now we have terminals and each terminal is identical with 3 switches and indicators.

    Now for the recording table.

    Date is not necessary.
    Table has to record every terminal data every day all day. A terminal table will have 3 columns of counter for each switch. Should be stored in memory, and should be able to recall and display all these tables at the controller.
    The Display need not be so many.

    We can use 3 display counts of 9999. One for each switch. The display table can be scrolled down when the admin needs to read the data. So a switch shall be used to scroll thru terminal no.s and the display will show the table content after every press of the switch. Scroll can have up/ down buttons.

    So main controller can have these switches

    Scroll UP
    Scroll DOWN
    ENTER
    DISPLAY

    Scroll will do what it says.
    Display can switch between counter reset command and table display command. Enter can be used to initiate the whatever should be executed.
    And then we can have 4X4 numeric keypad for pass code.
    I bet keyscan can be done.

    PS....I don't think is worth 100 bucks. More can come I think..


    OK..this is tough..I need ideas on how to make the terminal. Since now it has a pic for keyscan and to sent data.
    Now I don't think Mark alone is enuf for this. So who else is in. If I hit this. I promise you, you guys won't regret.

    I have attached a drawing of the basic Idea.
     
    Last edited: Nov 3, 2011
  13. thatoneguy

    AAC Fanatic!

    Feb 19, 2009
    6,357
    718
    Shielded twisted pair would work, if the shield is actually grounded, I've seen more where the braid was stripped away and the RJ45 jack was crimped onto a standard connector than actually grounded shields.

    RIFAA:
    These terminals, you say 10 of them, possibly more, each with 30+ feet of Shielded cat5 connecting them...

    Do they need to be addressed? I mean, button 1 pressed and released on MMDDYYYY@hh:mm:ss.s from terminal 7, or "button 1 pressed and released at a terminal on MMDDYYYYY@hh:mm:ss.s"

    PIC's also come with RealTime Clock peripherals, so this is still mostly on chip, unless he wants the SD card 2G storage option.
     
  14. MrChips

    Moderator

    Oct 2, 2009
    12,449
    3,364
    I have done numerous industrial designs so I will give you my input

    You have to care. Let the application dictate the appearance.
    Either way is easy. I have done large 7 seg LED for high visibility. Also large back-Lit LCD for sexy look. All with single-wire interface. For flexability, use 16x2 or 20x2 LCD character display (or any desirable format). Interface can be easy one-wire or 2-wire.
    Sounds like for the main controller, use multi-line character LCD. You can use parallel interface but I would go with simpler serial interface.

    For terminal communication, use RS-485 - industry standard, robust. Cable can be 4-wire or RJ-45 or CAT-5, whatever.

    You have to care. You have to decide now. You cannot put it off. A lot of chips come with USB. If you need it in the future, design it in NOW.

    Switches, buttons, keypads do not need hardware debounce. All debounce can be done in software.

    10 terminals or 100 terminals don't matter. You can design an addressable network using RS-485.

    Each terminal has 3 buttons, 3 LEDs and a buzzer. Is that it? No more. Otherwise design for upgrades. Maybe LCD and keypad?

    Think modular. This gives you flexibility so that you can change one part of the system without having to redesign the whole thing. I have done extensive designs with RS-485 networked systems.

    I have done apps where the main controller is a Palm Pilot PDA. You can do the same today with almost any handheld device. Even the terminal can be an iPhone or iPod etc., maybe even go wireless.
     
    Last edited: Nov 4, 2011
  15. R!f@@

    Thread Starter AAC Fanatic!

    Apr 2, 2009
    8,754
    760
    Shielding is necessary..
    OK..what option do I have for long connectivity...

    Possibly...

    Definitely not....just memorize the key pressed after every ten second till reset.

    Won't a 24C memory suffice to store the data. It will be cleared every month. For safe keeping I want an additional month in memory
     
  16. R!f@@

    Thread Starter AAC Fanatic!

    Apr 2, 2009
    8,754
    760
    So MrChips.
    Can you guide me how I should go about this.

    7 seg or LCD does not matter really. I need this to be some what up to my knowledge. U know.....I will be the one banging my head if anything goes wrong and non of you is around...

    As for USB or serial, I dunno..I haven't done this sorta thing. What ever is feasible is A OK.

    The terminals is final. Nothing will be added later. The terminal needs to be anonymous to the user. He can only see figures. Once pressed. A light and a beep to acknowledge.
     
  17. MrChips

    Moderator

    Oct 2, 2009
    12,449
    3,364
    I gather that you are a hardware person. Systems are much more flexible, easier to design and build, cheaper and sometimes more reliable with today's MCU. As I see it, you have two choices, get yourself up to steam so that you can understand what is going on, or trust other people to do it for you. The key is system design. Design from the top down. Make it flexible so that you can change your design as the requirements change. How robust it is depends on how well it is designed in the first place. You can design in diagnostics so that the system will tell you where is the fault. To repair the system, you will swap out modules, not change chips on the board.
     
  18. R!f@@

    Thread Starter AAC Fanatic!

    Apr 2, 2009
    8,754
    760
    OOOh boy. !!!

    This is freakin Maldives I am in....we have wealthy homo's who are greedier than a <oooops>

    No need to be so advance. Here what ever goes u know.
    But I rather not do what ever.
    Tell me something about my idea. I think I will go with that. To do this modular is not necessary the way I see it....this is something u will find after a year or so ...count on it.

    This is what it is and how it is..my main concern is the terminal and control communication. I haven't done this kinda thing.

    I need some basic steps to start with.
     
  19. MrChips

    Moderator

    Oct 2, 2009
    12,449
    3,364
    Ok. I think you've disclosed enough as it is. You have to make a choice of either this being an open AAC project in the public domain or you retain IP ownership and close this from the public. The benefit of the former is that others can learn from the design process. If you want to go the latter route, you can set up a private site and then invite selected members to help you with this, of course after having such members sign a non-disclosure agreement.
     
  20. R!f@@

    Thread Starter AAC Fanatic!

    Apr 2, 2009
    8,754
    760
    HUH !!!!! :confused:
    What's with the attitude?
     
Loading...