Skip to content

Instantly share code, notes, and snippets.

@ohnx
Last active February 6, 2022 22:26
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ohnx/ce8312652376be391618a449f4ce9166 to your computer and use it in GitHub Desktop.
Save ohnx/ce8312652376be391618a449f4ce9166 to your computer and use it in GitHub Desktop.
CC41-a

intro

The cc41-a can be kind of hard to use, so I figured I'd make a blog post about it.

So, without further ado, here's a ohnx terribly explains™ post explaining how I got my CC41-a working (because after all, I am the center of the universe):

intro x2

First off, how do you know if you have a cc41-a?

  1. Power the CC41-a using 5V (assuming you have a breakout board, otherwise, I think you need to use 3.3V)
  2. Wait until the blue light flashes (If it doesn't, something's broken)
  3. Grab your phone or any other bluetooth enabled thing nearby
  4. Scan for devices
  5. If you see CC41-a in the device list, you have a working CC41-a! Do not pass Go. Do not collect $200. Just be happy you have a CC41-a, like me :)
  6. If you don't see anything, then maybe something is still wrong.
  7. If you see some other device name, then you don't have a CC41-a. Google that name, and it's likely you'll find something about it.

The cc41-a's datasheet (can be found here) is pretty lacking, and if you google "cc41-a", a lot of the results are of people buying a hc-10 (a ble module) and getting a cc41-a instead (it turns out that the cc41-a is a knockoff of the hc-10) and being all sad and angry about it (the post i bought my stuff from actually called it hc-06, so i was very suprised to find out mine was a cc41-a).

hardware

Hardware stuff first. The cc41-a is 3.3V, so even the serial stuff is 3.3V. As a result, you need to have a voltage divider on the TX pin on the Arduino that connects to the RX on the CC41-a. Since I'm a very electronics noob and great grammar-er, I looked up something that I remembered using a votlage divider with, my esp8266 (cheap wifi module, irrelevant).

Here's a cool schematic that i found online of the esp8266 connecting, from this tutorial on how to get it running. Only use the voltage divider parts and ignore the sticky notes.

Schematic/Diagram

In fact, use this nifty little table instead:

Arduino CC41-a breakout board
5V 5V
GND GND
10 TX
11 100K resistor, RX

Note that I use pins 10 & 11 because just passthroughing the serial doesn't work (assuming it's because my computer doesn't like 3.3V signals) and so I need to use Arduino's SoftwareSerial to get it working.

software

i put this code from Arduino's SoftwareSerial demo on my arduino:

/*
  Software serial multple serial test

 Receives from the hardware serial, sends to software serial.
 Receives from software serial, sends to hardware serial.

 The circuit:
 * RX is digital pin 10 (connect to TX of other device)
 * TX is digital pin 11 (connect to RX of other device)

 Note:
 Not all pins on the Mega and Mega 2560 support change interrupts,
 so only the following can be used for RX:
 10, 11, 12, 13, 50, 51, 52, 53, 62, 63, 64, 65, 66, 67, 68, 69

 Not all pins on the Leonardo support change interrupts,
 so only the following can be used for RX:
 8, 9, 10, 11, 14 (MISO), 15 (SCK), 16 (MOSI).

 created back in the mists of time
 modified 25 May 2012
 by Tom Igoe
 based on Mikal Hart's example

 This example code is in the public domain.

 */
#include <SoftwareSerial.h>

SoftwareSerial mySerial(10, 11); // RX, TX

void setup() {
  // Open serial communications and wait for port to open:
  Serial.begin(9600);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for native USB port only
  }


  Serial.println("Goodnight moon!");

  // set the data rate for the SoftwareSerial port
  mySerial.begin(9600);
}

void loop() { // run over and over
  if (mySerial.available()) {
    Serial.write(mySerial.read());
  }
  if (Serial.available()) {
    mySerial.write(Serial.read());
  }
}

now you can communicate via serial!

If you want, send the "AT" command over serial, making sure it's 9600 baud and the right COM port.

connecting to your CC41-a via a phone

If you whipped out your phone to test if you had a cc41-a earlier, maybe you tried to tap on it to see what would happen, and were suprised when it rejected your connection (at least, mine did when I tried with 4 different bluetooth devices). Maybe you thought it didn't work and were very sad.

Guess what, though? Your CC41-a is working! You just need this app to connect to it: (it's an android app, don't know if there is an iOS one)

Not sure why, though. Plus, you can't transfer information back and forth.

This post will be updated as I myself figure out stuff. For now, it's into Android dev as I learn why that app can connect to the CC41-a :D

conclusion

The CC41-a kind of works.

@brandonros
Copy link

Plus, you can't transfer information back and forth.

you can connect to CC41-A via iPhone with app but can't transfer data? doesn't that mean it's useless or did you figure out how to get data transferred?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment