Home  |  Contents 
Microcontroller and PC projects
  Forum Index : Microcontroller and PC projects         Section
Subject Topic: AS3935 lightning detector Post ReplyPost New Topic
<< Prev Page of 5 Next >>
Author
Message << Prev Topic | Next Topic >>
Justplayin
Senior Member
Senior Member
Avatar

Joined: 31 January 2014
Location: United States
Online Status: Offline
Posts: 248
Posted: 30 June 2017 at 1:13am | IP Logged Quote Justplayin

Quote:
AS3935_CAPACITANCE = re*8

That fixed the problem with wrong value being returned. Unfortunately after doing the setcap routine the program no longer responds to disturber/lightening events, even if I used the same cap value the program started with. If I re-run the program it works again until I do the setcap.

Moved on to trying to produce a lightening interrupt. Eventually, out of frustration, I started plugging random values in for registers 0 and 1 until I finally produced a lightening interrupt. Then the program crashed due to a rogue semi-colon.

CASE 1
  lightning_dist_km = AS3935_GetLightningDistKm();


Now I need to go back and work out what the values really should be using my random values as a starting reference. The weather channel is predicting thunder storms this weekend... Hopefully I can work them out by then.

--Curtis

__________________
I am not a Mad Scientist... It makes me happy inventing new ways to take over the world!!

CGCOLORMAX2, CGMMSTICK1, DUINOMITE-MINI, MICROMITE-150, MICROMITE-170, SKINNYMITE, Explore64


Back to Top View Justplayin's Profile Search for other posts by Justplayin
 
TassyJim
Guru
Guru


Joined: 07 August 2011
Location: Australia
Online Status: Offline
Posts: 2257
Posted: 30 June 2017 at 1:30am | IP Logged Quote TassyJim

That rogue semicolon is what happens when you translate arduino code and don't check things well enough.
I hope that's the only one I missed.

I am going to write a setup program that lets you play with most of the settings.
Hopefully, it works better than my present cludge.

I would like a bit more information about some of the settings but the chip manufacturer wants you to purchase their development board before you get the setup application notes.

No sign of thunder storms here, just warnings about snow.

Jim

__________________
It all started with the ZX81....
VK7JH
http://www.c-com.com.au/MMedit.htm
Back to Top View TassyJim's Profile Search for other posts by TassyJim Visit TassyJim's Homepage
 
Justplayin
Senior Member
Senior Member
Avatar

Joined: 31 January 2014
Location: United States
Online Status: Offline
Posts: 248
Posted: 30 June 2017 at 4:18am | IP Logged Quote Justplayin

TassyJim wrote:
I am going to write a setup program that lets you play with most of the settings.

Can't wait! Assembling the bits by hand is a real pain.

Quote:
I would like a bit more information about some of the settings but the chip manufacturer wants you to purchase their development board before you get the setup application notes.

That explains why the development board is outlandishly expensive and wny the data sheet is lacking in some detail.

Quote:
...just warnings about snow.

You can always hope for some rare "thunder snow".

--Curtis

__________________
I am not a Mad Scientist... It makes me happy inventing new ways to take over the world!!

CGCOLORMAX2, CGMMSTICK1, DUINOMITE-MINI, MICROMITE-150, MICROMITE-170, SKINNYMITE, Explore64
Back to Top View Justplayin's Profile Search for other posts by Justplayin
 
TassyJim
Guru
Guru


Joined: 07 August 2011
Location: Australia
Online Status: Offline
Posts: 2257
Posted: 30 June 2017 at 4:52am | IP Logged Quote TassyJim

Justplayin wrote:

Quote:
...just warnings about snow.

You can always hope for some rare "thunder snow".

--Curtis

A thunder storm when the hills are covered in snow is impressive to view.
But not so impressive if you work for the local electricity mob and are on call

Jim

__________________
It all started with the ZX81....
VK7JH
http://www.c-com.com.au/MMedit.htm
Back to Top View TassyJim's Profile Search for other posts by TassyJim Visit TassyJim's Homepage
 
