How do I properly transmit PWM data over Xbee 802.15.4 S1

I’m having trouble properly driving a lilypad vibe board using PWM over Xbees. The signal is successfully received by the Base Xbee, however, it produces an erratic drive pattern on the Vibe Board.

In this project I am attempting to detect a user’s heartbeat and transmit the heartbeat to another user where each beat is felt as a pulse from a vibe motor. The pulse from the vibe motor should be a consistent vibration 300ms in length each time a heartbeat is detected. Instead it’s choppy and not in time with the user’s heartbeat.

I have tested the signal by removing PWM from the code (replaced with DigitalWrite), driving an LED over digital line passing and it is working correctly. I believe it is a sample rate issue.

Device #1 detects a user’s heartbeat, converts it to PWM and transmits it over Xbee (connected to Lilypad Xbee).
Device #2 receives the signal from device #1 and drives a vibe motor connected directly to Lilypad Xbee pin.

2 Xbee 802.15.4 S1 in line passing mode with the Remote DIO1 set to ADC and Base PWM1 set to PWM Out. Notable Xbee configuration points are:

D1= 2
IC = 2
IT = 1
IR = 5

P1 = 2
IU = 1

Help would be greatly appreciated.


Don’t use both a Sample rate and change detect. Just use the sample rate (IR).

1 Like