Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 21:22 27 Jul 2024 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : WiFi Scanner

     Page 1 of 2    
Author Message
carlschneider
Senior Member

Joined: 04/08/2023
Location: South Africa
Posts: 148
Posted: 10:22pm 11 Sep 2023
Copy link to clipboard 
Print this post

The WiFiScannerv1_0.bas is a WiFi Scanner with the option to continuously monitor and graph the RSSI of a selected SSID.

Copy the expanded content of WiFiScannerv1_0.zip onto the Pico W, load WiFiScannerv1_0.bas into program memory and launch.

WiFiScanner.zip

The WiFiScanner will do a web scan and present the SSID RSSI table and wait for the case sensitive plain text SSID to monitor. Once the SSID has been typed and Enter'ed the WiFiScanner will do a web scan every 60 seconds and print the RSSI on the console. It also assembles a JSON string which is automatically fetched by graphrssi.html when launched. Note that the refresh and polling rate is once per 60 seconds, so slow and patient ... This the way.

This means that it will take >120s before the first RSSI is printed on the console and available in the JSON string.

Given the above it is best to wait with launching graphrssi.html in the browser until the first RSSI is printed to the console.

You can dig around in the code and change the timing of the refresh in graphrssi.html and in WiFIScanner.bas, but be aware that web scan takes around 10 seconds to produce the SSID RSSI table, depending on the number of SSIDs found. Further, it is possible to overload the web server running on the Pico which will cause the program to abort to console.

The trending over time gives one an idea of what is happening in the WiFi environment the Pico W finds itself in, as well as what sort of signal strength is being seen by the Pico W for the SSID of interest.

I have noticed that the Pico W in the Breakout Board appears to have a worse RSSI than the Pico W lying on the desk.

An example of the graphing below, firstly the Pico W lying on the desk and second the Pico W plugged into the breakout board.

Pico W lying on the desk


Pico W in breakout board


Hope this is of some use to somebody.
Cheers Carl                                                        
Retirement is tough on Hobbies without a day job
 
Pluto
Guru

Joined: 09/06/2017
Location: Finland
Posts: 330
Posted: 08:17am 12 Sep 2023
Copy link to clipboard 
Print this post

Thanks Carl for the nice utility!
I have scanning ongoing and the results are nicely presented on the console.
However, I am not able to get any results to the browser.

The layout of the page is slightly diferent from what you showed in your post! Start and Stop at the bottom instead of to the righ of the "period" window.




option list
WebMite MMBasic Version 5.07.08b15
OPTION AUTORUN ON
OPTION DISPLAY 41, 140
OPTION WIFI HuaHuaNisse, ***********, PICOE6616408439
OPTION TCP SERVER PORT 80, 20000



A:/
  <DIR>  .
  <DIR>  ..
00:03 01-01-2000       6272  .DS_Store
00:04 01-01-2000        128  404.html
00:04 01-01-2000        128  all
00:04 01-01-2000        128  apple-touch-icon.png
00:00 01-01-2000          4  bootcount
00:04 01-01-2000        128  favicon.ico
00:04 01-01-2000       2432  graphrssi.html
00:04 01-01-2000       1024  graphs.js
00:04 01-01-2000        128  JSONHeader.txt
10:50 12-09-2023        200  log.txt
00:05 01-01-2000       6528  WiFiScannerv1_0.bas
2 directories, 11 files, 512000 bytes free


Used the proposed 192.168.32.13/graphrssi.html to access graphing.

Fred
 
carlschneider
Senior Member

Joined: 04/08/2023
Location: South Africa
Posts: 148
Posted: 02:13pm 12 Sep 2023
Copy link to clipboard 
Print this post

Thanks Pluto

The reported sizes of some of the files on the Webmite drive look wrong.

Make sure you used a binary transfer protocol and not an ascii transfer protocol.

From memory the file size for the graphs.js is 3802 bytes and I see on yours it’s only 1024 bytes. Also “all” seems too big, should by 19 bytes and yours is 128 bytes.

See if recopying using binary mode solves the problem and let me know.

PS you don’t need the .DS_Store file on the Webmite, that’s a MacOS file system artifact.
Cheers Carl                                                        
Retirement is tough on Hobbies without a day job
 
Pluto
Guru

Joined: 09/06/2017
Location: Finland
Posts: 330
Posted: 04:05pm 12 Sep 2023
Copy link to clipboard 
Print this post

Carl,
I dowloaded again and extracted the zip-files. The filesizes that you mention does not match with what you said above. I get 2384 byte for graphrssi.html in the folder where I download. After transfer to PicoWEB it is 2432 byte.

Used Winrar for unzipping and for PC to Pico I used drag and drop to MacroMite control Centre.
  Quote  Make sure you used a binary transfer protocol and not an ascii transfer protocol.

I am not sure what you mean by this.

Fred
 
carlschneider
Senior Member

Joined: 04/08/2023
Location: South Africa
Posts: 148
Posted: 09:06pm 12 Sep 2023
Copy link to clipboard 
Print this post

Hi Fred

I use TFTP on a Mac so not sure how you're doing it on a PC. On TFTP there is a ASCII mode which objects to non printable ASCII characters and a Binary mode which transfers byte by byte.

Here is the WiFiScanner again, maybe this one will work better?


WiFiScanner 2.zip


However this is what I'm seeing on the Pico W here

> files
A:/
  <DIR>  .
  <DIR>  ..
10:16 11-09-2023        112  404.html
21:20 10-09-2023         19  all
21:21 10-09-2023          0  apple-touch-icon-precomposed.png
21:23 10-09-2023          0  apple-touch-icon.png
00:00 01-01-2000          4  bootcount
21:19 10-09-2023      11256  favicon.ico
15:10 11-09-2023       2384  graphrssi.html
10:16 11-09-2023       3852  graphs.js
21:19 10-09-2023         84  JSONHeader.txt
08:47 12-09-2023        775  log.txt
00:01 01-01-2000       6474  WiFIScannerv1_0.bas
2 directories, 11 files, 577536 bytes free
>


As you're using MMEdit this may provide guidance on MMEdit usage. Other ways using TFTP are also covered.

Hope this helps
Cheers Carl                                                        
Retirement is tough on Hobbies without a day job
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 5962
Posted: 09:06pm 12 Sep 2023
Copy link to clipboard 
Print this post

Carl,
The file graphs.js is only 1k in the ZIP.
The apple icons are zero bytes.
I suggest you check it and possibly re-issue it.

Fred has his webmite connected by USB so the files will transfer using xmodem. That explains the padding out to 128 byte mutiples.

Jim
VK7JH
MMedit   MMBasic Help
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 5962
Posted: 09:10pm 12 Sep 2023
Copy link to clipboard 
Print this post

The zip looks better this time.
VK7JH
MMedit   MMBasic Help
 
carlschneider
Senior Member

Joined: 04/08/2023
Location: South Africa
Posts: 148
Posted: 09:11pm 12 Sep 2023
Copy link to clipboard 
Print this post

Thanks Jim

I have uploaded another WiFiScanner 2.zip.

Apple icons are zero sized to reduce web server overhead so they are correct, but graphs.js is 3852 bytes, so something went wrong for sure.

I have downloaded the latest upload and the files appear to be intact this time round.
Cheers Carl                                                        
Retirement is tough on Hobbies without a day job
 
Pluto
Guru

Joined: 09/06/2017
Location: Finland
Posts: 330
Posted: 07:10am 13 Sep 2023
Copy link to clipboard 
Print this post

Carl, still no better luck for me with your latest WiFiScanner 2.zip. It lists correctly RSSI in the console, but nothing happens on the 192.168.32.13/graphrssi.html.

>
files
A:/
  <DIR>  .
  <DIR>  ..
09:53 13-09-2023       6272  .DS_Store
09:54 13-09-2023        128  404.html
09:54 13-09-2023        128  all
09:54 13-09-2023        128  apple-touch-icon.png
00:00 01-01-2000          4  bootcount
09:54 13-09-2023       4608  favicon.ico
09:54 13-09-2023       2432  graphrssi.html
09:54 13-09-2023       3968  graphs.js
09:55 13-09-2023        128  JSONHeader.txt
09:55 13-09-2023        128  log.txt
09:55 13-09-2023       6528  WiFiScannerv1_0.bas
2 directories, 11 files, 503808 bytes free


