Author Topic: Win XP PRO SP3 as external event logger  (Read 3625 times)

0 Members and 1 Guest are viewing this topic.

Offline Flenser

  • Regular Contributor
  • *
  • Posts: 60
Re: Win XP PRO SP3 as external event logger
« Reply #25 on: January 18, 2019, 04:28:49 am »
soldar,

You said:
Quote
I did this some forty years ago with a 6502 development system called AIM 65
You were using a microcomputer chip that had instructions for reading an 8-bit digital port and a built in hardware serial port. If you were sending a timestamp then it also had a clock and you knew, or learnt, how to program in assembler.

Today I imagine that most people who already have some experience coding in C or assembler for a microcontoller would probably use it to do your project.
  • These microcontrollers have instructions for reading an 8- bit digital port
  • All but the smallest ones have hardware UARTs that can be simply connected to PCs to communicate over serial using USB-to-serial cables
  • These chips cost a frew $
  • These people already own a programmer.

People who don't have experience using microctontrollers directly but do have experience using Arduino or Raspberry Pi would likely use them to do your project for almost exactly the same reasons.

If you are at all considering checking out Arduino then I recommend that you don't be put off by the learning curve and give it a try.
  • The Arduino software envionrment sets everything up for you, including the base code for a program that consists of an endless main loop. i.e. for a simple program you start by adding your code into this loop
  • There are a _lot_ of people using them. This means there are a lot of people who can answer any of your questions in Forums
  • This also means that there are a lot of code and project examples on the web that you can take advantage of cut-and-paste into your arduino sketch
  • The hardware is very cheap. Especially the clone boards coming out of China. Search ebay for "Arduino Nano" to see what I mean. Under US$3 with free shipping so it's really cheap to try out
  • You don't need to buy a programmer as the program is downloaded to the Arduino over a USB cable.

The Arduino does not include a clock but you can get real-time clock modules on ebay for US$0.75 including shipping.
These modules communcate via I2C but this is something you will find tutorials on the web with code.
Here is an example of what I'm taking about. This link logs the temperature from a DHT11 chip, gets the timestamp from a real-time clock module and logs the data to a file on an SD Card module:
https://randomnerdtutorials.com/arduino-temperature-data-logger-with-sd-card-module/

You would only need to this code to read the digital port instead of reading the temp sensor and either write that out to the SD card or open a serial connection to the PC and write it there.
 
The following users thanked this post: soldar

Offline soldarTopic starter

  • Super Contributor
  • ***
  • Posts: 3087
  • Country: es
Re: Win XP PRO SP3 as external event logger
« Reply #26 on: January 18, 2019, 09:35:33 pm »
Flenser, thanks so much for your input. I think I might give Arduino a try. I might need a lot of encouragement and hoandholding though because I get tired and discouraged easily. When I was younger I would toil for hours and never get tired but now I start to think, "you know, I've lived all these years without knowing all this... maybe it can wait a day or two..." and that is why I have a ton of projects half way done and unfinished.  I am going to have a look at Arduino and will report back.
All my posts are made with 100% recycled electrons and bare traces of grey matter.
 

Offline Ian.M

  • Super Contributor
  • ***
  • Posts: 12753
Re: Win XP PRO SP3 as external event logger
« Reply #27 on: January 18, 2019, 10:23:20 pm »
No worries.  Arduino related handholding is one of the things this forum does very well indeed usually with a better signal to noise ratio than the official forum.

I should caution you: if you've *NEVER* done any C programming or programming in a structured, procedural high level language before, the learning curve will be quite steep.

If you go down the Arduino road, it may be worth considering a data logger shield* which will give you a SD card socket and a RTC chip so the logger can run standalone without having to have a PC powered on.  See https://learn.adafruit.com/adafruit-data-logger-shield/overview

Data retrieval could be via the Arduino USB serial interface - send a plain text command to dump events since the last successful retrieval (or for a specified date time range) and get back text or binary data in whatever format you decide to code it to give you.

It is possible to put an Arduino on your LAN using the Ethernet shield and retrieve date from it over the network, but that's fairly advanced, even if you follow one of the 'cookbook' recipes for using that shield.

