Coder Social home page Coder Social logo

Comments (24)

ironsheep avatar ironsheep commented on September 23, 2024

I can help if you are willing to do a bit of the work ;-) The two interfaces from a python code perspective should be pretty similar.

At first blush the worklist appears to be:

  • locate SPI python code that we can pattern after (do you have any, or know of, working examples?)
  • adapt the current code to select between SPI/i2c with new config.ini setting
  • add the SPI code and runtime switch between
  • test the new SPI support (code and setup docs) against a sensor board... to prove it all working
  • adjust the setup part of the README to describe what's needed to enable SPI (or i2C) depending on which the user wants.
  • release the new version to the repo.

I'm in the midst of a number of small projects (pretty much my life all the time ;-) but I can put some time into this if you will too.

Thoughts?

from lightning-detector-mqtt2ha-daemon.

terrycarlin avatar terrycarlin commented on September 23, 2024

from lightning-detector-mqtt2ha-daemon.

ironsheep avatar ironsheep commented on September 23, 2024

Nice, I'll lead off while you are wiring up by adding the config option in the code to select between SPI/I2C... I'll send a .zip to you... you can contact me at [email protected] by email and I'll send it by return email...

Oh, hey alternatively, how about you just work with the content I push to the 'feature_add_spi_support' branch. Then i don't have to email anything... just thinking out loud here ;-)

Let me know if you are not comfortable playing in the source and then I can do the adaptation of SPI once you have working examples...

from lightning-detector-mqtt2ha-daemon.

lightmaster avatar lightmaster commented on September 23, 2024

Any progress with this?

from lightning-detector-mqtt2ha-daemon.

terrycarlin avatar terrycarlin commented on September 23, 2024

from lightning-detector-mqtt2ha-daemon.

lightmaster avatar lightmaster commented on September 23, 2024

I was planning to attempt this by moving HA from the Hassio minimalist OS to full Raspbian running Hassio Supervised in Docker, however my RPi 3B seems to be running out of memory with HA and everything going when it's installed on Raspbian. Memory usage upwards of 800MB then locks up. Can't figure out how to install Python3 on the Hassio OS version yet.

from lightning-detector-mqtt2ha-daemon.

terrycarlin avatar terrycarlin commented on September 23, 2024

from lightning-detector-mqtt2ha-daemon.

lightmaster avatar lightmaster commented on September 23, 2024

I've moved HA onto my DS920+ and am gonna setup the RPi 3B to try to figure out the SPI interface of this detector. Goal will be to have the RPi 3B interface over SPI with the detector board, and the RPi will connect to HA's MQTT broker that's running on my DS920+, that way HA and all its addons get to benefit from 20GB of RAM and won't be running out of memory like it was on the RPi 3B.

from lightning-detector-mqtt2ha-daemon.

lightmaster avatar lightmaster commented on September 23, 2024

I took a bunch of code from the RaspberryPi-AS3935 library to test out the code.

I tried out this library too, but it would not connect, with the lightning.connected variable always reporting as false even when using a very simplified code. I ended up using the steps at SparkFun to set the board to I2C. So far the strikes nearby that I can hear myself correspond to to an increase on the Lovelace Card.

from lightning-detector-mqtt2ha-daemon.

terrycarlin avatar terrycarlin commented on September 23, 2024

from lightning-detector-mqtt2ha-daemon.

fugazzy avatar fugazzy commented on September 23, 2024

I ended up using the steps at SparkFun to set the board to I2C. So far the strikes nearby that I can hear myself correspond to to an increase on the Lovelace Card.

I am having the same issues, but I could not solve them yet. Here I described what I tried:
https://community.home-assistant.io/t/lovelace-lightning-detector-card-for-as3935/214167/6?u=fugazzy
Can you give me a hint?

from lightning-detector-mqtt2ha-daemon.

ironsheep avatar ironsheep commented on September 23, 2024

FYI- the new SPI addition just started working today. I'm finishing the addition an antenna tune portion next.
IMG_7777

Feel free to run the code from the /develop branch while you wait for the next release!

from lightning-detector-mqtt2ha-daemon.

terrycarlin avatar terrycarlin commented on September 23, 2024

from lightning-detector-mqtt2ha-daemon.

lightmaster avatar lightmaster commented on September 23, 2024

Tomorrow, I'll reconfigure my sensor to use SPI like the manufacturer suggests and see how well the develop branch works. Well, suppose I'll wait around until the next storm to actually make sure that it's working, but it is summer here in the Southeast US, so the next storm should be within a few days.

from lightning-detector-mqtt2ha-daemon.

ironsheep avatar ironsheep commented on September 23, 2024

@lightmaster good, I'll look forward to hearing of your results.

from lightning-detector-mqtt2ha-daemon.

ironsheep avatar ironsheep commented on September 23, 2024

@terrycarlin take a look at this: https://github.com/ironsheep/lightning-detector-MQTT2HA-Daemon/blob/develop/THEOPS-SPI.md

Please let me know what you think...

from lightning-detector-mqtt2ha-daemon.

lightmaster avatar lightmaster commented on September 23, 2024

When disabling I2C on the Sparkfun AS3935, after you cut CS and reconnect SI, does it matter whether or not you also cut the I2C PU?

from lightning-detector-mqtt2ha-daemon.

ironsheep avatar ironsheep commented on September 23, 2024

Only cut/short the trace(s)/pad(s) indicated by sparkfun in their docs.
I would do the least amount of work to get SPI to work. If you want to go back to I2C you'll have less to undo.

Which version of their board do you have? Once I know I can then give a more precise answer if needed...

from lightning-detector-mqtt2ha-daemon.

lightmaster avatar lightmaster commented on September 23, 2024

The same version depicted at the Sparkfun guide v20. I followed their directions to enable I2C originally, so I cut the trace SI and connected CS, then connected the middle and right pads on the I2C PU.

from lightning-detector-mqtt2ha-daemon.

ironsheep avatar ironsheep commented on September 23, 2024

OK, reviewing your version (I have the Qwiic version - older model)
You do have to reverse the "Select Interface" shorts/opens.

The "I2C Pull Up Resistors" should be fine without reversing them.

As a note: my board uses 2.2K resistors which are connected all the time where yours' are open but you've shorted the middle and right pads. This will likely work without further change. If they weren't shorted before you awakened I2C then you should also be safe by removing the shorts.

But please let me know.

from lightning-detector-mqtt2ha-daemon.

lightmaster avatar lightmaster commented on September 23, 2024

Its now setup to use SPI using the develop branch. After starting PiGPIOd before manually running the script, I didn't get any errors. I set the service to log to syslog so I can see any errors that might popup and its now running as a service, waiting for a storm to roll by.

from lightning-detector-mqtt2ha-daemon.

ironsheep avatar ironsheep commented on September 23, 2024

from lightning-detector-mqtt2ha-daemon.

ironsheep avatar ironsheep commented on September 23, 2024

Your pull request is merged and this SPI support is now released and avail in v2.2.0 and later.

from lightning-detector-mqtt2ha-daemon.

terrycarlin avatar terrycarlin commented on September 23, 2024

from lightning-detector-mqtt2ha-daemon.

Related Issues (20)

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.