Push button status logging

Status
Not open for further replies.
Did I miss something?
I thought about that, but PWM-out to create an analog voltage level might be a problem.
If you use a PIC you just use the internal pull up resistors and 5 switches bringing each respective port to ground when pushed, you take a reading once every minute and write the 5 bits status to the PIC's flash. When you are done you just read the PIC's flash.

Mike
 
Last edited:
Hi Lilimike the PIC sounds like a good idea. I dont know anything about PIC's (i am an old timer) so I will have do get learning! Is their one you could reccomend?
Mike
 
For your needs you have a wide choice, I used a 16F628A in many projects but if you are starting with PICs you will need a programmer so I would suggest you buy a PICKIT2 debug express it comes with a few lessons and examples and a development board with a 16F887 and you can probably do your complete project with this board. Microchip provides a development software to program in assembly but the learning curve is quite steep specially if you are a PIC beginner. There are a few basic programming software available and some are free but I have been using Pic Basic Pro which makes everything very simple. I am sure after using one PIC for one project it will open ideas for lots more projects.


EDIT: I forgot to mention Nigel has a really good

Mike
 
Last edited:
Like Mike said, read the button, store the value, output that value as a voltage level for >1 minute, and then zero.

I'm going to recommend a PICAXE microcontroller.

1. Originally intended for Elementary and High School classes (think easy)
2. Free software and manuals
3. Programming hardware is 2 resistors, 5V power (batteries or wall wart), and a three-wire serial cable
4. Programming language is BASIC
5. Very helpful and civil Forums
6. Variety of chips from 8-pin (~$3.50) to 40pin (~$10)

Down side is they are slower than PICs with compiled programs (not important to you), and more expensive (if you don't count the PIC's programmer).

The PICAXE 14M would do the job. 5 inputs, for your pushbuttons. 6 outputs. Use one output for a PWM digital-to-analog conversion, if you went that route. Or, use 5 outputs, if you want to go with an R-2R ladder digital-to-analog conversion (my preference...but that's just me ).

PICAXE 14M: **broken link removed**

R-2R network: RGSD10L503G Murata Resistor Networks & Arrays

Ken
 
Last edited:
Actually, forget the R-2R network. Just 6 resistors and 5 diodes for the D-A conversion....five OR'd voltage dividers.

ken
 
Here's the hardware. I don't have a Picaxe 14M to work out the programming.

Ken
 

Attachments

  • Picaxe5SwitchToDAC.gif
    42.2 KB · Views: 152
Last edited:
Wow that was fast a few silly q's how do you upload pics ?? i am new to this site and we don't have help files.. The pic icon looks for a url so how did you create this drawing and upload it?? sorry I know it has nothing to do with my 5 buttons but I like to know. This circuit looks good if i want to use my original datalogger, but is lilimike idea good in that the overall size is smaller?? size matters;-} what I wil do tomorrow is outline the 3/4 sections/circuits of the overall project and seek your advice. I think its a fun project. its also important as it is a clinical trial.

Mike
 
I believe Ken's solution is simpler because the final output interface is provided by the EL-USB-3.
Using a PIC you could store data on the PIC using 5 ports) and then read it by sending the data (using one port) to your computer's serial port.
You could also get a PIC with USB integrated but then the learning curve is steeper.

I guess it is for you to decide if you want to spend more time or more money.

Mike
 
Mikesshed,
The schematic was drawn with ExpressPCB, a free program for schematic and printed circuit board development. The schematic was exported as a .BMP image in ExperssPCB, cropped and exported to a .GIF image in Microsoft Office Picture Manager. It was then uploaded by using the "Go Advance" > "Attachments" in the Reply.

I'll be interested in hearing more about the project.

Ken
 
Thanks Ken & Mike for your ideas, I owe you a pint next time u are in Ireland. As well as the hand held device to record bodily functions I have a tilt switch and logger on the leg for standing/siting another tilt switch and logger on the side for standing/lying and a string pot and logger to measure waist. I dont want wires as they get snaged. So the units on the body need to be small as possible do u think I could get smaller than usb logger I am thinking of using?

Mike
 
I have a tilt switch and logger on the leg for standing/siting another tilt switch and logger on the side for standing/lying and a string pot and logger to measure waist.
This would imply that if you are lying both (leg and side switches) will be on?
You were first talking about 5 switches as input, is this a different project than the one you started in this thread?

I dont want wires as they get snaged. So the units on the body need to be small as possible
Do you need all units to be synchronized?

So the units on the body need to be small as possible do u think I could get smaller than usb logger I am thinking of using?
I think the units can be as small as its battery + the PICAXE and a couple of SMT components. I have no experience with PICAXE and I just looked it up and it is a regular PIC with a bootstrap version. I would think you could drop the resistors at the input and use the pull-ups and drop the diodes/resistors at the outputs and use one port to upload the data on a serial port, this implies you have enough memory to store 720 bytes of information and I believe you can accomplish this with a PICAXE-28X2.

Mike
 
Last edited:
Have just put this together for the picaxe circuit what do you think? The simulation works if u hold down the function key for half a second.

Mike
 

Attachments

  • Switchx5.bas
    876 bytes · Views: 142
Remember that the simulation is running at an incredibly slow speed. Go to Options>Simulation>Simulation Delay and slide the bar to the left (20mSec delay). In real operation it will react immediately. You don't need to set the input high. You detect the button, set a corresponding output high, GOTO a 1+ minute delay, clear the outputs, and return to continue the scan.

Though...I like your use of a pin as an input and output. I'll have to think about the hardware side of that.

I'm on vacation with my wife...so I can't spend a lot of time in this.

Ken
 
I just had a realization on the PICAXE 14M. The outputs are open-collector darlingtons, not totem-pole, source/sink. That means my circuit will not work as drawn. The programming will be much the same, but I will redo the output side as I have time. Darn vacations!

Ken
 
I'm on vacation with my wife...so I can't spend a lot of time in this.

Ken

My wife has sort of issues when I pack the laptop as we go on vacations. But hey, I need to load the pictures we take and work the images in the evenings, other than other things.

You are a hell of a trooper Ken.

Ron
 
Barb wasn't feeling well this morning, so I'm letting her sleep.

I played with the programming and came up with this, for my circuit.

I was also thinking about selecting more than one button at a time. Since it's almost impossible to push two switches at "exactly" the same time and the scan is very fast, the first pushed will be locked in.

This should work.

Ken
 

Attachments

  • Switchx5toDAC.bas
    725 bytes · Views: 135
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…