Post Reply 
HP Prime BEEPER.
05-24-2023, 01:09 AM (This post was last modified: 05-24-2023 01:26 AM by matalog.)
Post: #1
HP Prime BEEPER.
Finally the HP Prime gets a voice :-).



Find all posts by this user
Quote this message in a reply
05-24-2023, 09:35 AM
Post: #2
RE: HP Prime BEEPER.
(05-24-2023 01:09 AM)matalog Wrote:  Finally the HP Prime gets a voice :-).




Very nice indeed!

Are you using the native arduino command:

tone(buzzerPin, freq,duration);

Sent via USBSend({}) as series of bytes?

I have the ProMicro Atmegu32U4 which I think is shown in your vid. Did you install Arduino HID from here:
https://github.com/NicoHood/HID

Could you upload the Prime prog? Smile
Find all posts by this user
Quote this message in a reply
05-24-2023, 07:28 PM
Post: #3
RE: HP Prime BEEPER.
Very cool indeed. One final challenge - add in 'bitlash' to your Arduino and then let Prime take over ..
Find all posts by this user
Quote this message in a reply
05-24-2023, 07:36 PM
Post: #4
RE: HP Prime BEEPER.
By pressing down a special key
It plays a little melody.

— Ian Abbott
Find all posts by this user
Quote this message in a reply
05-24-2023, 10:31 PM
Post: #5
RE: HP Prime BEEPER.
Very nice. Presumably the tone generation is done by the Arduino and you just send the tone string using USBSend()? It would be great if you could show the source for both the Prime and the Arduino and how we can build the circuit.

Can all this HID and i2c be combined with Grove?
Find all posts by this user
Quote this message in a reply
05-25-2023, 11:53 AM (This post was last modified: 05-25-2023 11:53 AM by Amer7.)
Post: #6
RE: HP Prime BEEPER.
how in the world did you figure this out?
-really cool
Find all posts by this user
Quote this message in a reply
05-25-2023, 12:30 PM
Post: #7
RE: HP Prime BEEPER.
(05-24-2023 09:35 AM)Stevetuc Wrote:  
(05-24-2023 01:09 AM)matalog Wrote:  Finally the HP Prime gets a voice :-).




Very nice indeed!

Are you using the native arduino command:

tone(buzzerPin, freq,duration);

Sent via USBSend({}) as series of bytes?

I have the ProMicro Atmegu32U4 which I think is shown in your vid. Did you install Arduino HID from here:
https://github.com/NicoHood/HID

Could you upload the Prime prog? Smile


I am not using the native Arduino command, I am using a modified version of another Arduino library called ezbuzzer https://reference.arduino.cc/reference/e.../ezbuzzer/ - it should be able to play in the background and not delay the running of other aspects of the program.

I am sending the instructions to ezbuzzer as sets of bytes to Arduino through USBSend(). Every packet received on Arduino is always 64 bytes long , even if you only send 4 bytes, only the first 4 bytes will be relevant to the Arduino.

Yes, I use the latest NicoHood HID for Arduino.

I will certainly post the code in the near future, I would like to make it a bit tidier before sharing it with others.
Find all posts by this user
Quote this message in a reply
05-25-2023, 12:34 PM
Post: #8
RE: HP Prime BEEPER.
(05-24-2023 10:31 PM)Mark Power Wrote:  Very nice. Presumably the tone generation is done by the Arduino and you just send the tone string using USBSend()? It would be great if you could show the source for both the Prime and the Arduino and how we can build the circuit.

Can all this HID and i2c be combined with Grove?

The tone generation is done with the Arduino currently, and I would like for the Prime to do it, it definitely has the processing power, although, I'm not sure thhat HPPPL would allow it, as some of the notes may need to turn the speaker on and off every 100 microseconds. I'm not sure HPPPL can allow commands so fast. I send the byte list of Tone Values via USBSend() - yes.

I will definitely share the code used, once I have tidied it up a bit, maybe later next week.

I do not know what Grove is, let me know what it is and I will answer your question :-).
Find all posts by this user
Quote this message in a reply
05-25-2023, 06:08 PM
Post: #9
RE: HP Prime BEEPER.
Here are a few links about Grove:

https://store.arduino.cc/products/grove-i2c
https://wiki.seeedstudio.com/Grove_System/
https://wiki.seeedstudio.com/Grove-I2C_Hub/

It allows easy connection of i2c devices, including sensors and a buzzer, which don’t conflict because of their unique ids. Plug and play without needing a breadboard.

All we need next is a 3d sled/stand for the Prime containing the HID controller and a row of Grove connectors across the back.
Find all posts by this user
Quote this message in a reply
05-26-2023, 10:04 PM (This post was last modified: 05-26-2023 10:46 PM by matalog.)
Post: #10
RE: HP Prime BEEPER.
At the start of this project I was thinking how large a piezo could the Arduino feed, which led to how large a speaker could the Arduino feed. Which hasn't met an end yet. I still haven't amplified anything.



Find all posts by this user
Quote this message in a reply
07-01-2023, 08:00 PM (This post was last modified: 07-04-2023 07:16 PM by matalog.)
Post: #11
RE: HP Prime BEEPER.
I have been doing a little bit of work on the Beeper for the HP Prime, and finally ready to share an early version to see if it is working for others.





Latest things available:

* - Variable Lengths of notes. Although I don't show too much in the video, any note can be any length. If this is something that you really care about, then PM me as I have a different version with 256 assignable note lengths 4ms apart.

* - Fast Repeat of full passage. The length of the 'tune' is determined by L1. If L1 is 5 in length then so will the final tune. The notes will repeat so fast that it will seem like an unlimited length, and if you like it so much that you never stop playing it, then, in 2 hours your battery will be wasted!

