Code Monkey home page Code Monkey logo

iottstick's Introduction

IoTTStick

This is the code repository for the IoTT Stick, port modules and hat devices with the source code for the latest release. 2024/04/19 1.6.7

  • Version 1.6.7
  • Some problems in 1.6.6 with Loconet, DCC and MQTT communication fixed

2024/04/12 1.6.6

  • Version 1.6.6
  • adding support for M5 Stick C Plus2 hardware
  • Several bug fixes

2023/11/19 1.6.5

  • Version 1.6.5
  • Improvement of PurpleHat SpeedMagic tab as described in Video #131 https://youtu.be/hhmCFm9BiHA
  • Withrottle bug fixes (MU assignment, DCC EX support for changed command
  • upgrade to latest library versions of several libraries
  • some internal restructuring to reduce main loop cycle time (shorter response times)

2023/5/20 1.6.0

  • Version 1.6.0
  • WiThrottle server can now read turnouts, routes and roster from DCC EX
  • Loconet bridge allows to bridge into Loconet subnet

2023/5/20 1.6.0

  • Version 1.6.0
  • WiThrottle server can now read turnouts, routes and roster from DCC EX
  • Loconet bridge allows to bridge into Loconet subnet

2023/1/5 1.5.19

  • Version 1.5.19
  • added client report to WiThrottle and Loconet TCP servers
  • fixed setup bugs in LED config page

2022/11/22 1.5.18

  • Pin change for BrownHat: Now using pin 36 for Rx
  • Adjustments to the setup of RedHat current measuring

2022/10/12 1.5.17

  • Version 1.5.17
  • Added Current gauges to RedHat to display track current (requires special version of DCC EX)

2022/09/18 1.5.16

  • Version 1.5.16
  • Improved webpage loading (bugfix for timeout problem)
  • Added buttons in LED chain configuration to increment and decrement LED numbers when adding/removing Neopixels

2022/09/03 1.5.15

  • Version 1.5.15
  • switch to No OTA memory model due to code size
  • switch to 2.0.4
  • bug fix for PurpleHat SpeedMagic when using imperial dimensions
  • adding grade and superelevation data to PurpleHat from Stick IMU

2022/07/31

  • Version 1.5.13
  • Official support for WiThrottle and RedHat++ Shield
  • WiThrottle now with mDNS support

2022/05/10

  • Version 1.5.12
  • Improvements to the speed measurement algorithm, resulting in smoother display curve

2022/05/05

  • Version 1.5.11
  • bug fixes for automated speed matching function of PurpleHat
  • fixed a bug with upgrading the node configuration to the latest version
  • added Plain English translation to LocoNet viewer
  • corrected a mistake in the assignment of BDL16 zones

2022/04/09

  • Version 1.5.10 with support for PurpleHat and automated speed matching
  • added WiThrottle client
  • improved LocoNet library
  • minor bug fixes

2021/12/17

  • Version 1.5.9 with improved support for RedHat
  • minor bug fixes

2021/10/23

2022/09/03 1.5.14

  • Version 1.5.14
  • switch to No OTA memory model due to code size
  • switch to 2.0.4
  • bug fix for PurpleHat SpeedMagic when using imperial dimensions
  • adding grade and superelevation data to PurpleHat from Stick IMU

2022/07/31

  • Version 1.5.13
  • Official support for WiThrottle and RedHat++ Shield
  • WiThrottle now with mDNS support

2022/05/10 Version 1.5.12 Improvements to the speed measurement algorithm, resulting in smoother display curve

2022/05/05 Version 1.5.11 bug fixes for automated speed matching function of PurpleHat fixed a bug with upgrading the node configuration to the latest version added Plain English translation to LocoNet viewer corrected a mistake in the assignment of BDL16 zones

2022/04/09 Version 1.5.10 with support for PurpleHat and automated speed matching added WiThrottle client improved LocoNet library minor bug fixes

2021/10/09

  • Version 1.5.8 with support for RedHat++
  • improved lbServer/lbClient
  • improved LocoNet library
  • minor bug fixes

2021/09/06

  • Version 1.5.7 Maintenance release
  • replaced NMRADcc library with latest version, enhances stability of DCC decoding
  • fix an error in the routine that stores the GreenHat configuration data to the flash drive

2021/07/24

  • Ready to release version 1.5.6 with new setup screen for GreenHat, including possibility to connect and drive relays and coil driver board
  • some minor bug fixes

2021/06/04

  • Ready to release new version 1.5.5 adding enabler function to event handler
  • adding analog scaler function to event handler to allow for changing ranges and slope of analog data input to adapt sensor input to the levels needed
  • adding swi ack command to event handler and GreenHat button command lists
  • some minor bug fixes

2021/05/22

  • Released new version 1.5.4 with some improvements in lbServer / lbClient
  • adding bounce filter for sensor inputs, requiring a 500ms stable input before sending report message to LocoNet

2021/05/06

  • Released new version 1.5.3 with some new features for the YellowHat (buttons now can send input report and switch state report directly, no event handler)
  • major improvement of the handshake between stick and web app in case of saving and loading disk files

2021/04/29

  • added support for input reports and switch reports to button inputs for YellowHat

2021/4/20

  • Released new version 1.5.2 to fix a problem with saving event handler data to the Stick. Plus some minor bug fixes and improvements to the GreenHat web app and library

2021/4/12

  • Released new version 1.5.1 with finalized GreenHat support and improved (more stable) storage for large configuration files

2021/4/10

  • Merged in Prerelease in preparation of new version 1.5.1

2021/3/27

  • Releases as 1.5.0 with support for GreenHat, BrownHat and new interfaces (lbServer, lbClient, loopback)

2021/3/20

  • added a LocoNet Loopback mode to the communication options. It allows for using devices with input and output functions without physical LocoNet

2021/3/7

  • created repository with preview of version 1.5 supporting TCP over LocoNet and GreenHat

iottstick's People

Contributors

tanner87661 avatar kiwi64ajs avatar rcflyer10 avatar mesheets avatar

Stargazers

Volker avatar  avatar Ellen Teapot avatar  avatar  avatar  avatar Christian K. Kier avatar  avatar  avatar Felice Vittoria avatar  avatar  avatar  avatar Joel Tanner avatar Ryan Freeman avatar  avatar vad babushkin avatar Mikael Sundin avatar  avatar Frénois alain avatar Alger PIke avatar Drew avatar Jonathan Mégevand avatar  avatar Michael Richardson avatar Scott Nelson avatar  avatar Norbert M avatar Dario Gerosa avatar  avatar  avatar

Watchers

Scott Nelson avatar James Cloos avatar Alger PIke avatar  avatar Michael Richardson avatar Dave Smith avatar  avatar

iottstick's Issues

Data not loading into page

Page are not loading properly. Especially if you press F5. If I refresh, I get the data loaded 1 in 10 tries. Some timing issue maybe.

image

Purple hat track measuring display not working.

Browser: Chromium Version 122.0.6261.57
OS: Ubuntu 20.04 LTS

IOTT stick firmware: Version 1.6.5

When I access the Purple hat tab I first get the following error:

PurpleHat.js:770 Uncaught TypeError: Cannot read properties of undefined (reading 'RGBVal')
at loadDataFields (PurpleHat.js:770:72)
at ws.onmessage (pageloader.js:645:5)

If I then switch to Track Data and "Track Measuring Data" or "Measurement Data" and click Start I get the following error:

SpeedDisp.js:62 Uncaught TypeError: Cannot read properties of undefined (reading 'LineGraphs')
at clearLineGraphData (SpeedDisp.js:62:32)
at clearAllGraphData (SpeedDisp.js:68:2)
at measureSpeed (PurpleHat.js:950:3)
at startMeasuring (PurpleHat.js:941:4)
at HTMLButtonElement.onclick (PurpleHat.htm:1:1)

Tried different browsers, etc same result.

Cheers
Ross

Direction of travel for DCC++ wrong

I think you got the direction of travel for the DCC++ command wrong.
In DCC++ 1 is forward and 0 is reverse I know.
In Loconet 1is reverse and 0 is forward I think.

So line 389 in IoTT_SerInjector.cpp should be something like:

sprintf(txMsg, "<t 1 %i %i %i>", cabAddr, transmitQueue[hlpQuePtr].lnData[4], !((transmitQueue[hlpQuePtr].lnData[5] & 0x20))>>5); //[4]: SPD, [5]:DIRF

Then I don't know if you got the speed steps right for DCC++ as in DCC++ the speed steps are from 0 to 126 and -1 is emergency stop. Does that match wit inData[4]?

Regards,
Harald.

macOS update

unable to update IoTT Stick via macOS

update.mac has the wrong (new line) character.

Giving the below error.

usage: esptool write_flash [-h] [--erase-all] [--flash_freq {keep,40m,26m,20m,80m}] [--flash_mode {keep,qio,qout,dio,dout}]
                           [--flash_size FLASH_SIZE] [--spi-connection SPI_CONNECTION] [--no-progress] [--verify] [--encrypt]
                           [--ignore-flash-encryption-efuse-setting] [--compress | --no-compress]
                           <address> <filename> [<address> <filename> ...]
" must be a numberh: error: argument <address> <filename>: Address "
usage: esptool write_flash [-h] [--erase-all] [--flash_freq {keep,40m,26m,20m,80m}] [--flash_mode {keep,qio,qout,dio,dout}]
                           [--flash_size FLASH_SIZE] [--spi-connection SPI_CONNECTION] [--no-progress] [--verify] [--encrypt]
                           [--ignore-flash-encryption-efuse-setting] [--compress | --no-compress]
                           <address> <filename> [<address> <filename> ...]
esptool write_flash: error: argument <address> <filename>: [Errno 2] No such file or directory: 'LNFP_M5Stick.spiffs.bin\r'

new macOS installations use \n as the newline character not the \r this causes, python to look at the wrong file names.

https://stackoverflow.com/questions/3821784/whats-the-difference-between-n-and-r-n

There was also something else with PySerial not being installed and Python bugging out during the install but I do not feel it's in the realm of your project to fix nor care.

Ryan

Purplehat HTML Page wasn't loading

Hello!

For some reason, I am unable to connect to the Purplehat HTML page (Firmware 1.5.12). It was working until the battery in my IOTT stick died while in use; I let it charge via a phone charger (plugged into the wall) for about 1 hour and then rebooted the stick.

The stick is able to show all data on the display, and it connects to WiThrottle. I can navigate to the main page and the Withrottle page without issues. However, when I try to load the Purplehat tab, the page never loads. I've attached a video:
https://user-images.githubusercontent.com/2058763/168412874-2f842f87-973e-4f7c-8350-6cce5a5e260d.mp4

This happens on mobile, Edge, and Firefox. Here's a video of Firefox; it appears to hang when fetching PurpleHat.js:
https://user-images.githubusercontent.com/2058763/168413120-a5d2881e-345f-44d9-974d-fefd85167c2e.mp4

Feature: Add a timeout popup if no user activity on web page

I am constantly leaving my purple hat configuration on and returning to a dead battery the next day.

If you could add a popup after a time of no user input to the website when the user does not respond it shuts the M5 down. Or
There could just be a time out field that is user selectable to shut the M5 down.

Today I had to reinstall the software on the M5 because the purple hat tab would not open after the loss of battery power.
I'm old so I don't think I can change. lol.

Mike

Doesn't build with latest ESP32 Core 2.0.3

Hi Hans,
I just tried to build the project in the Arduino IDE using the latest ESP32 core version 2.0.3 and found it wouldn't build.

I tried version 2.0.2 and it still failed so dropped back to 1.0.6 (last of the previous major version) and the build completed - albeit with a bunch of warnings.

I wonder if it might be useful to state in the README.md file the version of the ESP32 core used for the release build so others can be confident of reproducing your set of build files

Alex

Loconet interface (Build your own)

According to your schematics for the Loconet communication board, I have created an adjusted one. Since I do need only the Loconet communication and no separate loconet.
However I have forgotten to connect pins 2 and 5 of the loconet RJ45 connector.
For that I have created a wire bridge between the pin 5 and RXD.
But at my DCC command station Digikeijs DR5000 the Loconet led TX keeps active. And I don't seem to have any proper loconet communication between the command station and my breakout board. I do not receive any commands on ESP32, and commands from ESP32 don't end up at the command station.

Can you please help me out? Thanks.

This is my schematic:
ESP32 loconet breakout board.pdf

Placement of components at jlcpcb

I am trying to order a few loconet boards from jlcpcb. The components are placed at an offset in the preview. It says that jlcpcb will adjust the placement, but since this is my first time trying to use jlcpcb i am unsure if this is a normal offset or if I did something wrong.
Does the attached picture look like it does when you order pcbs?
image

/Magnus

Selecting function F10 or higher restarts redhat

When using IoTT WiThrottle server, pressing F10 or higher restarts the IoTT stick

Current setup:
Arduino Mega DCC-EX 5.0.6
IoTT stick 1.6.5
IoTT Redhat
IoTT Power Shield
Engine Driver on Samsung S8

  • I turn on WiThrottle on the Redhat and connect with Engine Driver.
  • I select one loco from EngineDriver.
  • I can activate functions F0-F9.
  • I press F10 or higher.
  • I see the screen of the M5 stick restart
  • Engine driver loses connection with the stick.

Websocket connection issue when using PurpleHat

Firmware Version: 1.6.3
Connection Type: WiThrottle Client
HAT: PurpleHat
Browser: Firefox
OS: Ubuntu

Am trying to run the speed matching tool on my stick, however for some reason I get a web socket timeout right before it completes the testing.

If I do a calibration using a max speed of 10km/h, 10 speed steps, 10 throttle steps - it loads ok.

If I do the same calibration using values of 80kmh, 80 speed steps, 126 throttle steps (NCE) - it times out at the very end (screenshot below)

image

Looking in the web developer console I see the web socket connection close, and the bottom panel (with the blue graph) doesn't load.

Any ideas what may be causing it?

Make update.bat Linux compatible

For the Windows version esptool.exe addresses the executable. The way update.bat is implemented esptool must be in the path. Removing the ".exe" extension makes the batch-file directly usable for Linux. Please remove ".exe"in a future version.

PurpleHat doesn't seem to be assigning DCC addresses from JMRI file for speed profiling

I'm trying to connect my Purplehat to a WiThrottle server, running IOTT Stick firmware version V1.5.19 (latest). However, I've noticed I'm having issues trying to run the speed profiler.

Below, you can see that Purplehat has a connection to my WiThrottle server - the IOTT stick has the IP address 192.168.45.2. However, you can also see that despite having a JMRI roster entry loaded the DCC address is still "n/a".
image

I can't seem to do anything to get it to respond or manually set the roster entry, either (I don't have a Loconet system to connect to).

