@peanutsguy, I have published the Manchester library to the IDE. It needs the SparkIntervalTimer library to be added as well.
Great work! Thanks! Iāll check it right now
@peekay123, I am having some issues using this library. I have one Core with 433Mhz Transmitter and TX_Basic demo and another with Receiver and RX_Basic demo running. The TX demo Coreā LED is blinking, but the RX demo is not working. The below if condition never becomes TRUE.
if (man.receiveComplete()){
...
}
Can you give some tips to debug and correc this?
Iām interested in using the Manchester library to decode the output from an Oregon Scientific temperature sensor. The decoding guidelines here mention that the bitrate is 1024Hz for the sensor I have. Can someone clarify if this is the rate I need to set in my receiver, or whether the MAN_1200 option will suffice since it is above the 1024Hz rate?
@wyealex, the library was a port I did originating HERE. A quick search on google led me to some Arduino code for your sensor. It may be best to port a library specifically written for the sensor.
Find the best Arduino library for your application and I can help port it if needed.
Thanks for pointing me in the right direction peekay. My sensor is certainly on the list (THN132N) so this should be applicable. I am actually prototyping this project on an Arduino Mega before my Spark Photon arrives (hopefully later this month), so I will try to test it out directly before attempting to port it. Thanks for the offer of help with the port - I might take you up on it before too long though this is my first experience with code this dense so it might be a while before I understand it fully!
I would be really keen to use this library but it wont let me compile any of the examples for my photon
I was hoping you may be able to help @peekay123 given you did the first port.. this is way beyond my still new skills
I get the following errors:
manchesterrx_array.cpp: In function 'void loop()':
manchesterrx_array.cpp:47:20: warning: operation on 'moo' may be undefined [-Wsequence-point]
if (man.receiveComplete()) {
^
manchesterrx_array.cpp:43:13: warning: unused variable 'receivedSize' [-Wunused-variable]
man.beginReceiveArray(BUFFER_SIZE, buffer);
^
Manchester/Manchester.cpp: In member function 'void Manchester::transmit(uint16_t)':
Manchester/Manchester.cpp:131:31: warning: narrowing conversion of '(((int)data) >> 8)' from 'int' to 'uint8_t {aka unsigned char}' inside { } [-Wnarrowing]
uint8_t byteData[2] = {data >> 8, data & 0xFF};
^
Manchester/Manchester.cpp:131:42: warning: narrowing conversion of '(((int)data) & 255)' from 'int' to 'uint8_t {aka unsigned char}' inside { } [-Wnarrowing]
uint8_t byteData[2] = {data >> 8, data & 0xFF};
^
SparkIntervalTimer/SparkIntervalTimer.cpp: In member function 'void IntervalTimer::start_SIT(uint16_t, bool)':
SparkIntervalTimer/SparkIntervalTimer.cpp:178:10: warning: statement has no effect [-Wunused-value]
scale == uSec; // Default to microseconds
^
SparkIntervalTimer/SparkIntervalTimer.cpp: In member function 'void IntervalTimer::interrupt_SIT(action)':
SparkIntervalTimer/SparkIntervalTimer.cpp:261:15: warning: variable 'TIMx' set but not used [-Wunused-but-set-variable]
TIM_TypeDef* TIMx;
^
SparkIntervalTimer/SparkIntervalTimer.cpp: In member function 'void IntervalTimer::resetPeriod_SIT(uint16_t, bool)':
SparkIntervalTimer/SparkIntervalTimer.cpp:305:26: warning: unused variable 'timerInitStructure' [-Wunused-variable]
TIM_TimeBaseInitTypeDef timerInitStructure;
^
SparkIntervalTimer/SparkIntervalTimer.cpp: In member function 'void IntervalTimer::start_SIT(uint16_t, bool)':
SparkIntervalTimer/SparkIntervalTimer.cpp:191:43: warning: 'TIMx' may be used uninitialized in this function [-Wmaybe-uninitialized]
TIM_ITConfig(TIMx, TIM_IT_Update, ENABLE);
^
SparkIntervalTimer/SparkIntervalTimer.cpp: In member function 'void IntervalTimer::stop_SIT()':
SparkIntervalTimer/SparkIntervalTimer.cpp:247:18: warning: 'TIMx' may be used uninitialized in this function [-Wmaybe-uninitialized]
TIM_DeInit(TIMx);
^
SparkIntervalTimer/SparkIntervalTimer.cpp: In member function 'void IntervalTimer::resetPeriod_SIT(uint16_t, bool)':
SparkIntervalTimer/SparkIntervalTimer.cpp:336:23: warning: 'TIMx' may be used uninitialized in this function [-Wmaybe-uninitialized]
TIMx->PSC = prescaler;
^
../../../build/target/user/platform-6/libuser.a(Manchester.o): In functionManchester': Manchester/Manchester.cpp:55: undefined reference to
SystemCoreClock'
Manchester/Manchester.cpp:55: undefined reference toWiring_TIM2_Interrupt_Handler' Manchester/Manchester.cpp:55: undefined reference to
Wiring_TIM3_Interrupt_Handler'
Manchester/Manchester.cpp:55: undefined reference toWiring_TIM4_Interrupt_Handler' ../../../build/target/user/platform-6/libuser.a(SparkIntervalTimer.o): In function
Wiring_TIM2_Interrupt_Handler_override':
SparkIntervalTimer/SparkIntervalTimer.cpp:37: undefined reference toTIM_GetITStatus' SparkIntervalTimer/SparkIntervalTimer.cpp:39: undefined reference to
TIM_ClearITPendingBit'
../../../build/target/user/platform-6/libuser.a(SparkIntervalTimer.o): In functionWiring_TIM3_Interrupt_Handler_override': SparkIntervalTimer/SparkIntervalTimer.cpp:47: undefined reference to
TIM_GetITStatus'
SparkIntervalTimer/SparkIntervalTimer.cpp:49: undefined reference toTIM_ClearITPendingBit' ../../../build/target/user/platform-6/libuser.a(SparkIntervalTimer.o): In function
Wiring_TIM4_Interrupt_Handler_override':
SparkIntervalTimer/SparkIntervalTimer.cpp:57: undefined reference toTIM_GetITStatus' SparkIntervalTimer/SparkIntervalTimer.cpp:59: undefined reference to
TIM_ClearITPendingBit'
../../../build/target/user/platform-6/libuser.a(SparkIntervalTimer.o): In functionIntervalTimer::start_SIT(unsigned short, bool)': SparkIntervalTimer/SparkIntervalTimer.cpp:163: undefined reference to
RCC_APB1PeriphClockCmd'
SparkIntervalTimer/SparkIntervalTimer.cpp:153: undefined reference toRCC_APB1PeriphClockCmd' SparkIntervalTimer/SparkIntervalTimer.cpp:158: undefined reference to
RCC_APB1PeriphClockCmd'
SparkIntervalTimer/SparkIntervalTimer.cpp:189: undefined reference toTIM_TimeBaseInit' SparkIntervalTimer/SparkIntervalTimer.cpp:190: undefined reference to
TIM_Cmd'
SparkIntervalTimer/SparkIntervalTimer.cpp:191: undefined reference toTIM_ITConfig' SparkIntervalTimer/SparkIntervalTimer.cpp:200: undefined reference to
NVIC_Init'
../../../build/target/user/platform-6/libuser.a(SparkIntervalTimer.o): In functionIntervalTimer::stop_SIT()': SparkIntervalTimer/SparkIntervalTimer.cpp:240: undefined reference to
TIM_Cmd'
SparkIntervalTimer/SparkIntervalTimer.cpp:244: undefined reference toNVIC_Init' SparkIntervalTimer/SparkIntervalTimer.cpp:247: undefined reference to
TIM_DeInit'
collect2: error: ld returned 1 exit status
make: *** [1aaa671af00ccc1525b2ee0c970353f68ea01b9103a7086cfca92cba9e0e.elf] Error 1
@smogs, support for the SparkIntervalTimer with Photon is not yet available unless you compile locally. It is coming VERY soon I believe
Hi @peekay123,
Iām compiling locally and attempting to use your Manchester library with my Photon.
My setup is to use Arduino Pro Minis transmitting off 433MHz transmitters using the Radiohead library. As a test, they are currently broadcasting a single uint8_t at each press of a pushbutton. My original Arduino-based receiver, using the same Radiohead library, receives the char just fine, but not the Photon. It seems like your Manchester library port expects uint16_ts, could you point me towards the right direction to tweak the code? Or would you suggest that I use a different library on my Arduino side to send uint16_ts?
p.s. Iāve pulled the latest SparkIntervalTimer develop branch from your repo, and compile without error.
Guess I typed too soonā¦
Using Mchr3kās Arduino Manchester library I was able to get the Pro Minis talking nicely to the Photons. It does appear that the Radiohead library is not compatible with this library, for anyone who might encounter this issue here.
Been trying to do communication from my photon to an arduino nano using "RF wireless receiver module & transmitter module board for arduino super regeneration 315/433MHZ DC5V (ASK /OOK)"
Failing so far though. As you succeeded, care to share some code snippets?
Iām receiving at the photon and sending from the arduino nano.
Hi @Faajer,
The first question will be: do you have a Rx & Tx 433MHz module pair?
Did you try using @peekay123ās Manchester library?. The sample code in there worked quite well for me. I compile all of my code locally for other reasons but otherwise they compiled fine for me using the Photon as Rx.
A couple of things to note:
- the baud rate ā usually the slower you set it, the more reliable it is. Iāve had decent reception with 1200/2400bps
- voltage you are supplying the Rx and Tx with. Most of the 433MHz Txās out there can be drive anywhere from 3.3V to 7.5V. Higher voltage provides stronger transmit power
- are you using a proper antenna design, of right length? this link could help
Also, are you using the Tx on your Photon or Arduino Nano?
If the Tx is on your Photon, and if youāre powering your Photon via USB, try hooking up the power to the Tx using the VIN pin (5V/USB) instead of 3v3.
If youāre using the Rx on your Photon, I have noticed that powering the Rx at either VIN (5V/USB) or from the 3V3 pin does make a difference to reception quality. Havenāt been able to figure out why, though. Try either option, and see if one provides better results. Thereās so many variants of these cheap ASK/OOK super regenerative Rxās out there so give this a try.
Hi @chuank
I do have a Rx & Tx 433MHz module pair.
Iām using the Manchester library from the Particle IDE (builtin Manchester library) for the Photon.
And the Manchester direct download for the Arduino
Iāve tried fooling around with the baud rate setting it at any possible value.
Using the Photon as the receiver. I make use of the 3V3 port but also tried to drain power from the arduino 5v port which is powered from usb.
It just doesnāt hit the man.receiveComplete() so thereās little to test until I can actually catch the signal.
The 2 devices are next to each other so range shouldnāt be an issue.
Itās also not clear to me what other port on the photon besides the 3V3 port can be used for power?
Iām sorry if this comes over somewhat noobish but Iām new to these kinds of projects.
Thanks for responding btw.
Hi @Faajer,
If youāre powering via USB on your Photon, use the VIN pin to provide +5V to your Rx. Also try moving to the other DATA pin on the Rx, and check that youāve got the right pins declared in your Particle code. Avoid using breadboards if you can, too. While there shouldnāt be any major RF interference issues between the 2.4GHz WiFi antenna and the 433ās, try orienting them perpendicularly to see if you can pick up any new signals.
For testing, send a regular ping at 1sec intervals on my Tx, and get your Photon to blip the D7 LED whenever it gets a new byte of data. This gives immediate feedback on whether itās simply a poor signal (when youāll get inconsistent Rx blips), or point out something else in your code thatās not working.
Also, make sure youāre using https://mchr3k.github.io/arduino-libs-manchester/ as the library on the Arduino side.
I did remember having some difficulties getting 433MHz RF to work the first time with the Photon, but it was resolved after checking the points I listed in my previous post.
Hope this helps!
@chuank Thanks for the tips. I got it working now (extended the antennas with 17cm wire) and at a friends I can manage to send messages up to 14 meters including 2 walls.
At my own place I barely send up to 7 meters. Guess it also depends on noise.
11-12 meters would be perfect for my setup but I doubt Iāll ever get that far in this environment.
Thatās great to hear @Faajer!
Iāve had surprisingly good response with good 'ol 17.8cm hookup wire. Also, look online for loaded coil antenna designs where you basically coil up the base of the antenna like a helix using a lamp cord to help form the helix. This gave me a bit more range, but my deployment area (along a narrow hallway) reflects/absorbs the crap out of my Txās signal. Iād be lucky to get the kind of range you are getting with consistency. What kind of walls are they?
You can also try using a compact 433mhz chip antenna, but those will be a lot tougher to tune (since you canāt shorten the chip itself!).
Since I donāt have a spectrum analyzer, Iām finding my RF tests to be a lot like magic voodoo. Iām guessing that with the cheap Rx/Tx combos which might not be exactly well-tuned, you will have differing performance/range even with the same wire!
@wgbartley I have read that the receiver you have from SparkFun is noisy, have you experienced this yourself or have you had solid communications with it?
Brett
Iāve had good luck with it in the past. However, something happened to mine, and I get nothing but random output from it now. Itās probably something Iāve done to break it over the years (and Iāve had it for 5+ years at least)!
Has anyone gotten the Manchester library to work on a Photon? I bought a cheep RX/TX pair for 433MHz and canāt get them to work. Iāve been through most of the suggestions on this thread so far so Iām starting to think I might have a dud RX or TX. I just want to make sure itās possible on a Photon and not just the Core before buying a new pair.
Never mind, I kinda got it to work. The Rx can pick up the Tx when they are connected to the same photon. But when I put the Tx on a different photon it stops working. So I have no idea what Iām doing wrong, but they arenāt duds.