Quantcast
Channel: 懒得折腾
Viewing all articles
Browse latest Browse all 764

433Mhz Library [COMPLETED]

$
0
0

5

/

30

taylormade​201, I’ve thought about it but not yet gotten around to it. Is there a specific library you want ported? Perhaps you could include a link? smile

taylormade​201, to simplify things a bit, can you tell me which 433MHz module you expect to use?

I can definitely recommend the TI CC1101 based modules. A library for this can be found on the panStamp website.

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!

@taylormade​201, I have been working on porting the library and got stuck on some compile errors with my IntervalTimer library. I think we have that fixed now so I will finish the port and post it on my github for you when done. smile

@taylormade​201, 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! smile

2Replies
1 person liked this.

Hello,

I am wondering, can I use this library to sniff the code from a transmitter? I have a couple of remote 433, which I would like to use to interact with the spark.
Can I use it to display the raw message and tweak it accordingly with the lenght and the time interval?
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! smile

@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

https://buildthings.wordpress.com/arduino-intercepting-oregon-scientific-weather-station-anemometer-wind-vane-temperature-humidity-barometer-rain-gauge-data/9

Find the best Arduino library for your application and I can help port it if needed. grinning

1 person liked this.

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!

1 person liked this.

I would be really keen to use this library but it wont let me compile any of the examples for my photon frowning

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 function Manchester':
Manchester/Manchester.cpp:55: undefined reference to
SystemCoreClock’
Manchester/Manchester.cpp:55: undefined reference to Wiring_TIM2_Interrupt_Handler'
Manchester/Manchester.cpp:55: undefined reference to
Wiring_TIM3_Interrupt_Handler’
Manchester/Manchester.cpp:55: undefined reference to Wiring_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 to TIM_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 to TIM_ClearITPendingBit'
../../../build/target/user/platform-6/libuser.a(SparkIntervalTimer.o): In function
Wiring_TIM4_Interrupt_Handler_override’:
SparkIntervalTimer/SparkIntervalTimer.cpp:57: undefined reference to TIM_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 to RCC_APB1PeriphClockCmd'
SparkIntervalTimer/SparkIntervalTimer.cpp:158: undefined reference to
RCC_APB1PeriphClockCmd’
SparkIntervalTimer/SparkIntervalTimer.cpp:189: undefined reference to TIM_TimeBaseInit'
SparkIntervalTimer/SparkIntervalTimer.cpp:190: undefined reference to
TIM_Cmd’
SparkIntervalTimer/SparkIntervalTimer.cpp:191: undefined reference to TIM_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 to NVIC_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 smile

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.

1 person liked this.

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.



Viewing all articles
Browse latest Browse all 764

Trending Articles