Hello,
I am trying to use the lightning detector with a Raspberry Pi. I haven’t seen any librarys that are available using the SPI interface, since the I2C is “not supported” for this product.
Using SPIdev, I am trying to read the registers, but always returns zeros, no matter what register I try to read.
I did try connecting the SPI read and write pins together to test as a loop back, and I was able to see data.
First I am confused as to if the CS pin is an active low or an active high. Looking at webpage for the lightning detector it seems to indicate a silkscreen issue. When looking at the spec for the chip, it says it is an active low, and on the schematic for your board it shows a pullup resister, which would indicate it is an active low.
Here is the code that I am using to try to read the register…
import spidev
spi = spidev.SpiDev()
spi.open(0,0)
spi.max_speed_hz = 244000
spi.mode = 0b01
x = spi.xfer2([0x40,0x00])
print(x[0])
print(x[1])
spi.close
I have also tried to use the following and get the same results…
changed x=spi.xfer2 to:
spi.writebytes([0x40, 0x00]) #0x40 set to read mode and register 0
x=spi.readbytes(2)
print(x[0])
print(x[1])
lightning Detector is connected to Raspberry Pi as follows:
pin 19 (MOSI) to MOSI on lightning detector board
pin 21 (MISO) to MISO on lightning detector board
pin 23 (SCLK) to SCLK on lightning detector board
pin 24 (CE0) to CE on lightning detector board
Any help in finding what I am missing here would be greatly appreciated