![]() |
#1 |
Connoisseur
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 91
Karma: 14730
Join Date: Jun 2012
Device: none
|
Accessory port
As the accessory port is being ignored as an output port here (I haven't found here it's used somewhere), I created script that sends text string to the port.
Spoiler:
Connect the LED to the port and try it with ./acsend.sh 'Hello World!'! Timing is very unreliable because it's shell script, but it's not bad anyway. |
![]() |
![]() |
![]() |
#2 | |||
Carpe diem, c'est la vie.
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 6,433
Karma: 10773668
Join Date: Nov 2011
Location: Multiverse 6627A
Device: K1 to PW3
|
Quote:
I was thinking of using the green and yellow power LEDs on a K4 to give it PWM stereo sound output (using photocells with color filters connected to an audio amplifier). Perhaps it would be easier to drive a speaker directly (with a current limiting resistor) if we PWM the accessory port output. More karma for you! ![]() EDIT: Not that it *really* matters when running programs from mmc (especially with this busybox that "short circuits" its own built-ins and ignores the "normal" load process), but the '[' conditional is a PROGRAM that loads and runs from the /bin folder (as I recall), but '[[' is an intrinsic that is executed directly by the shell. This really only makes a difference on non-busybox systems, but it is a good habit (even though it uses more characters on the line). ![]() 2012-Mar-09: Quote:
Quote:
Last edited by geekmaster; 07-29-2012 at 11:34 AM. |
|||
![]() |
![]() |
Advert | |
|
![]() |
#3 | ||
Connoisseur
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 91
Karma: 14730
Join Date: Jun 2012
Device: none
|
Quote:
Quote:
|
||
![]() |
![]() |
![]() |
#4 | |
Carpe diem, c'est la vie.
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 6,433
Karma: 10773668
Join Date: Nov 2011
Location: Multiverse 6627A
Device: K1 to PW3
|
Quote:
I would think that anything that can power an LED could surely drive earphones. Also, piezo "speakers" are very frequency sensitive, with a small range of resonant frequencies. They work great as "beepers", but are very poor for general sound output. I would use cheap (dollar store) headphones or earbuds for testing... ![]() EDIT: You were probably driving the piezo speaker at a frequency too low for it. They are not good at delivering low frequencies from such a small surface area (unless you use many of them in a phased array). They are GREAT at ultrasonic frequencies though. Last edited by geekmaster; 07-29-2012 at 11:37 AM. |
|
![]() |
![]() |
![]() |
#5 |
Carpe diem, c'est la vie.
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 6,433
Karma: 10773668
Join Date: Nov 2011
Location: Multiverse 6627A
Device: K1 to PW3
|
The next obvious (but non-trivial) step is to write an ALSA driver for the K4 that can send sound out the accessory port, adding sound output capability to the K4.
For now (after mmatej provided the "proc" port to poke), I want to add K4 sound support using this method to my "geekmaster video player" in addition to the ALSA sound support used in my "noisy rhythms" demo program (thanks to twobob for giving me the push in the right direction). Of course, my source code will give sound credit to twobob and mmatej. ![]() |
![]() |
![]() |
Advert | |
|
![]() |
#6 |
Carpe diem, c'est la vie.
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 6,433
Karma: 10773668
Join Date: Nov 2011
Location: Multiverse 6627A
Device: K1 to PW3
|
![]()
Here is photo showing the accessory port pads on "older" K4s (like my K4):
Here is photo from amazon.com, showing the accessory port pads on a recent K4: If they really did change the shape of those accessory "pads", that could potentially interfere with my idea to use magnets to attach speaker or headphone wires to them. Why would they DO that anyway? ![]() Last edited by geekmaster; 05-27-2016 at 08:44 AM. Reason: Replace dead image URL |
![]() |
![]() |
![]() |
#7 | |
Connoisseur
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 91
Karma: 14730
Join Date: Jun 2012
Device: none
|
Quote:
Code:
while true; do echo 0 > ${ac}; usleep 100; echo 1 > ${ac}; usleep 100; done; Code:
while true; do echo 0 > ${ac}; echo 1 > ${ac}; done; New bad news: while writing this post I discovered I can hear ticks (about 5 per sec) on the piezo while the port is on. Also, I can hear eink updates clearly (try with while true; do eips -f ''; done) and I think wifi too! When I hold enter in the SSH, I can hear background noise. ![]() |
|
![]() |
![]() |
![]() |
#8 | |
Carpe diem, c'est la vie.
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 6,433
Karma: 10773668
Join Date: Nov 2011
Location: Multiverse 6627A
Device: K1 to PW3
|
Quote:
You are probably driving it way below its resonant frequency. Although there may well be a filter capacitor on the output which could severely impede high frequencies. There may be an ioctl() call so a C program can go faster than writing to a proc file, but I did not find it (yet) in the gpl source code. But the background noise you hear makes it seem like a filter capacitor is unlikely, so there is a good chance that we CAN switch it fast (even if we need to talk to it at a lower level such as direct GPIO output control using a custom device driver). There is a HUGE difference between impossible and "almost impossible" (i.e. requiring heroic effort and/or OCD). ![]() Last edited by geekmaster; 07-29-2012 at 04:01 PM. |
|
![]() |
![]() |
![]() |
#9 | |
Connoisseur
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 91
Karma: 14730
Join Date: Jun 2012
Device: none
|
Quote:
|
|
![]() |
![]() |
![]() |
#10 |
Carpe diem, c'est la vie.
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 6,433
Karma: 10773668
Join Date: Nov 2011
Location: Multiverse 6627A
Device: K1 to PW3
|
Noise on the accessory port is probably caused by voltage fluctuations due to varying load during wifi or 3G transmission (which draws a lot of power), during eink updates, and during other power-hungry events. For PWM output that could be clipped with a resistor and a pair of back-to-back diodes (or LEDs). The ticks might actually be your output. You can time how fast your code runs to see if it matches the tick rate. Like I said, it can take a long time to return from the echo statements, depending on how the device driver handles that sysfs (proc) interface to the accessory port.
|
![]() |
![]() |
![]() |
#11 | |
Connoisseur
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 91
Karma: 14730
Join Date: Jun 2012
Device: none
|
Quote:
|
|
![]() |
![]() |
![]() |
#12 | |
Carpe diem, c'est la vie.
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 6,433
Karma: 10773668
Join Date: Nov 2011
Location: Multiverse 6627A
Device: K1 to PW3
|
Quote:
You may be able to get rid of the ticks by loading a custom linux kernel from /mnt/us (which we can do with kexec, as shown in a thread). A custom kernel could also have direct port access to output reasonably useful audio on a K4. |
|
![]() |
![]() |
![]() |
#13 | |
Connoisseur
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 91
Karma: 14730
Join Date: Jun 2012
Device: none
|
Quote:
Also, there are 5 ticks per second, not tick every 5 seconds. |
|
![]() |
![]() |
![]() |
#14 | |
Carpe diem, c'est la vie.
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 6,433
Karma: 10773668
Join Date: Nov 2011
Location: Multiverse 6627A
Device: K1 to PW3
|
Quote:
Last edited by geekmaster; 07-30-2012 at 10:05 AM. |
|
![]() |
![]() |
![]() |
#15 | |
Connoisseur
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 91
Karma: 14730
Join Date: Jun 2012
Device: none
|
Quote:
|
|
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
eReader accessory that needs to be developed... | dhume01 | General Discussions | 17 | 02-04-2012 11:41 PM |
need accessory advice | iakovl | Nook Color & Nook Tablet | 1 | 11-28-2011 07:35 AM |
DR accessory list | Grimulkan | iRex | 42 | 09-22-2011 04:09 PM |
Kindle Accessory Site | webdevgirl | Amazon Kindle | 8 | 07-09-2009 04:28 AM |