This is all in the log.txt after 6 RSSI measurements (RSSI -68...-71):

                                                                                                                             13-09-2023,09:59:49, 2


Fred
 
carlschneider
Senior Member

Joined: 04/08/2023
Location: South Africa
Posts: 148
Posted: 03:46pm 13 Sep 2023
Copy link to clipboard 
Print this post

Hi Fred

The intention behind log.txt is to keep track of the Pico W starts and resets. The contents of log.txt is date$, Time$, MM.INFO(Boot Count) as a CSV file.

If there is value in logging the date and time stamped RSSI values this can be added. I did not implement this as the available storage on the file system is limited. Each timestamped RSSI would take about 25 bytes by my reconning. At one timestamp per minute that would represent about 1500 bytes per hour and 36000 bytes per 24 hour period. That's a shade over 35kB/24 hours and based on your currently available 503808 bytes would give you about 13 days of logging. Not sure what happens when the file storage area is full... I suspect the file write will fail and the Webmite will abort to the command prompt.

I have played a little with MMCC this morning. Using the MMCC File Manager I see there is a TFTP check box that came up ticked on mine. Moving files from the Webmite to the PC works fine and the files are intact, after I set the connection speed to the maximum available in the dropdown. Sending the file back to the Webmite using MMCC File Manager definitely inflates the file size and only the Period/Start/Stop displays.

Following this from the MMEDIT online Help
TFTP can only be used with the picomiteWEB when accessed via Telnet.
TFTP uses UDP and doesn't pass through routers very well. It is usually confined to local networks.
When it can be used, it is faster than XMODEM and doesn't pad any extra characters to the end of files.
In MMCC, all file transfers are treated as binary. A bit slower but saves trying to determine each file type.

You will need to install TFTP Cleint on your PC.

Adding TFTP to your PC
in Windows 11:
settings
apps
optional features
More Windows features
TFTP client


If Telnet is not ticked then tick that too then you can telnet into the Webmite too.

Then open cmd.exe and navigate to the WiFIScanner 2.zip extracted files using cd to change directory etc. Once in the correct subdirectory launch TFTP and it will provide the syntax for you to PUT the files onto the Webmite without any padding. It needs to be a binary transfer, which MMCC.exe doesn't appear to be able to do, especially for the graphs.js-your mileage may vary for the other files.

Hope this helps a bit.
Cheers Carl                                                        
Retirement is tough on Hobbies without a day job
 
carlschneider
Senior Member

Joined: 04/08/2023
Location: South Africa
Posts: 148
Posted: 10:15pm 13 Sep 2023
Copy link to clipboard 
Print this post

Hi Fred

Try the new and improved WiFiScannerv1_1, now with RSSI logging to file.

WiFiScannerv1_1.bas.zip

Let me know how many days you can squeeze out of the available memory. Hopefully you'll be able to get just on 24 days at 60s polling.

Date rollover should take care of itself the way the code is structured, let me know if it works like that :)

Hopefully you've sorted out the non padded binary PUT of TFTP and have the graphing up and running too.
Cheers Carl                                                        
Retirement is tough on Hobbies without a day job
 
carlschneider
Senior Member

Joined: 04/08/2023
Location: South Africa
Posts: 148
Posted: 01:20am 14 Sep 2023
Copy link to clipboard 
Print this post

Hi Fred

WiFiScannerv1_2.zip

Now with internet connection checking and logging to the csv file.

Enjoy
Cheers Carl                                                        
Retirement is tough on Hobbies without a day job
 
Pluto
Guru

Joined: 09/06/2017
Location: Finland
Posts: 330
Posted: 06:42am 14 Sep 2023
Copy link to clipboard 
Print this post

