Jump to content
chicken

[POTM] dAISy - A Simple AIS Receiver

Recommended Posts

@chicken

Thank you so much for answering my questions.
I am really new in this field (embedded programming) but I have done couple programming tasks in Pascal and C/C++.

Just want to make things clear, 
So Debug_Messages and Test_Mode only works for CCS IDE?
If I remove 
#define Debug_Messages and #define Test_Mode, can your dAISy still run?

Share this post


Link to post
Share on other sites

Yes, you can remove both and it will still work.

#define TEST would enable extra code. I used that during development for testing the NMEA code without a radio. As long as the project does not define it, the test code will be skipped. It's not enabled in the code, so you don't have to worry about that.

#define DEBUG_MESSAGES is useful to get more information about the radio communication. I would leave that in until you got the receiver working, as it will help you tracking down what's going on.

 

Share this post


Link to post
Share on other sites

Thank you @chicken

Actually, my msp430G2553 was broken somehow. But, I have some PIC16F877A in my home. I was wondering if I can use PIC16F877A instead of msp430G2553.
What do you think? Is it feasible to use PIC16F877A with si4362 as AIS receiver? I believe converting msp430 code to PIC16F code isnt a big deal.

Share this post


Link to post
Share on other sites

The radio will work with any MCU.

But in my project, you will have to rewrite anything that's hardware dependent. From top of my mind, that's spi.c, serial.c, GPIO interrupts in packet_handler.c, plus any interaction with GPIO like LEDs etc.

Share this post


Link to post
Share on other sites

thank you @chicken

i encountered a problem.
In PIC16f877a, the data bank memory only 96 byte.

but in your fifo.c, you set the fifo array buffer for 128 byte  and and 256 byte with fifo packet 8 byte.

I have looked for the AIS signal and it only consist of 256 bit or 32 byte. Is it possible to use PIC16f877a with only 96 byte to fifo buffer? thank you once again.

Share this post


Link to post
Share on other sites

Hi @andimmike15

AIS messages can be longer than 32 bytes, for example message type 5 which includes the ship's name is 424 bits / 53 bytes.
http://catb.org/gpsd/AIVDM.html#_type_5_static_and_voyage_related_data

You could filter messages to only receive the position messages (types 1, 2, 3, 4, 9 and 18) by evaluating the message type at line 261 and resetting the packet handler state machine in case of an unwanted message.

Keep in mind, that while the received message is converted to NMEA0183, a new AIS message may start arriving. So allocate a few bytes more for the FIFO than the minimal message length (21 bytes for the above, so maybe make the FIFO 32 bytes long). Note that due to its current implementation, the FIFO length must be a power of two.

Setting FIFO_PACKETS to 2 is the minimum, again because a new packet may arrive while the first isn't fully processed yet.

Another big chunk of memory is in the NMEA encoding section. If filtering AIS messages, you can squeeze out a few bytes by limiting the maximum size of the NMEA payload to 21 bytes (nmea.c line 19), which translates to a NMEA output buffer of 43 bytes. You could shave of a few more bytes by not storing the AIVDM lead-in in the buffer but directly outputting it on serial.

Still, squeezing everything into into 96 bytes of RAM will be quite a challenge. The MSP430G2553 has a luxurious 512 bytes.

 

 

Share this post


Link to post
Share on other sites

For all you AIS home-brewers out there: I've added the TAI-SAW TA0395A SAW filter to my Tindie store.

https://www.tindie.com/products/astuder/tai-saw-ta0395a-saw-filter/

This bandpass filter covers 6 MHz in the marine VHF band and can be found in many commercial AIS receiver and related equipment. As often with parts from specialist vendors, it is hard to come by without writing an RFQ and/or begging for samples. So I thought I'd sell some of my stash to fellow tinkerers.

Share this post


Link to post
Share on other sites

hello @chicken.

I have given up about using PIC. Now i move back to MSP430. But, there is some errors again. I didnt receive anything. I actually use my own AIS transponder. I live far away from ocean so I use my own transponder. 
I start to think if I can generate a dummy AIS signal through si4362 because I am not so sure where is the problem. Do you think it is possible to generate dummy AIS signal to si4362?

Share this post


Link to post
Share on other sites

Hi @andimmike15

To debug the application, I'd go through the following steps:

1. Write something on the serial console to make sure that end works (uart_init, uart_send_string)

If that doesn't work, search this forum for tips on setting up serial output from your model of the LaunchPad.

2. Read the Si4362's part information and compare it to what's expected per datasheet (radio_setup, radio_part_info, radio_buffer.part_info.part_msb, radio_buffer.part_info.part_lsb)

If you don't get the expected values (e.g. 0x43 for the msb, 0x62 for the lsb if you're using an Si4362), then something with the SPI connections is wrong.

3. Toggle LEDs in strategic locations in the packet_handler ISR, to see whether raw data and clk bits from radio arrive at the MCU and the interrupt is invoked.

If that doesn't work, check that the correct radio and GPIO pins are connected.

If all the above works, then you're ready to worry about the actual AIS signal. That side is hard to simulate without an AIS target, but your transponder would be a good start. But be careful to not damage the Si4362 with a too strong signal. Directly connecting the transponder with the receiver will destroy the receiver.

Let me know if this helps, or where on that list you get stuck.

 

Share this post


Link to post
Share on other sites

Hi, I just got a dAISy 2 to test it, planning to use it to stream AIS data to a server, to setup an open API.

I’ve tried to open a UART connection both from usb than from AUX Serial port on the back.
I saw the led blinking indicating the dAISy is in receiving mode, but I’ve got no data on the serial.
The place where I’m now is quite far from the sea, so no surprise for now, but is there some way to test the connection, or should it print something anyway?
Like some keyword to transmit on the serial to retrive some configuration data at least?
 
thank you
 
 

Share this post


Link to post
Share on other sites

Hi @pileoni

You can use a terminal program like Putty on Windows to connect to dAISy. Pressing ESC will bring up a debug/configuration menu. There, you can start a test mode by pressing T and then ENTER. dAISy will start outputting an AIS message every 5 seconds.
 
Alternatively, while in regular receive mode, you can send & to get dAISy to respond with its serial number.
 
Let me know if this helps.
 
Best Regards,
Adrian
 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×