Phil23
Guru
Guru


Joined: 27 March 2016
Location: Australia
Online Status: Offline
Posts: 1137
Posted: 01 July 2017 at 2:31am | IP Logged Quote Phil23

Hi Jim & Curtis,

I'm hoping to set something up to start giving this a try this weekend.
Either an E64 or the Original Backpack.

On the topic of using the Backpack, I presume the code should be fine if I disable the Display & Touch, but what if I decided to display the output on the LCD?

Is that a doable option or is it not possible to use SPI for anything other than the display & touch.

The E64 is a bit hard to add a display to without building a birds nest...

But the other Option I have is to stick a 2.8" screen on a SnadPic;
I do have a couple of Piggy Back boards to do that. (Thanks Palcal).

Regards the calibration, I did email their support as they suggest & they replied with a value of 80pF.

Thanks

Phil.

Back to Top View Phil23's Profile Search for other posts by Phil23
 
TassyJim
Guru
Guru


Joined: 07 August 2011
Location: Australia
Online Status: Offline
Posts: 2257
Posted: 01 July 2017 at 2:59am | IP Logged Quote TassyJim

Provided you have use chip select pin on the display, you should be able to have both devices co-existing.
That is why I only turn the SPI on during read/write operations and leave it fee when not in use.
Once setup, the lightning detector doesn't initiate traffic on the SPI. It only triggers an interrupt when it has something to say. There are no critical timing events to worry about.

Jim


__________________
It all started with the ZX81....
VK7JH
http://www.c-com.com.au/MMedit.htm
Back to Top View TassyJim's Profile Search for other posts by TassyJim Visit TassyJim's Homepage
 
Phil23
Guru
Guru


Joined: 27 March 2016
Location: Australia
Online Status: Offline
Posts: 1137
Posted: 01 July 2017 at 5:23am | IP Logged Quote Phil23

Thanks Jim,

Getting to it.

It will go on a solderless board for starters, but just curious as the whether you went with straight or 90 header pins.

90 ones might.... or might not....
stand the aerial at the top in the final device.

I see a 50% chance of deciding I made the wrong decision at a later stage.

Phil.
Back to Top View Phil23's Profile Search for other posts by Phil23
 
TassyJim
Guru
Guru


Joined: 07 August 2011
Location: Australia
Online Status: Offline
Posts: 2257
Posted: 01 July 2017 at 7:15am | IP Logged Quote TassyJim

Phil,
Geoff's new update to MMBasic has:
Quote:
New Features:
. Relaxed error checking on I2C addresses to allow addresses 7 and below to be used.

That means you can use I2C to talk to the sensor if it makes sharing easier for you

I don't think it will make any difference to the ability of the sensor to do it's job, but it is good to have the choice of communication modes.

Jim

__________________
It all started with the ZX81....
VK7JH
http://www.c-com.com.au/MMedit.htm
Back to Top View TassyJim's Profile Search for other posts by TassyJim Visit TassyJim's Homepage
 
Phil23
Guru
Guru


Joined: 27 March 2016
Location: Australia
Online Status: Offline
Posts: 1137
Posted: 01 July 2017 at 9:16am | IP Logged Quote Phil23

Thanks Jim,

I hadn't seen 5.04.05 until you mentioned it.

Too busy carting firewood in & fitting a new fan to the wood heater.

Expecting a few cold night; the type you are probably not accustom to.

-2C last night & heading for the same again tonight; already down to 5.

Phil.
Back to Top View Phil23's Profile Search for other posts by Phil23
 
Justplayin
Senior Member
Senior Member
Avatar

Joined: 31 January 2014
Location: United States
Online Status: Offline
Posts: 248
Posted: 01 July 2017 at 11:56pm | IP Logged Quote Justplayin

Played around with the register values trying for maximum sensitivity and came up with following: (your actual mileage may vary)

