Years ago, I bought a small bluetooth soundbar from Logitech. One thing I didn't like was that whenever it ran on battery, the bass was gone.
So I decided to build my own bluetooth speaker.
I've actually gone through several iterations, but all except for the prototype have the same PICAXE circuit that takes care of power management.
What I wanted the PICAXE to do is:
1) monitor battery levels for the built-in battery (a small AGM lead-acid battery, for simplicity of use)
2) turn power to the amplifiers and the bluetooth receiver on and off
3) provide a sleep timer that shuts the whole box down after one hour
4) display battery state on a four LED meter (two green, yellow, red)
5) Shut everything down if the battery voltage goes too far down, and display a warning on the battery meter
For what I needed, I went to the PICAXE 14M2, because it had the necessary number of inputs and outputs.
The program I wrote up basically works like this:
1) after power on, turn all battery indicator lights on for a second as a sort of test
2) measure battery state. If battery voltage is too low, display "battery fail state" on the red LED
3) if battery state is sufficient, light up the appropriate LEDs for battery state. The program will then stay there, since the battery will not recover on its own.
4) Energize the relay that sends power to the amps and the volume/bass/treble control board.
5) Switch power to the bluetooth module on.
6) keep monitoring the battery state. The display will only change once ten measurements in row are different from the previous state to prevent flicker from bass pulses dipping the voltage.
7) if sleep button is pushed, start sleep timer. If sleep timer is running, red power LED will flash slowly to show that the timer is running. After one hour, turn all power outputs off. Red LED keeps flashing so I don't forget to throw the main switch to off at some point
8) if sleep button is pushed while the timer runs, timer is cancelled.
9) if the box has fallen asleep, pressing the sleep button will wake it again.
So I decided to build my own bluetooth speaker.
I've actually gone through several iterations, but all except for the prototype have the same PICAXE circuit that takes care of power management.
What I wanted the PICAXE to do is:
1) monitor battery levels for the built-in battery (a small AGM lead-acid battery, for simplicity of use)
2) turn power to the amplifiers and the bluetooth receiver on and off
3) provide a sleep timer that shuts the whole box down after one hour
4) display battery state on a four LED meter (two green, yellow, red)
5) Shut everything down if the battery voltage goes too far down, and display a warning on the battery meter
For what I needed, I went to the PICAXE 14M2, because it had the necessary number of inputs and outputs.
The program I wrote up basically works like this:
1) after power on, turn all battery indicator lights on for a second as a sort of test
2) measure battery state. If battery voltage is too low, display "battery fail state" on the red LED
3) if battery state is sufficient, light up the appropriate LEDs for battery state. The program will then stay there, since the battery will not recover on its own.
4) Energize the relay that sends power to the amps and the volume/bass/treble control board.
5) Switch power to the bluetooth module on.
6) keep monitoring the battery state. The display will only change once ten measurements in row are different from the previous state to prevent flicker from bass pulses dipping the voltage.
7) if sleep button is pushed, start sleep timer. If sleep timer is running, red power LED will flash slowly to show that the timer is running. After one hour, turn all power outputs off. Red LED keeps flashing so I don't forget to throw the main switch to off at some point
8) if sleep button is pushed while the timer runs, timer is cancelled.
9) if the box has fallen asleep, pressing the sleep button will wake it again.