Close

Packet Stream

A project log for Star Trek Communicator Badge

In the true spirit of Star Trek, this communicator badge is completely autonomous, while fitting in the form factor of an original badge

JoeJoe 07/01/2017 at 17:216 Comments

Finally! A reliable data stream!

I decided to ditch the efforts I had given into a bit stream (i.e. infinite length packet) and tried to squeeze as much data into a stream of packets.

The packet system in the RFM69HCW allows for a packet length of 64 bytes, where 3 bytes are overhead. So this is effectively 61 bytes per packet. If I want to transmit at an audio Bandwidth of 8kHz (transmission rate of 16kBps) I need to send a packet about every 62 us.

This means that I need to send a full 64-byte packet faster than 61bytes * 62us/byte = 3782us (don't forget we need the time to load the packet into the FIFO via SPI). So, if we run the bit-rate of the transmitter at 100kbps that means we transmit 64 Bytes in 640 us. Plenty fast.

The SPI transactions now need to run as fast as possible to load the fifo in 3782us - 640us = 3142us. We have to transmit at a fast rate for this. This means overloading the base RFM69 class to run at the full SPI clock rate instead of 1/4. So if we can get the SPI running at 5MHz, we can send:

This leaves us with plenty of time (3ms) to do ADC conversions (which can be slow), read interrupts, etc. So sending 8-bit audio at a reasonable bit-rate is totally achievable.


In practice I have found that for human voice we can drop the bit rate to 10kBps. This allows us to push some of the deterministic tonal noise out of the human audible range and has no effect on Bandwidth quality.

Here's a demo for you to try yourself: https://cdn.hackaday.io/files/19700842844800/PacketStreamDemo.zip

Discussions

TheotherMike wrote 08/05/2017 at 19:05 point

Edit : downloaded current lowpowerlabs RFM69 lib, as well as the spiflash lib. After device start receiver only gives out a hum. No chirps etc possible.

  Are you sure? yes | no

Arsenijs wrote 08/05/2017 at 23:14 point

Oh my gosh, this is what Pastebin is for =D Also, what if you read through those last lines in German - what do they say?

  Are you sure? yes | no

TheotherMike wrote 08/06/2017 at 08:32 point

My appologies, Sir. Was not my intention to overload the comment section. My IDE somehow had a link to a second lib folder with a different SPI-lib. I deleted it and copied the freshly downloaded SPIflash into the original Arduino lib folder. Now it compiles, unfortunately still the devices cannot start a communication.

  Are you sure? yes | no

Joe wrote 11/27/2017 at 00:30 point

Let me upload the exact code versions I am using. Maybe the RFM69 library has changed slightly since I last downloaded it.

  Are you sure? yes | no

Joe wrote 07/21/2017 at 01:31 point

Note: you should now be using the latest RFM69 library from low power labs

  Are you sure? yes | no

TheotherMike wrote 07/20/2017 at 08:20 point

Tested it two days ago but was not working for me (not even a chirp after tapping)....will try again next days.

  Are you sure? yes | no