Hi Carl
I tested the TFTP method with the WiFiScannerv1_0.bas. Never used TFTP before. I got files copied to A:/ and the filesizes were not changing during the copying. The program proceeded now a bit further: The frame for the RSSI graph was drawn and the showed the latest value on top of the screen as number, but no dot visible in the graph. Programk make only 1 measurement and the PicoW is frosen, needing power recycle for starting again.

Unfortunately I have no time to test your newer versions in the next few days.

Thanks!

Fred
 
Pluto
Guru

Joined: 09/06/2017
Location: Finland
Posts: 330
Posted: 02:49pm 14 Sep 2023
Copy link to clipboard 
Print this post

Hi Carl
Couldn't resist to test your newest version!
-As long as I do not start the http://192.168.32.8/graphrssi.html, the rssi values are measured and stored to the .csv file.
-"Pressing" the start button halts the measurements and the on board LED stops blinking. Power recycle needed to start the PicoMiteWEB again.

Thanks for educating me about TFTP!

Fred
 
carlschneider
Senior Member

Joined: 04/08/2023
Location: South Africa
Posts: 148
Posted: 03:16pm 14 Sep 2023
Copy link to clipboard 
Print this post

Hi Fred

Glad to hear that the Webmite portion is at least working correctly. You should be able pull the Date.csv files into a spreadsheet and then graph them, if that’s your requirement.

I ran v1.2 overnight and it started a new file as programmed (hoped).

I’ll fiddle some more and see if I can get the graphing to work more reliably, otherwise it’ll have to be called a “remote Webmite off switch” feature :)
Cheers Carl                                                        
Retirement is tough on Hobbies without a day job
 
carlschneider
Senior Member

Joined: 04/08/2023
Location: South Africa
Posts: 148
Posted: 06:33pm 14 Sep 2023
Copy link to clipboard 
Print this post

Hi Fred

WiFiScannerv1_4.zip

TFTP graphrssi.html and the bas file. The rest of the files are made by the program or are already there from your previous installations.

Note that the initial polling period in the program is 60 seconds for the RSSI, 10 minutes for the Ping and graphrssi.html is 60 seconds. Changing the graphrssi.html period requires waiting out the initial period before the new period is implemented. I have successfully run here on a 20 second polling, both in the program and on graphrssi.html.

I'm still not happy with accessing the csv files, which have now been changed to txt so that you can view their contents in your browser with ip address/log.txt for example. Excel is capable of handling the file if you TFTP 'get' it from the Webmite.

Hopefully the graphrssi.html is now working.
Cheers Carl                                                        
Retirement is tough on Hobbies without a day job
 
carlschneider
Senior Member

Joined: 04/08/2023
Location: South Africa
Posts: 148
Posted: 11:38pm 14 Sep 2023
Copy link to clipboard 
Print this post

Hi Fred

WiFiScannerV1_5.zip

All files are now csv files and viewable through your browser.

log.csv keeps track of the date, time and boot count number for diagnostic purposes.

dd-mm-yyyy.csv tracks the Date, SSID, Time, RSSI and Ping outcome.

Still thinking about how to deliver the javascript as part of the bas file. Saw some interesting discussions around using CSubs to embed sprites.
Cheers Carl                                                        
Retirement is tough on Hobbies without a day job
 
TheMonkeys

Regular Member

Joined: 15/12/2022
Location: Australia
Posts: 59
Posted: 11:45am 15 Sep 2023
Copy link to clipboard 
Print this post

Hi Carl,

Have you considered using csv and a browser canvas?

It works fine for me.





Cheers,

Chris.
 
lizby
Guru

Joined: 17/05/2016
Location: United States
Posts: 3059
Posted: 11:46am 15 Sep 2023
Copy link to clipboard 
Print this post

  TheMonkeys said  Have you considered using csv and a browser canvas?


Can you provide an explanation of what this means--or links to explanations?
PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed
 
TheMonkeys

Regular Member

Joined: 15/12/2022
Location: Australia
Posts: 59
Posted: 12:00pm 15 Sep 2023
Copy link to clipboard 
Print this post

I'll post up an example in the morning.
 
     Page 1 of 2    
Print this page
© JAQ Software 2024