Register 0 - 3Eh
Register 1 - 11h
Register 2 - C0h


We had a lightening storm!!!

The good news is I had lightening events triggered, and the distances readings diminished as the storm got closer.

The bad news... As the storm moved away, the chip continued to output the distance of the closest event it recorded. The energy readings dropped, but the estimated distance remained at a constant 1km. I'm not sure how to handle this problem at the moment.

--Curtis







__________________
I am not a Mad Scientist... It makes me happy inventing new ways to take over the world!!

CGCOLORMAX2, CGMMSTICK1, DUINOMITE-MINI, MICROMITE-150, MICROMITE-170, SKINNYMITE, Explore64
Back to Top View Justplayin's Profile Search for other posts by Justplayin
 
TassyJim
Guru
Guru


Joined: 07 August 2011
Location: Australia
Online Status: Offline
Posts: 2257
Posted: 02 July 2017 at 2:04am | IP Logged Quote TassyJim

It is odd to have users of electronic equipment happy about electrical storms!

Going by your settings, I assume you have a quite location as far as radio is concerned.
I don't know why the device didn't detect the storm receding. Perhaps clearing the stats would help but according to the data sheet, it should work without any intervention.

Jim

__________________
It all started with the ZX81....
VK7JH
http://www.c-com.com.au/MMedit.htm
Back to Top View TassyJim's Profile Search for other posts by TassyJim Visit TassyJim's Homepage
 
Phil23
Guru
Guru


Joined: 27 March 2016
Location: Australia
Online Status: Offline
Posts: 1137
Posted: 06 July 2017 at 7:47am | IP Logged Quote Phil23

Finally got to have a look at this, but not sure I'm getting the expected results.

wrt: 81 Act: 81
Frequency: 517424
New tuning capacitor (1 - 120pF)? 80
wrt: 8A Act: 8A
capacitance set to 8x10 = 80pF
Capacitor set to 80pF

Frequency: 501728
New tuning capacitor (1 - 120pF)? -1
Playing With Fusion: AS3935 Lightning Sensor, SEN-39001-R01
beginning boot procedure....
wrt: 24 Act: 24
wrt: 20 Act: 20
wrt: 00 Act: 00
wrt: 24 Act: 24
set up for indoor operation
wrt: 01 Act: 00
disturber detection enabled
wrt: 00 Act: 00
wrt: 01 Act: 01
capacitance set to 8x1 = 8pF
AS3935 manual cal complete

17:43:07  06-07-2017
Reg &H00: 24
Reg &H01: 22
Reg &H02: C2
Reg &H03: 00
Reg &H04: 00
Reg &H05: 00
Reg &H06: 00
Reg &H07: 3F
Reg &H08: 01
AFE Gain Boost:       10010
Power-down:           0
Noise Floor Level:    010
Watchdog threshold:   0010
Clear statistics:     1
Minimum num lightning:00
Spike rejection:      0010
Freq div -ant tuning: 00
Mask Disturber:       0
Interrupt:            0000
Energy LSB:           00000000
Energy MSB:           00000000
Energy MMSB:          00000
Distance estimation:  111111
Display LCO on IRQ:   0
Display SRCO on IRQ:  0
Display TRCO on IRQ:  0
Internal Tuning Caps: 0001
Energy:   0


It doesn't seem to be responding to the emulator.
Also says the capacitor is set to 8pF after I enter 80; have I missed something in the thread?

It's currently on a 28 pin backpack, screen & touch not configured.
Using I2C (Ver 5.04.05) & Pin 16 for the Irq.

Any thoughts?

Phil.
Back to Top View Phil23's Profile Search for other posts by Phil23
 


<< Prev Page of 5 Next >>
In the news...
 
Post ReplyPost New Topic
Printable version Printable version
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum

Powered by Web Wiz Forums version 7.8
Copyright ©2001-2004 Web Wiz Guide

This page was generated in 0.1094 seconds.
Privacy Policy     Process times : 0, 0, 0, 0.11