* - Change Speed live. Press EEX to increase the speed of the tune by one increment and press ALPHA to decrease the speed of the tune by one increment.

* - Change Key of tune live. Press LOG to increase the Key of the tune by one semitone, and press ENTER to decrease the key of the tune by one semitone.

Instructions to use:

Make a variable called YZ (there has to be one or the program won't run). Decent value is YZ:=10. Doesn't matter too much what it is, as long as it is between 1 and 255. It will be necessary to run the program.

IMPORTANT*** - If you want to control the Length of each note, then there has to be a list called L9. L9(1) should be 255 and L9(2) should be the Length (or SIZE()) of L1. This is a measure to ensure that the length of individual notes is only considered when definitely wanted. Otherwise every note length will be the value of YZ.

L7 holds the lengths of each note (when it in enabled as above). 1 is one second, 2 is 1/2 second, 3 is 1/3 second etc. I have another version of the program where lengths of 256 portions of a second are available and much more definable in regards to lengths. When it is not enabled as above, then each space in L9 will be the value in YZ.

I will edit this post as required to help potential users of the program :-).

As a first step for users to try this out, here is a zip file that should be used to install on the Arduino Leonardo or Leonardo Mini:

https://bit.ly/44ttgEa

You should copy the HP_Beeper folder, which is inside HP_Beeper_Arduino_Leonardo.rar, to your Arduino folder, where you save your programs. I have included the 2 libraries in the folder, so hopefully you won't have to download them - and it should be simply a matter of sending the opened file to the Arduino from the editor.


Next part is the HP Prime program. This includes a shortcut key, so that if you have User shortcut buttons enabled then you just have to press the Units button left of Catalog, to access the beeper program.

BEEP Program: https://www.dropbox.com/s/3pqgpgm2ku6n0m...pprgm?dl=0

You just copy BEEP.hpprgm to the Programs area on your HP Prime G2. You can do that in the HP Connectivity Kit.

You will most likely have to change the numbers within parenthesis on line 12 of the program "L2:=USBOpen(9025,32822); " to whatever your caluclator returns when you have an arduino connected and you enter "USBOpen()".

Please let me know if anything isn't working and I Will try to fix problems or help towards solutions at this early stage of development. Also let me know if you get it working.
Find all posts by this user
Quote this message in a reply
07-04-2023, 06:39 PM
Post: #12
RE: HP Prime BEEPER.
(07-01-2023 08:00 PM)matalog Wrote:  I have been doing a little bit of work on the Beeper for the HP Prime, and finally ready to share an early version to see if it is working for others.





Latest things available:

* - Variable Lengths of notes. Although I don't show too much in the video, any note can be any length. If this is something that you really care about, then PM me as I have a different version with 256 assignable note lengths 4ms apart.

* - Fast Repeat of full passage. The length of the 'tune' is determined by L1. If L1 is 5 in length then so will the final tune. The notes will repeat so fast that it will seem like an unlimited length, and if you like it so much that you never stop playing it, then, in 2 hours your battery will be wasted!

* - Change Speed live. Press EEX to increase the speed of the tune by one increment and press ALPHA to decrease the speed of the tune by one increment.

* - Change Key of tune live. Press LOG to increase the Key of the tune by one semitone, and press ENTER to decrease the key of the tune by one semitone.

Instructions to use:

Make a variable called YZ (there has to be one or the program won't run). Decent value is YZ:=10. Doesn't matter too much what it is, as long as it is between 1 and 255. It will be necessary to run the program.

IMPORTANT*** - If you want to control the Length of each note, then there has to be a list called L9. L9(1) should be 255 and L9(2) should be the Length (or SIZE()) of L1. This is a measure to ensure that the length of individual notes is only considered when definitely wanted. Otherwise every note length will be the value of YZ.

L7 holds the lengths of each note (when it in enabled as above). 1 is one second, 2 is 1/2 second, 3 is 1/3 second etc. I have another version of the program where lengths of 256 portions of a second are available and much more definable in regards to lengths. When it is not enabled as above, then each space in L9 will be the value in YZ.

I will edit this post as required to help potential users of the program :-).

As a first step for users to try this out, here is a zip file that should be used to install on the Arduino Leonardo or Leonardo Mini:

https://bit.ly/44ttgEa

You should copy the HP_Beeper folder, which is inside HP_Beeper_Arduino_Leonardo.rar, to your Arduino folder, where you save your programs. I have included the 2 libraries in the folder, so hopefully you won't have to download them - and it should be simply a matter of sending the opened file to the Arduino from the editor.


Next part is the HP Prime program. This includes a shortcut key, so that if you have User shortcut buttons enabled then you just have to press the Units button left of Catalog, to access the beeper program.

You just copy BEEP.hpprgm to the Programs area on your HP Prime G2. You can do that in the HP Connectivity Kit.

You will most likely have to change the numbers within parenthesis on line 12 of the program "L2:=USBOpen(9025,32822); " to whatever your caluclator returns when you have an arduino connected and you enter "USBOpen()".

Please let me know if anything isn't working and I Will try to fix problems or help towards solutions at this early stage of development. Also let me know if you get it working.

don't seem to be any BEEP.hpprgm file in this rar file.
Find all posts by this user
Quote this message in a reply
07-04-2023, 07:16 PM
Post: #13
RE: HP Prime BEEPER.
Apologies, the BEEP file is now linked in the previous post.

Here it is too: https://www.dropbox.com/s/3pqgpgm2ku6n0m...pprgm?dl=0
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 2 Guest(s)