DIY Chain Counter - Again!!!

Hurricane

Well-known member
Joined
11 Nov 2005
Messages
9,587
Location
Sant Carles de la Ràpita
Visit site
i agree with a lot of what you say, but the problem with LibreOffice, is no Outlook equivalent. Anyone that still works, needs Outlook to get to Shared Calendars for setting up meetings and Outlook allows you to create a meeting for Teams. If they could crack that problem, i think i would definitely use it.
Have you tried Thunderbird?
I switched from outlook to Thunderbird years ago
Multi platform as well.
Not sure about its integration with Teams though
 

Hurricane

Well-known member
Joined
11 Nov 2005
Messages
9,587
Location
Sant Carles de la Ràpita
Visit site
A little ot I know.

Looking to start playing with Raspberry Pi, I've lot's of electronics skills but little coding.

The intent is setup a Zigbee temp & humidity sensor network & be able to log & display this.

Any recommendations both for the Pi part & zigbee sensors.
Regarding coding, Google is your best friend.
But recently I asked CharGPT (AI) to write a program for Raspberry Pi with a DAISy hat and an RS 422 hat to feed AIS data to an NMEA 0183 interface.
Within a few seconds it wrote a Python script to do the job.
I don't like Python so I added "in C" to the request.
A few seconds later ot provided the same thing in C complete with some libraries that I hadn't heard of.

I didn't take the ChatGPT solution any further but this might be the thing of the future.
 

Parabordi

Active member
Joined
22 Apr 2011
Messages
886
Location
Medway
Visit site
Have you tried Thunderbird?
I switched from outlook to Thunderbird years ago
Multi platform as well.
Not sure about its integration with Teams though
Yes, i have found 'eM Client' better but still not quite there (it does allow you to view other users Calendars, and schedule teams meetings) -i am getting fussy now, it doesnt have the focused inbox which i have to say i use quite a lot.
 

Parabordi

Active member
Joined
22 Apr 2011
Messages
886
Location
Medway
Visit site
Regarding coding, Google is your best friend.
But recently I asked CharGPT (AI) to write a program for Raspberry Pi with a DAISy hat and an RS 422 hat to feed AIS data to an NMEA 0183 interface.
Within a few seconds it wrote a Python script to do the job.
I don't like Python so I added "in C" to the request.
A few seconds later ot provided the same thing in C complete with some libraries that I hadn't heard of.

I didn't take the ChatGPT solution any further but this might be the thing of the future.
love it!
 

Parabordi

Active member
Joined
22 Apr 2011
Messages
886
Location
Medway
Visit site
Following my last post, I would like to say something about Linux itself.
Linux seems to me to be the biggest misunderstood secret ever.
Linux is everywhere - a fact that most people don't understand.
Literally everybody uses it - without knowing it.
Your home router probably uses it - your TV set top box probably uses it - a huge percentage of professional servers in the cloud use it - Google's Android (as in phones and tablets) IS Linux.
Even Microsoft use it - WSL (Windows Subsystem for Linux) and more recently, Microsoft have Linux installation notes on their website.
So, as I say, a huge secret to most people.
The big area where Linux hasn't yet conquered is in desktop computing.
Windows still seems to be the popular way of running home/office Desktops and Laptops.
I find this difficult to understand.
Why tie yourself to Microsoft accounts and do things they way they want you to?
Linux is free (as in freedom) so you can do anything you want without having to sign in to a Microsoft account.
You can choose what desktop environment you like.
Personally, I like the old Classic Windows environment like we had in Windows 95/98/2000/XP etc
I'm a dinosaur so I also choose a light theme because I don't like all the dark colours that people tend to use these days.
But it is completely up to you.

People often say that Linux doesn't support their software.
To a small extent, this is true but applications these days are becoming more and more multi platform.
For example, what do people actually use their computers for?
If it is just Internet browsing, and some office work, there are loads of Linux compatible applications out there - (LibreOffice for example is 100% Microsoft Office compatible - but free).

This brings me to Open Source Software in general.
Why pay for software when you can use it for free.
When talking to small business owners, I have been astounded at their negative reaction to Open Source Software.
One person recently said that security was an issue to them - thats why they use paid software, they said.
That statement is simply wrong - by using Open Source the software can be audited - something you can't do with Closed Software.
So, if there was a back door in the software, the Open Source community would KNOW.
With Closed Source Software you would never know.
I wonder if anyone remembers in Microsoft's Excel a few years ago (Excel 97), there was an hidden "Space Simulator" - do you call that a professional feature? - NO but it shows just how Closed Source is actually less secure than Open Source software.
And remember Open Source Software is free - so why not use it?







So, why not give it a try - breathe life into an old computer - for free.
SO which Linux Distribution do you use?
 

GarryF

New member
Joined
6 Nov 2020
Messages
12
Visit site
Just tried your suggestion re creating programs using ChatGPT, with your chain counter as an example, and sure enough it responded in seconds, proposing a suitable hardware and software build - love it :).
FYI I am in the process of assembling the components on the breadboard for your "Opto Isolator Hat", that began this whole thread, then I guess its onto testing the full functionality.
One point to note, for others thinking of running with this project, is I purchased a Raspberry Pi 4 2Mb, and this uses a USB C connector for power, so ensure whatever Voltage Converter is selected supports a USB C connector, otherwise they will need an adaptor.
 

jakew009

Well-known member
Joined
29 May 2012
Messages
428
Visit site
Just tried your suggestion re creating programs using ChatGPT, with your chain counter as an example, and sure enough it responded in seconds, proposing a suitable hardware and software build - love it :).
FYI I am in the process of assembling the components on the breadboard for your "Opto Isolator Hat", that began this whole thread, then I guess its onto testing the full functionality.
One point to note, for others thinking of running with this project, is I purchased a Raspberry Pi 4 2Mb, and this uses a USB C connector for power, so ensure whatever Voltage Converter is selected supports a USB C connector, otherwise they will need an adaptor.

You can power the RPI off pins 2 & 6, see pinout.xyz

1698688606995.png

Just be careful to get the polarity correct when connecting because I don't think those pins have any reverse polarity protection.

I think I posted this before but it's a really nice solution for a 'PLC' type device, already has a bunch of ruggedised inputs and outputs as well as an onboard dc/dc converter so you can feed it raw 12v.
It's just a Raspberry Pi with a hat on it inside.
Iono Pi - Industrial Raspberry Pi PLC - digital/analog I/O Relays CE FCC
1698688780912.png
 

Hurricane

Well-known member
Joined
11 Nov 2005
Messages
9,587
Location
Sant Carles de la Ràpita
Visit site
SO which Linux Distribution do you use?
About 8 years ago, I was faced with upgrading my Windows 7 or not.
I looked into upgrading to Windows 8 but I didn't like what I saw.
So I stuck with W7 and set myself the task of finding an alternative.
I put together various systems using Virtualbox and eventually an old computer to test the alternatives.

Bit of background for those who don't know Linux.
Linux is the core of a system - you could think of it like the old DOS environment from years ago.
But, actually it is way more powerful than that.
There is a massive community out there - all providing their time for free.
The result is hundreds of operating systems that all use Linux as a base.
Being Open Source, means that people can take a version and brand it themselves.
However, there only a few "root" versions and most people make their derivatives from these.
Debian, Arch, Fedora and Red hat are examples of base systems.
The derivatives don't stop the first time that they are copied - other derivatives are formed from derivatives.
The term used for these derivatives is "Disrtibutions"
So, for example, the Mint distribution is derived from the Ubuntu distribution which itself is derived from Debian.
On top of the distribution, you can install various different DEs (Desktop Environments)
The DE is the bit that you, as a user, interact with - examples of names of DEs are KDE's Plasma, Cinnamon and XFCE.
All this sounds confusing but once you understand how it works, you can choose exactly what you want.

I finally picked Linux Mint which is widely regarded as a good place for Windows users to start.
Apart from a couple of Windows applications, Mint did everything I wanted.
In fact, I used the XFCE DE variant of Mint because it just felt right.

After a few years, I was ready to make a change.
Mint was fine but I wanted something different.
So, out came Virtualbox and I tried a few more different Ditsros (Distributions).
Finally, I selected the Manjaro distro which is a derivative of Arch.
Manjaro is "billed as" a "Bleeding Edge" distro which continually allows you to upgrade to the latest software.
On changing from Mint, I continued to use XFCE as my Desktop environment.
XFCE has the look and feel of the old Windows 95,Windows 98, 2000 and XP.
So it is no problem for my wife to use.

So that is a long answer to the question.
I use Manjaro with the XFCE desktop environment.
 

GarryF

New member
Joined
6 Nov 2020
Messages
12
Visit site
Hi, sorry to be a pain, but I'm trying to copy the files from the chain directory, as detailed in the ChainCounterNotes.txt, but I'm struggling to get past the following instructions
But the chain directory only has root access so transfer first to the Raspberry Pi Home Directory (/home/mike in my case)
So, on Linux PC change to the directory containing the chain application files and use the following command
scp *.* mike@10.0.20.128:/home/mike

Its probably my lack of knowledge of Linux, or a misunderstanding of the instruction, but when you say change to the directory containing the chain application files, is this the directory on your server, ie 10.0.20.128, and If so do I need specific permissions?. I have tried using the command scp *.* mike@10.0.20.128:/home/mike whilst on my RPI opt/chain directory, but I get a timeout error.
Its probably something pretty basic, like my knowledge of Linux and Terminal, so any guidance would be welcomed. TIA Garry
 

Hurricane

Well-known member
Joined
11 Nov 2005
Messages
9,587
Location
Sant Carles de la Ràpita
Visit site
Hi, sorry to be a pain, but I'm trying to copy the files from the chain directory, as detailed in the ChainCounterNotes.txt, but I'm struggling to get past the following instructions
But the chain directory only has root access so transfer first to the Raspberry Pi Home Directory (/home/mike in my case)
So, on Linux PC change to the directory containing the chain application files and use the following command
scp *.* mike@10.0.20.128:/home/mike

Its probably my lack of knowledge of Linux, or a misunderstanding of the instruction, but when you say change to the directory containing the chain application files, is this the directory on your server, ie 10.0.20.128, and If so do I need specific permissions?. I have tried using the command scp *.* mike@10.0.20.128:/home/mike whilst on my RPI opt/chain directory, but I get a timeout error.
Its probably something pretty basic, like my knowledge of Linux and Terminal, so any guidance would be welcomed. TIA Garry
That part of the notes is ensuring that all the files from my server - Index of /chaincounter/CodeVersion1.5 end up in the Raspberry Pi's /opt/chain directory.
I suggest doing that by downloading the files at Index of /chaincounter/CodeVersion1.5 to somewhere on your computer.
Then uploading them onto the RPi
The directory called chain on the RPi in /opt will have to be created
You may have to do it with root permissions.
The procedure in my notes downloads the files to a separate directory on my Linux desktop PC (you could use an empty folder on a Windows computer).
My procedure then uses the Linux command "scp" (on my Linux desktop PC) to upload those files onto the RPi
Note that the username "mike" is the name of the RPi user - 10.0.20.128 is the IP address of the RPi - /home/mike is the home folder on the Raspberry Pi
You may have a different username and home folder name - created when you first set the RPi up.
This should copy all the files onto the RPi at /home/mike.
Now you need to move them into the RPi's /opt/chain directory which doesn't exist.
So, on the RPi (using SSH or PUTTY) run this command - sudo mkdir /opt/chain
then
sudo mv /home/mike/*.* /opt/chain
The files should now be on the RPi's /opt/chain directory.
Whilst logged into the RPi (using SSH or PUTTY) you can run this command to see them listed
ls /opt/chain

Does that help?

Please bear in mind that these are my notes so may not be specific to you.
To find the IP address of your RPi
On the RPi (using SSH or PUTTY) run this command - ip a (short for ip addr) - a lot of information will now appear - your RPi's address will probably be something like 192.168.1.x
 
Last edited:

GarryF

New member
Joined
6 Nov 2020
Messages
12
Visit site
Thanks for the speedy response and the suggestions, and I will revisit the process tomorrow., hopefully with a fresh mind. The issue appears to be with the file copy, and points to either me trying to connect to the wrong directory, or having a lack of permission in that directory, so hopefully its something relatively straightforward.

For info I when I try to run the command
scp *.* mike@10.0.20.128:/home/mike

I get the response
ssh: connect to host 10.0.20.128 port 22: Connection timed out
scp: Connection closed


Again, I appreciate your advice, I will revisit the project, and confirm I am using the correct syntax and directories for the file copy. Cheers .
That part of the notes is ensuring that all the files from my server - Index of /chaincounter/CodeVersion1.5 end up in the Raspberry Pi's /opt/chain directory.
I suggest doing that by downloading the files at Index of /chaincounter/CodeVersion1.5 to somewhere on your computer.
Then uploading them onto the RPi
The directory called chain on the RPi in /opt will have to be created
You may have to do it with root permissions.
The procedure in my notes downloads the files to a separate directory on my Linux desktop PC (you could use an empty folder on a Windows computer).
My procedure then uses the Linux command "scp" (on my Linux desktop PC) to upload those files onto the RPi
Note that the username "mike" is the name of the RPi user - 10.0.20.128 is the IP address of the RPi - /home/mike is the home folder on the Raspberry Pi
You may have a different username and home folder name - created when you first set the RPi up.
This should copy all the files onto the RPi at /home/mike.
Now you need to move them into the RPi's /opt/chain directory which doesn't exist.
So, on the RPi (using SSH or PUTTY) run this command - sudo mkdir /opt/chain
then
sudo mv /home/mike/*.* /opt/chain
The files should now be on the RPi's /opt/chain directory.
Whilst logged into the RPi (using SSH or PUTTY) you can run this command to see them listed
ls /opt/chain

Does that help?

Please bear in mind that these are my notes so may not be specific to you.
To find the IP address of your RPi
On the RPi (using SSH or PUTTY) run this command - ip a (short for ip addr) - a lot of information will now appear - your RPi's address will probably be something like 192.168.1.x
 

Hurricane

Well-known member
Joined
11 Nov 2005
Messages
9,587
Location
Sant Carles de la Ràpita
Visit site
Thanks for the speedy response and the suggestions, and I will revisit the process tomorrow., hopefully with a fresh mind. The issue appears to be with the file copy, and points to either me trying to connect to the wrong directory, or having a lack of permission in that directory, so hopefully its something relatively straightforward.

For info I when I try to run the command
scp *.* mike@10.0.20.128:/home/mike

I get the response
ssh: connect to host 10.0.20.128 port 22: Connection timed out
scp: Connection closed


Again, I appreciate your advice, I will revisit the project, and confirm I am using the correct syntax and directories for the file copy. Cheers .
I've been thinking - there are always different ways to "skin a cat"
You are probably using Windows as you main computer and I'm not sure how to get scp (or similar) working under Windows.
So here is a suggestion.
Why not get the RPi to download the files from my server itself.
In Linux, we have a command called "wget" and it is pre-installed in the RPi so we could use that rather than going through all the stages mentioned above.
Unfortunately, wget doesn't support wild cards (*,*) so we will have to download each fine individually but it should be easier that the previous notes.
Tip - in the Linux console (RPi) you can simply hit the "up arrow" key to recover the last command.
Also note that sudo is the Supersuer Linux command (Superuser Do) - any commands following it will be carried out as though you are the root user.

So, to download all my files into the RPi do the following - make sure that ther RPi is connected to the internet - an ethernet cable connected to a router is best.
Make an SSH connection to the RPi (If using Windows, use PUTTY)
Then cut and paste each of the following lines separately into the RPi command line and press enter.

sudo mkdir /opt/chain
cd /opt/chain
sudo wget https://www.maidencombe.com/chaincounter/CodeVersion1.5/boatname.conf
sudo wget https://www.maidencombe.com/chaincounter/CodeVersion1.5/chain.js
sudo wget https://www.maidencombe.com/chaincounter/CodeVersion1.5/chainMultiplier.conf
sudo wget https://www.maidencombe.com/chaincounter/CodeVersion1.5/counter.dat
sudo wget https://www.maidencombe.com/chaincounter/CodeVersion1.5/counteronly1.html
sudo wget https://www.maidencombe.com/chaincounter/CodeVersion1.5/counteronly2.html
sudo wget https://www.maidencombe.com/chaincounter/CodeVersion1.5/deckToWater.conf
sudo wget https://www.maidencombe.com/chaincounter/CodeVersion1.5/index1.html
sudo wget https://www.maidencombe.com/chaincounter/CodeVersion1.5/index2.html
sudo wget https://www.maidencombe.com/chaincounter/CodeVersion1.5/index3.html
sudo wget https://www.maidencombe.com/chaincounter/CodeVersion1.5/index4.html
sudo wget https://www.maidencombe.com/chaincounter/CodeVersion1.5/index5.html
sudo wget https://www.maidencombe.com/chaincounter/CodeVersion1.5/reset1.html
sudo wget https://www.maidencombe.com/chaincounter/CodeVersion1.5/reset2.html
sudo wget https://www.maidencombe.com/chaincounter/CodeVersion1.5/reset3.html

The great thing about this method is that the files should now be in the correct place (/opt/chain)
So you can check by simply typing:
ls
You should then get a listing like this:
boatname.conf chainMultiplier.conf counteronly1.html deckToWater.conf index2.html index4.html reset1.html reset3.html
chain.js counter.dat counteronly2.html index1.html index3.html index5.html reset2.html

Other files will be created in this directory by Node.js after you get the application running.

So, if you have successfully managed to install Node.js and the libraries etc (according to the first part of my notes) you should now be able to run the application - from the command line.
Whilst still in the /opt/chain directory, simply enter (you might need a sudo in front of node chain.js)
node chain.js
There should then be a message saying something like "Server running at xxx.xxx.xxx.xxx:8000 (I think this message includes the IP address)

Now, whilst the RPi chain counter application is still running go back to the PC and run a browser.
In the top URL line of the browser enter the IP address for the RPi followed by a colon ( : ) and then 8000
example something like this:-
192,168.1.56:8000

If all works, you should see the chain counter's page.

If all this works and you want to run it again after a power off, remember to do
cd /opt/chain
before running
node chain.js

I didn't expect anyone to follow my design but I willing to help if you have problems.
I get a real buzz when things like this finally work
Good luck
 

GarryF

New member
Joined
6 Nov 2020
Messages
12
Visit site
I've been thinking - there are always different ways to "skin a cat"
You are probably using Windows as you main computer and I'm not sure how to get scp (or similar) working under Windows.
So here is a suggestion.
Why not get the RPi to download the files from my server itself.
In Linux, we have a command called "wget" and it is pre-installed in the RPi so we could use that rather than going through all the stages mentioned above.
Unfortunately, wget doesn't support wild cards (*,*) so we will have to download each fine individually but it should be easier that the previous notes.
Tip - in the Linux console (RPi) you can simply hit the "up arrow" key to recover the last command.
Also note that sudo is the Supersuer Linux command (Superuser Do) - any commands following it will be carried out as though you are the root user.

So, to download all my files into the RPi do the following - make sure that ther RPi is connected to the internet - an ethernet cable connected to a router is best.
Make an SSH connection to the RPi (If using Windows, use PUTTY)
Then cut and paste each of the following lines separately into the RPi command line and press enter.

sudo mkdir /opt/chain
cd /opt/chain
sudo wget https://www.maidencombe.com/chaincounter/CodeVersion1.5/boatname.conf
sudo wget https://www.maidencombe.com/chaincounter/CodeVersion1.5/chain.js
sudo wget https://www.maidencombe.com/chaincounter/CodeVersion1.5/chainMultiplier.conf
sudo wget https://www.maidencombe.com/chaincounter/CodeVersion1.5/counter.dat
sudo wget https://www.maidencombe.com/chaincounter/CodeVersion1.5/counteronly1.html
sudo wget https://www.maidencombe.com/chaincounter/CodeVersion1.5/counteronly2.html
sudo wget https://www.maidencombe.com/chaincounter/CodeVersion1.5/deckToWater.conf
sudo wget https://www.maidencombe.com/chaincounter/CodeVersion1.5/index1.html
sudo wget https://www.maidencombe.com/chaincounter/CodeVersion1.5/index2.html
sudo wget https://www.maidencombe.com/chaincounter/CodeVersion1.5/index3.html
sudo wget https://www.maidencombe.com/chaincounter/CodeVersion1.5/index4.html
sudo wget https://www.maidencombe.com/chaincounter/CodeVersion1.5/index5.html
sudo wget https://www.maidencombe.com/chaincounter/CodeVersion1.5/reset1.html
sudo wget https://www.maidencombe.com/chaincounter/CodeVersion1.5/reset2.html
sudo wget https://www.maidencombe.com/chaincounter/CodeVersion1.5/reset3.html

The great thing about this method is that the files should now be in the correct place (/opt/chain)
So you can check by simply typing:
ls
You should then get a listing like this:
boatname.conf chainMultiplier.conf counteronly1.html deckToWater.conf index2.html index4.html reset1.html reset3.html
chain.js counter.dat counteronly2.html index1.html index3.html index5.html reset2.html

Other files will be created in this directory by Node.js after you get the application running.

So, if you have successfully managed to install Node.js and the libraries etc (according to the first part of my notes) you should now be able to run the application - from the command line.
Whilst still in the /opt/chain directory, simply enter (you might need a sudo in front of node chain.js)
node chain.js
There should then be a message saying something like "Server running at xxx.xxx.xxx.xxx:8000 (I think this message includes the IP address)

Now, whilst the RPi chain counter application is still running go back to the PC and run a browser.
In the top URL line of the browser enter the IP address for the RPi followed by a colon ( : ) and then 8000
example something like this:-
192,168.1.56:8000

If all works, you should see the chain counter's page.

If all this works and you want to run it again after a power off, remember to do
cd /opt/chain
before running
node chain.js

I didn't expect anyone to follow my design but I willing to help if you have problems.
I get a real buzz when things like this finally work
Good luck
Hi, thanks for the update, and the "alternate process for skinning the cat" much appreciated.

Current setup
I'm running Terminal through a MacBook Air on Monteray, and I am using the Mac as the "Master" connected to the RPI via console.
On the RPI, which is a Pi4 2MB, I have loaded a full version of Linux, incl desktop, I have a monitor, keyboard and mouse attached to the RPI, connected to my network over WiFi - addr 192.168.1.130. I have Terminal running on the RPI so I can see the directory structure etc.from both the Mac and the RPI

From your notes got as far as.
Running ls (Linux's command to list directory) should produce this output:-
node_modules package.json package-lock.json
These files/directories are the node addons (in this case just the onoff library)

The issue appears to be connecting to your server for the download part. When I run the command
scp *.* mike@10.0.20.128:/home/mike
I get Time Out errors and then disconnected, so I think I am trying to get to your RPI, which as I now appreciate, I cant.

From Terminal on my Mac I have just successfully run the line
sudo wget https://www.maidencombe.com/chaincounter/CodeVersion1.5/boatname.conf
and it has saved the file, which I can confirm on the RPI setup using Terminal and Filemanager - so its looking very positive, and I think you may have provided the answer to my problem.

I will now follow the rest of your commands, and hopefully report back success on completion.

Despite the problems I am really enjoying getting my hands 'dirty' again, my background goes back to DOS , so I do see the similarity in a lot of the commands, and I do appreciate your assitsance and help. I'm hoping the learning curve wont be too steep, and looking forward to getting into the world of Linux and Raspberry's. PS FYI following your other comments re Linux, I have installed it on an old Macbook Pro, and I'm very impressed by the performance improvements, so more fun times ahead I think.

I'll let you know how I get on - Cheers Garry
 

GarryF

New member
Joined
6 Nov 2020
Messages
12
Visit site
I've been thinking - there are always different ways to "skin a cat"
You are probably using Windows as you main computer and I'm not sure how to get scp (or similar) working under Windows.
So here is a suggestion.
Why not get the RPi to download the files from my server itself.
In Linux, we have a command called "wget" and it is pre-installed in the RPi so we could use that rather than going through all the stages mentioned above.
Unfortunately, wget doesn't support wild cards (*,*) so we will have to download each fine individually but it should be easier that the previous notes.
Tip - in the Linux console (RPi) you can simply hit the "up arrow" key to recover the last command.
Also note that sudo is the Supersuer Linux command (Superuser Do) - any commands following it will be carried out as though you are the root user.

So, to download all my files into the RPi do the following - make sure that ther RPi is connected to the internet - an ethernet cable connected to a router is best.
Make an SSH connection to the RPi (If using Windows, use PUTTY)
Then cut and paste each of the following lines separately into the RPi command line and press enter.

sudo mkdir /opt/chain
cd /opt/chain
sudo wget https://www.maidencombe.com/chaincounter/CodeVersion1.5/boatname.conf
sudo wget https://www.maidencombe.com/chaincounter/CodeVersion1.5/chain.js
sudo wget https://www.maidencombe.com/chaincounter/CodeVersion1.5/chainMultiplier.conf
sudo wget https://www.maidencombe.com/chaincounter/CodeVersion1.5/counter.dat
sudo wget https://www.maidencombe.com/chaincounter/CodeVersion1.5/counteronly1.html
sudo wget https://www.maidencombe.com/chaincounter/CodeVersion1.5/counteronly2.html
sudo wget https://www.maidencombe.com/chaincounter/CodeVersion1.5/deckToWater.conf
sudo wget https://www.maidencombe.com/chaincounter/CodeVersion1.5/index1.html
sudo wget https://www.maidencombe.com/chaincounter/CodeVersion1.5/index2.html
sudo wget https://www.maidencombe.com/chaincounter/CodeVersion1.5/index3.html
sudo wget https://www.maidencombe.com/chaincounter/CodeVersion1.5/index4.html
sudo wget https://www.maidencombe.com/chaincounter/CodeVersion1.5/index5.html
sudo wget https://www.maidencombe.com/chaincounter/CodeVersion1.5/reset1.html
sudo wget https://www.maidencombe.com/chaincounter/CodeVersion1.5/reset2.html
sudo wget https://www.maidencombe.com/chaincounter/CodeVersion1.5/reset3.html

The great thing about this method is that the files should now be in the correct place (/opt/chain)
So you can check by simply typing:
ls
You should then get a listing like this:
boatname.conf chainMultiplier.conf counteronly1.html deckToWater.conf index2.html index4.html reset1.html reset3.html
chain.js counter.dat counteronly2.html index1.html index3.html index5.html reset2.html

Other files will be created in this directory by Node.js after you get the application running.

So, if you have successfully managed to install Node.js and the libraries etc (according to the first part of my notes) you should now be able to run the application - from the command line.
Whilst still in the /opt/chain directory, simply enter (you might need a sudo in front of node chain.js)
node chain.js
There should then be a message saying something like "Server running at xxx.xxx.xxx.xxx:8000 (I think this message includes the IP address)

Now, whilst the RPi chain counter application is still running go back to the PC and run a browser.
In the top URL line of the browser enter the IP address for the RPi followed by a colon ( : ) and then 8000
example something like this:-
192,168.1.56:8000

If all works, you should see the chain counter's page.

If all this works and you want to run it again after a power off, remember to do
cd /opt/chain
before running
node chain.js

I didn't expect anyone to follow my design but I willing to help if you have problems.
I get a real buzz when things like this finally work
Good luck
and VOILA - big smiles here, now I can modify and personalise the screen - many thanks again
 

Attachments

  • IMG_0458.jpg
    IMG_0458.jpg
    55.6 KB · Views: 3

Hurricane

Well-known member
Joined
11 Nov 2005
Messages
9,587
Location
Sant Carles de la Ràpita
Visit site
and VOILA - big smiles here, now I can modify and personalise the screen - many thanks again
Well done.
I bet that is satisfying.
You will need to make some hardware to read the windlass reed switch and the "Up" button.
The hardware only needs to protect the RPis digital inputs from high voltages and spikes.
My circuit above seems to work for me but I'm not formally trained in electronics.

Note that if you add /counteronly to the end of your URL, you should only get the amount of chain deployed.

Linux on a Macbook Pro - thats a bit of a challenge - not as may options out there.
I assume it has an Intel (x86) CPU so that would make it more compatible.
The new Apple computers are using ARM CPUs but the ARM development is moving along very quickly these days.
From what I've read, the Distro to use for the new Apple M1 etc is Asahi Linux - based on Fedora.
I understand that there is a lot of development going on in that Distro at the moment - but all good.
I believe that Linus Torvalds (the main author of Linux) himself is using Apple silicone to run/develop Linux
 

GarryF

New member
Joined
6 Nov 2020
Messages
12
Visit site
Well done.
I bet that is satisfying.
You will need to make some hardware to read the windlass reed switch and the "Up" button.
The hardware only needs to protect the RPis digital inputs from high voltages and spikes.
My circuit above seems to work for me but I'm not formally trained in electronics.

Note that if you add /counteronly to the end of your URL, you should only get the amount of chain deployed.

Linux on a Macbook Pro - thats a bit of a challenge - not as may options out there.
I assume it has an Intel (x86) CPU so that would make it more compatible.
The new Apple computers are using ARM CPUs but the ARM development is moving along very quickly these days.
From what I've read, the Distro to use for the new Apple M1 etc is Asahi Linux - based on Fedora.
I understand that there is a lot of development going on in that Distro at the moment - but all good.
I believe that Linus Torvalds (the main author of Linux) himself is using Apple silicone to run/develop Linux
Yes I am very pleased with the result.
I followed your guidance and 'created' and fitted the hat for isolating the inputs from the reed switch and emulating the UP switch on the windlass - I actually fitted a reed switch and used a small magnet to simulate the windlass operation. Its functionality is exactly what I wanted. My anchorman commented that 'that will make life so much easier now' so I have to thank you also on her behalf ;-).

Re the Linux on the Mac, it wasn't that difficult, I have tried two flavours so far, Zorin 64 bit, and ubuntu 64. At the moment my preference is for Zorin, it has a more rounded interface, however I intend to install a couple more flavours before I make my final decision, so I will definitely checkout your suggestions.

I would also endorse your earlier comments about using free software whenever possible, I currently use Google Docs, Slides and Sheets for all my office work, but also in the past I used Open Office - the predecessor to LibreOffice I believe, and all achieve the same results for a lot less financial outlay.

Finally I have to thank you again for your project, which was fun to build, and I would highly recommend it to any boaters out there who wants/needs a chain counter. Note fyi it has actually broken the ice for me re getting into scripting, something I have wanted to do for some time now - I now intend to step through the code and hopefully understand what it is actually doing. Fingers crossed, I may then be in a position to delve further into, and take advantage of, the huge amount of scripts and programs currently freely available on the net.

Cheers Garry
 

Hurricane

Well-known member
Joined
11 Nov 2005
Messages
9,587
Location
Sant Carles de la Ràpita
Visit site
Yes I am very pleased with the result.
I followed your guidance and 'created' and fitted the hat for isolating the inputs from the reed switch and emulating the UP switch on the windlass - I actually fitted a reed switch and used a small magnet to simulate the windlass operation. Its functionality is exactly what I wanted. My anchorman commented that 'that will make life so much easier now' so I have to thank you also on her behalf ;-).

Re the Linux on the Mac, it wasn't that difficult, I have tried two flavours so far, Zorin 64 bit, and ubuntu 64. At the moment my preference is for Zorin, it has a more rounded interface, however I intend to install a couple more flavours before I make my final decision, so I will definitely checkout your suggestions.

I would also endorse your earlier comments about using free software whenever possible, I currently use Google Docs, Slides and Sheets for all my office work, but also in the past I used Open Office - the predecessor to LibreOffice I believe, and all achieve the same results for a lot less financial outlay.

Finally I have to thank you again for your project, which was fun to build, and I would highly recommend it to any boaters out there who wants/needs a chain counter. Note fyi it has actually broken the ice for me re getting into scripting, something I have wanted to do for some time now - I now intend to step through the code and hopefully understand what it is actually doing. Fingers crossed, I may then be in a position to delve further into, and take advantage of, the huge amount of scripts and programs currently freely available on the net.

Cheers Garry
How will it work on your boat?
I have a ships LAN and my RPi chain counter can be accessed by anything on the LAN.
One option I have is an old Android phone set up for this job.
I specifically designed it so that any web device can connect to it.
You could use the RPi as an access point - or even simpler with a monitor connected to the RPi.
I really only built it for myself so it is great that someone else can enjoy the work.
I don't have any formal training so don't expect anything special in the code - just what I've picked up over the last 45 years of being an enthusiast (even before the days of the IBM PC and the BBC Micro).
 

GarryF

New member
Joined
6 Nov 2020
Messages
12
Visit site
How will it work on your boat?
I have a ships LAN and my RPi chain counter can be accessed by anything on the LAN.
One option I have is an old Android phone set up for this job.
I specifically designed it so that any web device can connect to it.
You could use the RPi as an access point - or even simpler with a monitor connected to the RPi.
I really only built it for myself so it is great that someone else can enjoy the work.
I don't have any formal training so don't expect anything special in the code - just what I've picked up over the last 45 years of being an enthusiast (even before the days of the IBM PC and the BBC Micro).
The boat is an old 40ft yacht which I am slowly renovating. It has a legacy Seatalk / NMEA 183 network to which I have added NMEA 2K and a TalkTalk router providing me with my own WiFi, so I am hoping I can connect the RPI over WiFi. If not the router is also connected via ethernet to a Ubiquiti Bullet for connection to local networks, so I could also run an ethernet cable to the RPI.

And yes, so far, it works across all my devices, I have tested on my iPad, iPhone and Macbook Air without a problem so far, so I think it should be good. Obviously I have yet to rig up the "chaincounter box' to the windlass sometime early next year, ensure there is a magnet fitted to the gipsy, plus I intend to position the box in the front of the boat, so I need to check on the cable lengths for the reed switch etc. But I am pretty confident now I have the 'hard part' ,ie your coding, functioning.
 

Hurricane

Well-known member
Joined
11 Nov 2005
Messages
9,587
Location
Sant Carles de la Ràpita
Visit site
The boat is an old 40ft yacht which I am slowly renovating. It has a legacy Seatalk / NMEA 183 network to which I have added NMEA 2K and a TalkTalk router providing me with my own WiFi, so I am hoping I can connect the RPI over WiFi. If not the router is also connected via ethernet to a Ubiquiti Bullet for connection to local networks, so I could also run an ethernet cable to the RPI.

And yes, so far, it works across all my devices, I have tested on my iPad, iPhone and Macbook Air without a problem so far, so I think it should be good. Obviously I have yet to rig up the "chaincounter box' to the windlass sometime early next year, ensure there is a magnet fitted to the gipsy, plus I intend to position the box in the front of the boat, so I need to check on the cable lengths for the reed switch etc. But I am pretty confident now I have the 'hard part' ,ie your coding, functioning.
My boat is 20m long and my router is about two thirds from the bow to the stern.
WiFi worked but was a bit flakey.
So I use a wired connection to my router - I had one near the bow anyway (for the Anchor Camera).
I understand that the RPi's WiFi isn't very strong so you might have problems with the connection.
That said, all the important detection and counting is done, locally, on the RPi so it shouldn't loose count but the web connection to it may get a bit flakey.

As with all projects like this (and fault finding) the key is to start with something that works and make changes accordingly.
I use that process all the time.
 
Top