Additionally - and maybe this is unrelated - the IOTT stick itself is not responding to the power button being held down. I can still cycle through the screens with the "main" button and I can still restart the stick from the web interface (restarting in the web UI doesn't seem to help at all, but I can see the uptime reset). It appears I'll have to wait for the battery to drain to turn the stick off and try again.

LED Chain - LED Command Sequence buttons broke if Individuals Colors

When trying to add another "THEN THAT" action to "Individual Color" enabled LED, the + button adds blank row.

Reproduction:

  1. Set multiple LED # (eg, 0,1)
  2. Choose type that supports adding multiple commands (Analog Value or DCC Signal)
  3. Enable "Individual Colors"
  4. In "THEN THAT" column, click the + button to add another row.

This will add a blank row. Sort of.

Further testing show that the row was added, but not shown. If you click the + button a few more times, then toggle the "Individual Colors" box off then back on, you will see all the rows you added.

Also, if you have multiple rows (eg. 10) and click on the + at row 1, all the rows below are hidden. Again goggle to make appear again.

Tested with 1.5.18 in Blue Hat mode. Possibly same in other HAT modes.

image

Redhat freezes after running for a few days

With 1.6.7, the RedHat I found frozen after a few days. Not sure if there is a memory leak. If I reset, it will happen again after a few days. I'm going to leave it on the uptime screen to get exact time next time it stops.

To help, can a new screen be added to the LED panel with the following?

  • uptime (moved from battery/power screen)
  • stick temp (moved from battery/power screen)
  • Available RAM/Flash
  • Date / Time:

This also leaves all the battery and power alone on one screen.

Possible Issue on First-Boot Wifi config

Hi,

First let me say that I really like what you are doing pushing the envelope on train communications. I have watched most of your videos and appreciate the level of content and thoroughness that you approach every topic.

I was able to get IoTTStick running on an AI Thinker ESP32-cam. I ran into an issue that I believe I have run into before which is that an ESP32 will connect to the first AP that allows association, but may not be open. This fools the ESP32 into thinking it has a good connection when it doesn't. Yes, it has dhcp'd successfully, but can't pass packets.

Even if the ESP32 is successful and connects to an open AP, the question, in crowded areas, is which one? The associated AP's SSID doesn't seem to be documented/announced anywhere, or maybe I missed it?

I'm sure you can see where I'm going. With the current Wifi config hierarchy of client, AP, Client+AP, it is easy to get stuck as a client to a wrong AP.

I believe it would be a best practice to always first-boot into AP mode and allow the user to set preferences and credentials.

I hope you find this of help.

Best,

Mike

Redhat crashes when creating a consist

This is same content as email. Just better here for tracking.

When using IoTT WiThrottle server, adding a second locomotive to a consist crashes the redhat.

Current setup:
Arduino Mega DCC-EX 5.0.6
IoTT stick 1.6.4
IoTT Redhat
IoTT Power Shield
Engine Driver on Samsung S8

  • I turn on WiThrottle on the Redhat and connect with Engine Driver.
  • I select one loco from EngiveDriver and I can turn on and off the light and move the train.
  • I now try to add a second loco in consist.
  • Engine Driver seems ok
  • I see the screen of the M5 stick restart
  • Engine driver loses connection with the stick.

LED Chain - Losing LED settings when I save and restart

Settings in the LED chain are getting last after save and restart when 'Individual Colors' is chosen. I enter all this data.
image

then, when I press save and restart, this is what it changes to.
image
As seen, the UI has set them all to "Select LED 1" and many colors setting are blank.

Stranger still, when I test it with JMRI, it only wants to change LED 2 in my neopixel even though the UI only ended to with LED 1 settings.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.