I started a project for lighting control with arduino by means of a bluetooth modem. Center of the system is Seeeduino Mega based on Atmega 1280 with HC-07 bluetooth modem and two Betemcu relay boards (one with four and other with eight relays). I have successfully tested communication between a Android based phone (with Bluetooth SPP Pro installed on it) and Arduino. I have also been successful in sending an ASCII command interpreting it and getting the corresponding relay to react on that command.
I have written most of the code, but have not tested it yet (it is commented out) because I have not identified the pins I can use. I have identified the Bluetooth TX/RX pins and one digital out. I need 10 more digital outs and one pwm out. I hope that documentation of the board will help me identify the pins I can use.
I needed a solution that would recall last setting of the lighting and found possible solution in EEPROMex.h; there have I also found the first unsolvable problem. I have added the library folder (v9.1) to coresponding folder. I have also created three one byte variables to hold all the needed data; first byte containing states of relays on one relay board, second for data on another relay board and the third pwm value for dimmer. I have encountered the problem while trying to compile:
update(address, byte);
I will add complete code at the end, so if someone can point out an error I will appreciate it; or if someone can suggest alternative location for storing those three bytes, other then EEPROM? I am not concerned much with EEPROM number of r/w cycles (I rate the changes to max of 100 a day, on average not more then 40; with 100K at my disposal it gives me five, six years of memory use, and after that I can insert another arduino board).
I had also some other problems, one of them with Bluetooth. I found out that when I first power up a board I can make a BT connection, but the board does not understand (or does not execute) over BT sent commands. After Arduino h/w reset everything works fine. Same thing happens when still connected phone gets outside of modem reach. Same solution. I have tried to just restart the modem, but it does not help. Is there any way to reset parts of the board (registers, timers, something else) to further diagnose the problem?
Another question is also connected, but not directly. I intend to use Android phone for testing purposes only. After finalizing I intend to use a web server on Raspberry PI and a web site to control the lighting from any device using web interface. Could you suggest a web technology that can initiate bluetooth connection under linux? I have found some Java solutions , but as I do not know anything of Java I would prefer some other technology, php would be nice.
which has a complete project. I have another one I am working on that stores the current state in EEPROM so the relays come back on it the same state when power is lost and restored. Email me if you need any help adapting the pfod project to your needs. (Another user adapted it to remote control unlocking/opening his car doors using 12 relays)
You can use the A0 to A5 pins for digital as well as the D pins
I have tried using HC bluetooth modules and gave up. I only use RN modules now, much more reliable. I know of people who successfully use HC modules, I just cannot be bothered with the getting them running.
pfod also has support for non-english character sets built in.
pfod will also connect via wifi (with 128 bit security) this mode might be easier to connect via from your computer. The app is an Android app (for wifi and bluetoot), but the message format is very simple so if you can program in php you should be able to get a simple menu system running on your computer. I am a Java programmer myself. Not much help to you for php.