Shop OBEX P1 Docs P2 Docs Learn Events
Manchester Code — Parallax Forums

Manchester Code

Can Manchester encoder and decoder code fit in a BS2?

Discovery

Comments

  • Manchester coding is relatively simple ... see the Wikipedia article on the subject. The issue is that the BS2 is quite slow. Instructions take hundreds of microseconds to milliseconds to execute. You might be able to encode or decode a few bits a second ... enough for a science fair demonstration, but not anything practical. What are you trying to do?
  • Building and RF communication link using Linx TXM-916-ES transmitter with an ANT-315-SP antenna then for reception using a Linx RXM-916-ES receiver and ANT-315-SP antenna. I thought that I could include a Manchester encoder in the BS2 that gathers the control selections and include a Manchester decoder in a second BS2 that drives the controlled devices.

    Since the BS2 is slow can you recommend a a non-obsolete CMOS Manchester chip that would do the encoding and the decoding.

    Discovery
  • ElectrodudeElectrodude Posts: 1,614
    edited 2017-10-24 04:20
    The Propeller could be made to do it easily, probably into the megabaud range.
  • I have a few propeller ICs...how can it be accomplished?

    Discovery
  • Someone has already done Manchester encode/decode on a Propeller (Did you try searching the forums?). There's an object in the Object Exchange that uses it.
  • I did a search for "Parallax Propeller RF Communication Applications" and found a discussion of using a BS2 with a 433 MHz transmitter and receiver IC to send the ASCII letter "E" from one BS2 to another BS2 using the serial out command.

    My original design was to use the BS2 serial out command to send a data packet to a Linx transmitter and antenna chip then receive that data at another BS2 via a second antenna chip and a Linx receiver chip.

    In the Linx data sheet they strongly recommend that a coding algorithm be used on the data before being sent to the Linx transmitter to reduce transmission errors. This is the point where I asked if a Manchester code could be inserted into the BS2.

    Is there a built-in error reduction coding method included in the Parallax 433 MHx transmitter/receiver chip? This would be the answer if it does.

    Discovery

  • Mike GreenMike Green Posts: 23,101
    edited 2017-10-24 14:47
    No. There's no built-in error reduction in the 433 MHz T/R chip. Depending on the range and noise in the environment, some people have simply transmitted the same message several times or transmitted normal and inverted copies of the message or used simple checksums or CRCs. For more complex messaging, you'd be better off with a pair of xBee devices.
  • I searched for a Parallax 433 MHz transmitter/receiver chip but found devices for Ardunio...not for parallax.

    Apparently the 433 MHz T/R chip referred to in the article is a general purpose 433 MHz T/R chip.

    Yesterday, I ordered the Linx T/R and antenna set so when the parts arrive, I will perform a communication test as described in the Parallax "What is RF" application.

    Discovery
  • Okay...I found the 433 MHz Transceiver in the Parallax store #27982 which uses a Linx TXM chip. It appears that my communication problem is solved.

    Discovery
  • I believe these T/R chips were developed for garage door openers and other remote control functions. They were intended for short range operation using an external encoder / decoder.
  • According to the data sheet for the 27982 transceiver, it can handle line of sight to 250 feet which is good for my application. The data also states that it is not immune to noise and protocol code must be included in the micro controller...which is available on the website.

    Discovery
  • Discovery wrote: »
    I have a few propeller ICs...how can it be accomplished?

    Discovery

    If you type "Manchester" in the top right search bar, there are a few threads that deal with the Propeller.

  • What kind of "controlled devices" are you talking about? That may determine how much redundancy / error detection is needed.

    The BS2 example code for the 27982 transceiver will handle strings of up to 16 characters and adds a 16-bit CRC. If any of several consistency checks fail on the receive end or the CRC is in error, the received message is displayed as in error. These examples are not complete applications. For example, what if there's an error? Does the receiver code acknowledge success or failure? Does the transmitter code re-transmit the data packet? Are the packets numbered? What if the acknowledgment is corrupted?

    Seriously consider the xBee-PRO-802.15.4 (#32419) plus adapter (#32401). It has an urban range (min.) of 300ft and takes care of buffering, error detection and correction. The attached microcontroller sees what appears to be a wired serial connection.
  • That was a good read.

    My application deals with sending the position of 8 switches in either the "ON" or "OFF" position of each. For example, switch #1 has positions "A" or "B"...switch #2 has positions "C" or "D", etc. Whenever a switch position is changed, a data packet is generated that includes a START code to wake-up the transmitter and receiver, the ASCII code for the changed switch position is next, and followed by a STOP code.

    Years ago, a company I worked for implemented a triple redundant communications link at Vandenburg AFB in California. I wanted to use three separate fiber optic cables but the Air Force provided only a single fiber, so to implement triple redundancy the messages were made short, sent three times, and tested for two out of three matches for an acceptance.

    I plan to do the same when I get my hardware.

    The reason I am investigating this communication method is that I have a system that uses a commercial household data packet token passing protocol that sends module addresses along with command data. When a module recognizes its address on the RF link it performs the command. The problems are that it is for indoor use where my application is for outdoor and it is susceptible to RF interference. I hope to devise a protocol that can fit on the BS2's and solve the communication problem.

    Discovery
  • ElectrodudeElectrodude Posts: 1,614
    edited 2017-10-24 17:12
    Why don't you just use XBees? They can already transmit I/O changes for you - you don't have to worry about encoding, error correction, etc. Just wire your 8 switches up to the XBee's 8 inputs, configure it to forward I/O changes, and you're set. No Basic Stamp or Propeller required. On the receiving end, you can get 8 digital signals from the XBee's I/O, or you can get serial packets containing the states of all of the switches, or you can do both.
  • Mike GreenMike Green Posts: 23,101
    edited 2017-10-24 18:16
    Are you going to number the messages and include a checksum or CRC? I can imagine cases where there's a single bit error twice so you get two out of three the same ... only they're wrong. A checksum or CRC can catch that, possibly along with a packet number. You'll also want a time-out and some way to reset the system if the error count is too high

    Electrodude has a good point
  • There are other forward error correction schemes to consider, such as Hamming code. (I would not be surprised if the XBees used Hamming code at the lowest level.)

    -Phil
  • Mike,
    When I get my hardware, I most likely will have to make some adjustments including checksum. I am not sure how to implement numbered messages.

    For example, when I momentarily change switch #1 to "ON", I expect my system to output a packet that includes: START code, ASCII "A", ASCII "A", ASCII "A", and a STOP code. A match of any two will generate an acceptance.

    When switch #1 is returned to the "OFF" position the system will output a packet that includes:START code, ASCII "B", ASCII "B", ASCII "B", and a STOP code. A match of any two will generate an acceptance.

    This will be checked against several noise sources.

    Electrodude,
    I have Propellers and BS2 chips on hand and no XBees. Plus I have no experience with XBees. If I encounter insurmountable problems with my implementation...I will most likely turn to examine XBee.

    Discovery
  • Good job pushing those X-bee's...
Sign In or Register to comment.