Component that can create a hex value? - bluetooth

TLDR:
Is there a way to create a hex value between 0x20 and 0x7E with 5 volts? Is there a cheap component on the market or circuit logic that can achieve this?
I'm not sure what the proper terminology for this is, but here's what I'm trying to do:
I have a bluetooth module connected to my pico via UART0 TX and UART0 RX. The use for this is a bit long to explain, but essentially, I want the bluetooth module to work without my pico attached to it. I have a device that outputs a signal, the pico reads the signal, then it tells the bluetooth module to transmit to the receiver. However, since the data to transmit isn't actually important, it makes sense to cut out the pico and simply have the bluetooth module read the signal directly then transmit.
I have the device that outputs exactly when I want, but it outputs the equivalent of 00 in hex. My computer is connected via bluetooth and can read it just fine. However, the pico, reading the input through RX, can't. I've found no way for micropython using UART to read 00 - UART.any() and UART.read() want a character, and 00 only corresponds to NULL.
So essentially, I need some way to transmit a hex value between 0x20 and 0x7E without using the raspberry pi pico. Is there some kind of component that is able to do this? In practice, the bluetooth module will be connected to 5V power with up to 5 amps.
Any idea on how to get the Pico to read 00 in hex through the RX pin is welcomed too. The purpose of this is to not need multiple Picos, since the receiver and the transmitter will be a good distance from each other.

I found the issue. The pico actually can accept 0 through the UART RX pin. The issue was me having a wire misplaced. My computer saw the 0 input which made me think the pico couldn't handle it, but in fact it was never receiving it. Thanks for the help Kotzjan. Would have been interesting to fake a value into the port though!

Related

yj-16009 iBeacon Proximity BLT beacon

I'm making a project with Esp32 whroom, so I bought the yj-16009 iBeacon DataSheet and I'm trying to get it to work as wireless Bluetooth proximity sensor like in this Video
I used the this code from the video and the esp32 is monitoring and showing BLT scanning results like this the results shown are after I turned off any BLT device around so first I don't understand what it is reading, and second after I turn on the iBeacon the results remain with the same range of numbers no matter if I get the iBeacon closer or farther, therefor I came to the conclusion that it doesn't recognize the iBeacon sensor for some reason.
I also download an app named LightBlue which does recognize the iBeacon sensor.
My question is if anyone knows how to make the esp32 recognize the iBeacon sensor. Another thing I tried to find any information about this sensor and there is no info about it anywhere. I have read on other questions here that it might need to be programmed somehow which I don't know how to do because there is no info online. So if anyone is familiar with this kind of sensor and can help me figure how to make the ibeacon to work like the video above as a Bluetooth Proximity device it would be a blessing.
The code you reference is just scanning for any BLE advertisements (iBeacon or otherwise) and printing out the RSSI signal strength of each detection. The reason you do not see the RSSI change when you move the beacon is because the ESP32 is probably picking up non-iBeacon adverts from your phone, laptop and other Bluetooth enabled devices in the vicinity which are not moving (there are more around you than you think!)
In order to make the device detect iBeacon only (and not all the other devices) you need to change the C code to do a few more things:
Access the bytes of the advertisement payload and use them as follows:
Compare the beginning of these bytes to see if they include the iBeacon byte sequence FF 4C 00 02 15
If the above byte sequence is not in the advertising data, ignore that detection — it is not an iBeacon advert
If it does include that byte sequence, decode the next 16 bytes as the iBeacon uuid, the next two bytes as the major and the next two bytes as the minor. See my answer here: What is the iBeacon Bluetooth Profile
Print out the identifiers along with the RSSI that the code already prints.

How to use a MCP23017 with MCP3008 for I2C voltage sensor with Raspberry Pi?

I would like to know if is possible to use an MCP23017 16 bit I/O expander with a MCP3008 ADC and read the voltage with a Raspberry Pi 2. I want to use the ADC as an I2C device. I would like to do this so I don't have to run the program a 'root', so I'm thinking that running the ADC as an I2C device will fix this problem. I'm looking for help with how to wire the system as well as programming it. I'm using the Python 3 editor. The existing program I have will be used to plot a sine wave generated by a AD9850 DDS module who's signal is amplified and fed into a device. I want to measure this voltage. I know how to use a voltage divider, but am having trouble coming up with a way to read it. The measured voltage value needs to be stored as global variable that can be passed around the program. Right now I'm mainly concerned with not running the program as a root, turning the ADC into an i2c device, and storing the voltage as a global variable to be passed around in an existing program.
I have not worked with any kind of I2C TO SPI converter. Still, you can use some I2C to SPI bridges if they work, I just googled it, but that can cause wiring problems.
I can suggest you the same ADC MCP series with I2C interface.Thus, the further I2C connections with MCP23017 expander and then the Raspberry pi would be easy.You can go through various analog to digital converters that can be I2C interfaced with their codes in python or java for pi like MCP3425, MCP3426, MCP3427, MCP3428. You can easily find them or also check control everything as that would be easy to interface using I2C cables and adapters preventing connection or wiring problems.For codes: https://github.com/ControlEverythingCommunity?utf8=%E2%9C%93&query=MCP34
The following codes for MCP_23017 can also help you code the way you want easily with expander being connected to pi:https://github.com/ControlEverythingCommunity/MCP23017_16-Channel.
I think this would solve your problem!!
Thanks.