N.B. many of the shields use up a significant number of the 18 available I/Os (excluding UART RX & TX pins) on an Arduino Uno so if you've got a *LOT* of switches to monitor and don't want to use I/O expanders, take a look at the Arduino Mega 2560.

Another option for the logger that' s already been mentioned is the Raspberry Pi.  Pi Zero models and all model A boards don't have on-board Ethernet or USB hub, but OTOH because they don't have the on-board hub chip, you can put the SoC in USB OTG device mode and connect directly to it via USB from your PC.   The Pi Zero W is probably the best option for a simple logger, as its bluetooth and WiFi capabilities make it much easier to connect to.  You *will* need to get it on your LAN to get it internet access to install and update software packages, and its a lot easier if you don't have to do that through a USB tether to your PC.

OTOH if you prefer wired Ethernet capabiity, get any of the B models, but the tradeoff is they cant be USB tethered to a PC as they don't support USB OTG.

None of the PIs have an on-board RTC, so you either need them to have network connectivity so they can get the time from a time server, or to add a RTC module.  They all have a single SD card socket, which they boot the Linux OS from.  You can log to a file on the SD card, but keep a spare exact copy of the card as SD cards that are frequently written to tend to go bad after a while.  Also note that a Pi is *MUCH* more power hungry than an Arduino.

* Plug in daughter boards that match the Arduino pinout and form factor to extend its capabilities are called shields.  The Raspberry Pi equivalent are called hats (though strictly speaking a standards compliant Pi hat must have an ID EEPROM, which not all boards impement).
« Last Edit: January 19, 2019, 01:47:23 am by Ian.M »
 

Offline soldarTopic starter

  • Super Contributor
  • ***
  • Posts: 3087
  • Country: es
Re: Win XP PRO SP3 as external event logger
« Reply #28 on: January 18, 2019, 11:00:12 pm »
Wow, you are already beginning to scare me! Let us start with the very simplest bare minimum. Let us say a system that connects using solely USB which I assume is included. With 4 to 8 digital inputs and 4 to 8 outputs. With ability to keep real time and keep the output text file in memory until it is transferred via USB to the computer. Is that the simplest way? What kind of memory does it have. I wouldn't need a lot but let us say 100 events. What hardware do I need for that?
All my posts are made with 100% recycled electrons and bare traces of grey matter.
 

Offline Ian.M

  • Super Contributor
  • ***
  • Posts: 12753
Re: Win XP PRO SP3 as external event logger
« Reply #29 on: January 18, 2019, 11:40:18 pm »
It depends on the accuracy of the timestamp.  8 inputs = 4 bits for the input number + on/off , then you need 11 bits to record a time of day to the nearest minute, or 17 bits to the nearest second. Add another 9 bits for day of the year if you need the date.   Best case that's two
bytes, worst case its four bytes.   An Arduno Uno (or Nano) has 2K RAM so allocating 1K of it to hold an array for 256 four byte events would be one option, but the data would be lost if the power failed.  Another would be to log to its MCU's internal EEPROM, which is 1K.  Your logger program would convert the binary log to ASCII text immediately before transfer to the PC as storing it as ASCII would use *FAR* more memory, limiting the number of events it could retain.

An Arduino Uno (or Nano) has 20 I/O pins, but its on-board USB serial link to the PC reserves two of them and another two are needed if you connect an I2C RTC module for accurate timekeeping.  Therefore 16 I/Os would be available to your application - its up to you how you choose to divide them between inputs and outputs.   After you've reserved the I2C pins, four of the remaining I/Os are analog capable and the voltage on them can be read as a 10 bit number (so basically the resolution is approx 5mV if the 5V supply is used as the ADC reference.  six other I/Os can do PWM, which can be used for lighting brightness or DC power control or after filtering, can output an analog control voltage.

A Uno is a better option for the solder adverse, due to the wide range of shields available for that form factor.  A Nano is basically the same but in a 0.6" wide DIL-28 footprint.   Both have on-board USB serial to connect to your PC.  The Nano is the better choice if you want to assemble the switch and output interfaces on strip board or matrix board, as some of the Uno's headers are offset from a 0.1" pitch grid.
« Last Edit: January 18, 2019, 11:44:34 pm by Ian.M »
 

