5
/
30
Is anyone working on porting a 433Mhz library such as VirtualWire?
-
created
-
last reply
- 29
replies
- 2.1K
views
- 10
users
- 14
likes
- 14
links
Perhaps something like RadioHead68?
Thanks
I have 433 Mhz transmitter33 and receiver24 modules (note: not transceiver) that I got from SparkFun8 a few years ago. I have the older versions. I know they went out of stock for quite a long time while they switched manufacturers or something, so the modules I have may be different from what they’re selling now. I imagine they operate the same, though.
Most of the 433/315 Mhz modules are pretty generic such as the ones wgbartley mentioned.
Another good library to look at which may be even more applicable is the Manchester library76.
I believe it is a bit more flexible when the transmitter and receiver are running at different clocks, which is likely to be the case when using the core with something else like an Arduino.
Let me know if there are any ways I can help!
I think I can port the Manchester library using the IntervalTimer library I created. I’m on it.
Thanks @peekay123, this will be a great library to have!
@taylormade201, I have the Manchester library138 completed and posted on my github. One thing I am not certain about is the timer interval as the documentation was not very clear. Hopefully, what I understood and how I coded the timer interval is correct. Let me know how it goes!
Tested the library today, works great.
Thanks @peekay123
@taylormade201, my pleasure. Since it’s working, I will post it as a library when that feature comes out soon
@d82k, I don’t see why not. You can use the receive examples as your foundation and go from there.
Thank you @peekay123, I have tried modifying ManchesterRX_Basic.ino from the examples, but I don’t understand: how do I set the length in bit of the message and the frequency?
Is the message^”m” than printed as an int?
Thank you,
dk
@d82k, I did not write the library, I only ported it from an Arduino library. You will need to read the descriptions in both Manchester.cpp and Manchester.h to get an idea of the timing for the receiver. You can set a baud rate (MAN_1200) which is set when you call man.setupReceive(RX_PIN, MAN_1200);
in the test code. The bit timing for the receiver is entirely dependent on the baud rate which sets the frequency of the receiver interrupt service routine.
Hope that helps!
@peanutsguy, I have published the Manchester library to the IDE. It needs the SparkIntervalTimer library to be added as well.
@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 here2 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 HERE7. 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.
http://www.instructables.com/id/Arduino-Wireless-Weather-Station-Web-Server/step2/Hardware/11
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':
SystemCoreClock’
Manchester/Manchester.cpp:55: undefined reference to
Manchester/Manchester.cpp:55: undefined reference toWiring_TIM2_Interrupt_Handler'
Wiring_TIM3_Interrupt_Handler’
Manchester/Manchester.cpp:55: undefined reference to
Manchester/Manchester.cpp:55: undefined reference toWiring_TIM4_Interrupt_Handler'
Wiring_TIM2_Interrupt_Handler_override’:
../../../build/target/user/platform-6/libuser.a(SparkIntervalTimer.o): In function
SparkIntervalTimer/SparkIntervalTimer.cpp:37: undefined reference toTIM_GetITStatus'
TIM_ClearITPendingBit’
SparkIntervalTimer/SparkIntervalTimer.cpp:39: undefined reference to
../../../build/target/user/platform-6/libuser.a(SparkIntervalTimer.o): In functionWiring_TIM3_Interrupt_Handler_override':
TIM_GetITStatus’
SparkIntervalTimer/SparkIntervalTimer.cpp:47: undefined reference to
SparkIntervalTimer/SparkIntervalTimer.cpp:49: undefined reference toTIM_ClearITPendingBit'
Wiring_TIM4_Interrupt_Handler_override’:
../../../build/target/user/platform-6/libuser.a(SparkIntervalTimer.o): In function
SparkIntervalTimer/SparkIntervalTimer.cpp:57: undefined reference toTIM_GetITStatus'
TIM_ClearITPendingBit’
SparkIntervalTimer/SparkIntervalTimer.cpp:59: undefined reference to
../../../build/target/user/platform-6/libuser.a(SparkIntervalTimer.o): In functionIntervalTimer::start_SIT(unsigned short, bool)':
RCC_APB1PeriphClockCmd’
SparkIntervalTimer/SparkIntervalTimer.cpp:163: undefined reference to
SparkIntervalTimer/SparkIntervalTimer.cpp:153: undefined reference toRCC_APB1PeriphClockCmd'
RCC_APB1PeriphClockCmd’
SparkIntervalTimer/SparkIntervalTimer.cpp:158: undefined reference to
SparkIntervalTimer/SparkIntervalTimer.cpp:189: undefined reference toTIM_TimeBaseInit'
TIM_Cmd’
SparkIntervalTimer/SparkIntervalTimer.cpp:190: undefined reference to
SparkIntervalTimer/SparkIntervalTimer.cpp:191: undefined reference toTIM_ITConfig'
NVIC_Init’
SparkIntervalTimer/SparkIntervalTimer.cpp:200: undefined reference to
../../../build/target/user/platform-6/libuser.a(SparkIntervalTimer.o): In functionIntervalTimer::stop_SIT()':
TIM_Cmd’
SparkIntervalTimer/SparkIntervalTimer.cpp:240: undefined reference to
SparkIntervalTimer/SparkIntervalTimer.cpp:244: undefined reference toNVIC_Init'
TIM_DeInit’
SparkIntervalTimer/SparkIntervalTimer.cpp:247: undefined reference to
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 library5 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.