Arduino Random Characters sent to Bluetooth TX during Code Upload

When I upload code to my Arduino while the TX and RX pins are connected to my HC-05 module, a bunch of random characters are sent to the TX buffer, and when I connect to a device, those characters are sent and mess up communication. Is there a way that I can clear this buffer after uploading the code? I've just been disconnecting the wires whenever I upload, but I'd like to find an easier way. Thanks!
Well, if you use a serial port to both send data and the program of course you will see it on the other side of the BT... Possible solutions:
disconnect the BT module every time you want to program the Arduino
shut down the other BT device (or just disconnect it) when you have to program the Arduino
shut down the HC-05 (or keep it in reset state) until the arduino says that it is communicating (so use a GPIO to control the reset pin or a transistor to power the BT on at the beginning of the program)
use a 3-state driver between the HC-05 and the Arduino serial ports (one driver for TX and one for RX) and activate its outputs at the beginning of the arduino program.
I don't like djUniversal's solution because you cannot control what the PC transmits; if, for instance, you decide to use the byte 0xAA to signal the start of the transmission then if the PC sends 0xAA the other device thinks that the Arduino is transmitting. Choosing longer bytes sequences helps, because the sequence becomes less probable, but.....
Moreover you have to send it at EVERY command, not just at the beginning, because you have to reset the arduino to program it (and so the other device is not aware of WHEN to stop considering the data).
The only other way around it is to send a header of maybe a couple of bytes each time to send a message. The other program can wait for these characters before it starts to take commands. Until those characters are read from the buffer you would just do a Serial.read() loop to get rid of the garbage.
Also, if garbage characters are going to screw up your program really badly you might want to think about creating some kind of crude checksum also to confirm the correct transmission.
Need help coding? Let me know.

how to take /use serial input in verilog?

I want to control a servo motor using an 8-bit input to generate a PWM. Here's my problem: I need to take the serial input through a MAX 232 from PC and I don't know how to do it. A sample code would be helpful too...
TNX
You just need to add a UART (a Universal Asynchronous Receiver/Transmitter) to your FPGA design. Connect the TX and RX signals from the UART to the MAX232, convert them to RS-232 voltage levels, and then connect to the PC. You should be able to find sample code on your own, now that you know what to search for.

RN-41 bluetooth and dsPIC

Having a couple of issues with what I was hoping to be fairly straight forward.
I've been transmitting data from my PIC to a PC via RS232 at a baudrate of 115200. I've recently got a RN-41 bluetooth module and was hoping the switch would be as simple as powering the module and connecting the PIC TX (via a max3232) to the RN-41's RX, as the online community has led me to believe.
I'm able to connect to it and pair it to the computer, I'm also able to use PUTTY/Realterm to change the parameters, like the name and baudrate. Finally, by connecting a link to the RX and TX on the bluetooth module and powering it, I'm able to ping text by sending and echoing it using PUTTY, so I'm fairly sure the module isn't broken.
However, when I try to transmit my data from the PIC to the bluetooth module, and view it using realterm (which was working fine with the wired connection) I'm getting data received, but it's not what is expected. I'm expecting a packet of 25 bytes, with a header value of 2, I'm getting around 12-15 bytes and a header of -65.
The first value, -65, is always the same, and the other data can change, which really suggests a baudrate problem, but I've tried a variety of baudrates (changed in my UART code, the bluetooth parameters, and in realterm), and the data doesn't change at all; always wrong.
What have I missed? Anything I need to change in the Bluetooth configurations? I've also checked the parity bit, stop bit, etc, all the same as each other.
The problem was the MAX3232 circuitry. It was necessary for the RS232 connection I was using prior, but when I wanted Bluetooth, which required TTL signals, I was feeding it the same RS232 data!
Making a link straight from the PIC to the Bluetooth receiver solved this problem. Hope this helps someone else in the future!

Resources