Online metrologist

  • Super Contributor
  • ***
  • Posts: 2197
  • Country: 00
Re: Win XP PRO SP3 as external event logger
« Reply #30 on: January 19, 2019, 12:51:20 am »
Ian, you convinced me to order 5 more Arduinos.
 

Offline Flenser

  • Regular Contributor
  • *
  • Posts: 60
Re: Win XP PRO SP3 as external event logger
« Reply #31 on: January 19, 2019, 04:14:22 am »
soldar,

Quote
With ability to keep real time and keep the output text file in memory until it is transferred via USB to the computer.
You do not have a USB connection to the arduino. At least not the type of usb connection you have with a flash drive that I suspect you may be thinking of.
The Arduinos have a USB-to-serial converter on the PCB. The USB cable you plug in provides one way to power the arduino and you can use the virtual serial ports you see on your PC to communicate with the arduino.

Quote
Is that the simplest way?
No matter which way you go you are going to be writing the software yourself, or modifying software from an existing tutorial.

Sending the samples to the PC via serial is probably "simpler" in terms of your effort learing Arduino and starting with C as sending data over a serial link is a very common thing people want to do so there will be plenty of examples on the web for you to checkout and/or copy code from. The trade-off is that you have to have PC running with logging software that writes the serial data to a file.

If you choose to write the data to an SD card using data logger shield, as suggested by Ian.M, then you don't need to have a PC running to collect the data. The arduino runs as stand-alone data logger hardware and just needs power, which can be batteries.
Transfering the data to your PC is arguably simpler as you just turn off the arduino, take out the SD card, plug it into your PC and copy the files off the card onto your PC. You will have to write the C code to write the data to the SD card but there will be plenty of examples on the web of how to do this.

If you choose to send the data to you PC via serial then you don't need a real-time clock on the ardunio. You can just use logging sofware on the PC that adds a timestamp to the serial bytes/lines it reveives.
- The LogView software suggested by MrMobodies does this
- ExtraPutty is also described as doing this http://www.extraputty.com/index.php and can be downloaded and the install folder extracted from the zip file run without needing to do an install.
Quote
What kind of memory does it have. I wouldn't need a lot but let us say 100 events.
The ATmega48P/88P/168P/328P chips that I think is commonly used on arduino boards have 512/1K/1K/2K Bytes of Internal SRAM so checkout the board you plan to buy to make sure it is one of the larger ones and you shold have plenty of RAM to store 100 samples + timestamp. If you store the data in RAM it will, of course, be lost when the power to the arduino is turned off.
These ATmega48P/88P/168P/328P chips also have 256/512/512/1K Bytes EEPROM which you can use as non-volitile storage. i.e. the stored values will not be lost when the power is turned off. You will still need to write the code to get the data over to the PC some way.
« Last Edit: January 19, 2019, 07:13:03 am by Flenser »
 

Offline soldarTopic starter

  • Super Contributor
  • ***
  • Posts: 3087
  • Country: es
Re: Win XP PRO SP3 as external event logger
« Reply #32 on: January 19, 2019, 07:21:18 pm »
Yeah, thanks again. I am seeing this is going to take dedicating some time to it. It is not a one afternoon thing.

I am trying to somewhat improve security at home and this is part of trying to keep a log of when passive IR sensors were triggered, doors opened, etc.

I already have a bunch of security cams and I am also trying to improve that part. Every little thing takes countless hours. Maybe I am just not too bright. So once I get the camera system done I will get started with Arduino.

Maybe I will start another thread about the video cams because I am slo pretty frustrated with that after burning many hours.
All my posts are made with 100% recycled electrons and bare traces of grey matter.
 

Online metrologist

  • Super Contributor
  • ***
  • Posts: 2197
  • Country: 00
Re: Win XP PRO SP3 as external event logger
« Reply #33 on: January 20, 2019, 12:14:50 pm »
5 Arduino's arrived. I like the Nano version because they plug into solderless breadboards. You could certainly get a breadboard wired up to some sensors and programmed in an afternoon. A lot of "Arduino" modules are layed out with pin headers to plug into breadboards, like a RTC module and temp sensors, etc.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf