I want to drive a servo via a HCO6 and HC05 link as a stand alone, using no android or PC. The question is how to send a 1.5 ms signal (generated with a pulse command on a Nano) from one HC to another HC (to which my servo will be connected) ? I do not need to care about passwords in my linking. No text to be sent, just the 1ms to 2 ms signal, at a refresh rate of 50 Hz. I will use the HC with a OOK modulation (on - off on the data pin)? How to achieve this ? Thanks !
-
1HC devices are serial. What makes you think you can use other signal formats?– Majenko ♦Sep 10, 2017 at 12:40
-
The firmware associated with those model numbers implements a serial interface. The hardware itself could be reprogrammed to another purpose, but that would be far beyond the scope of the Arduino site.– Chris StrattonSep 11, 2017 at 0:17
1 Answer
You cannot. You will need an Arduino at the servo end to generate the PWM signal from serial instructions sent over Bluetooth.
Since PWM is (typically) 8-bit and serial is (typically) 8-bit you could simply have each byte as a 1:1 mapping to a PWM value.
One the transmit end:
bluetoothSerial.write(pwmValue);
On the receive end:
if (bluetoothSerial.available()) {
analogWrite(9, bluetoothSerial.read());
}
-
Yes, though one could use something like an ATtiny instead of a full ATmega Arduino. Sep 10, 2017 at 22:18
-
Sure. Or a pic 16. Or an stm32f1 or a z80 or a 6502. "Arduino" is used here to refer to any small programmable embedded computing device.– Majenko ♦Sep 10, 2017 at 22:59
-
Thanks to you all. I start understanding. In fact, the pulse length information will have to be translated in serial format to be sent to the RX. Your example seems quite easy. Another possibility is using a 433 mHZ TX RX system, which can be OOKed. Thanks a lot !– Billy60Sep 11, 2017 at 6:56