HiJack In the Box – Part 1 – iPhone HiJack Tutorial

August 21, 2011

Part 1 | Part 2 | Part 3

Another weekend tutorial!

This time, I would be demonstrating HiJack, a device that can integrate sensors to your iOS gadget using only the headphone jack. Isn’t it amazing? For more details about the project, you can visit the HiJack project site and also Seeedstudio on where I got this amazing product from.

The HiJack is a nice platform to build external sensors that can provide analog input iOS device. You can do lots of analog-ish devices like temperature sensors, moisture sensors, humidity sensor, etc.. So why this? I can opt to do sensors through iPhone SoftModem (waay cheaper) but it would need an external controller board (like Arduino) and an external power source.

Lets get it on!

05 my bear likes it

The prerequisites for this demo are:

  1. Follow Seeedstudio’s procedure on loading the firmware of the HiJack mainboard (you have to make sure, mine was not loaded).
  2. Download the HiJack application from iTunes, it is free don’t worry.
  3. Get any rotary potentiometer, I know you have somewhere stashed on your bin. It does not matter what value, I used a 5kOhm one.
  4. Get some jumper wires. I used 1 pin female wires for easier setup.
  5. You can use a breadboard if needed

For this demo, we would be using a rotary potentiometer, which will emulate an analog input device for us. We can wire up the pot as below:

01 set up pot 1

Following Seeedstudio’s schematic diagram for the HiJack mainboard, we will connect the potentiometer to the GND, VCC and A6 pins on the HiJack device. For the uninitiated, we can say that the middle pin on the potentiometer connects to the A6 pin and the two other pins can connect to either GND and VCC.

01 setup pot 2

This is from Seeedstudio

After wiring it up, you may now start the HiJack app on the iOS device and play around with it:

02 connect to hijack

And that’s the end of the tutorial right?

Hmm so what better way to play around with it than testing it with an oscilloscope!

My bear likes to see the squiggly lines of the oscilloscope:

06 bear osc

It may be a bit of a paradigm because it would be an oscilloscope testing an oscilloscope:

03 test with osc

I connected the probes to the A6 and GND pins and started the signal generator to put out 10hz (it is the lowest possible frequency that the Seeedstudio DSO Nano 2 can produce):

04 freq gen test

True to the test, the HiJack app can detect the 10hz frequency. But let us try out the other pins

From the output jack, we can see the 22khz frequency which is used to power the device:

07 hearing 22khz

Below is the mic pin:

09 hearing mic

Each L and R pins output a different signal:

08 hearing L and R

But I won’t care for now as I don’t know anything about what protocols the HiJack device uses to communicate with the iOS.

For the next part, we will try to create our own iPhone app to interface with the HiJack! Great!

;

About these ads

80 Responses to “HiJack In the Box – Part 1 – iPhone HiJack Tutorial”

  1. pandachingdou said

    the bear is so cute.

    • lior said

      i was wonder if can you help me about harvesting voltage out of the phone’s jack.

      or maybe even pointing me to an existing device which allow me to extract power from the jack. in order to use it to another external peripheral device.

      Thank you very much for your time (any response what-so-ever will perfect)
      Lior

  2. Nice post, I just got my pack. I followed your setup and I got it to work with the HiJack App. However, it is very sporadic. It was working, now it doesn’t do anything. Turning the potentiometer does nothing. I can’t figure it out. Did you by any chance encounter the same problems.

    • I think the delegate eats way too much time from the main thread. This is also encountered by the other people, even the hijacklib team. However I am still trying to do a non-delegate approach but so far I am not getting any good result too.

      • lior said

        i was wonder if can you help me about harvesting voltage out of the phone’s jack.

        or maybe even pointing me to an existing device which allow me to extract power from the jack. in order to use it to another external peripheral device.

        Thank you very much for your time (any response what-so-ever will perfect)
        Lior

    • Paul said

      I agree Babak. Got my kit, and tried the tutorial. I’ve flashed the binary to the device, but for me it just doesn’t work.
      I see a low voltage (0.6v)on the vcc and gnd from the board, suggesting that it is powered up to a degree. But I don’t see the app working as expected.

      My conclusion is this doesn’t really work.

      • Hello Paul, is the volume turned up to the max when you plug in the module? The power supply of the module depends on the volume output of the phone.

        • Paul said

          Thank you for your quick response.

          Yes I have the volume up full. I’m using an early generation ipod touch – I don’t know if that has anything to do with it.

          I have also written some code for Windows Phone, and here I see only 0.3v. Could this be due to the amplitude of my sine wave or its general quality? Not sure how this affects things but sure it does in some way :-)

          any advice greatfully received.

          • In this URL “http://www.eecs.umich.edu/~prabal/pubs/papers/kuo10hijack.pdf” says that u need to generate a 22Khz waveform. In the “2.3 Harvesting Energy Efficiently” part.

          • Hello Paul, indeed it depends on the frequency you send from the phone. It needs 22khz (as said from their site) and we would have to stack them up so it will be a constant 22khz tone. If we would be looking the signal from an oscilloscope then we should be seeing multiple 22khz frequencies stacked up on each other. But I have not yet tried to manually do it.

            • Paul said

              Yes I’m producing a 22khz wave form in mono at the moment. When you say ‘stack them up’ what do you mean? Sorry I don’t follow. As well as my own code, I have used other signal generator apps. By increasing the amplitude I did see an increase in voltage on.

              I don’t have a scope to test this with, but I’ve today ordered the DSC Nano V2 you are using, so I hope to be able to prove the hijack board is working when this arrives (hopefully by the weekend).

              Quick q: The Seeed Studio Wiki shows this demo using their proto-typing board, with the analog twig connection. Can you tell me if the hijack board binaries differ between your implementation and theirs?

              I’ve tried to do the implementation in both ways, and only once saw the expected App Store ocsilloscope result. I haven’t been able to reproduce it again.

              Any additional thoughts? Appreciate your help here :-)

              • Pedro said

                mmm… I already test my pack and it’s working with the part 1 tutorial. But I cant install the hardware drivers in my compurer :S. So i cant change the firmware. Another question that I have is if I can change the code in the mainboard. I want to use some other pins.

                Thank u…

                • Yes you can change the code on the main board. I have something in the works but I am not yet able to document it here due to that I cannot get it to work. You can see a sample of a build here: http://t.co/ooMYilNm. As you would see, it produces the .ihex file that you can use to upload the firmware. The firmware is TinyOS.

              • Oops I am sorry, I am wrong and seem to talk about a different thing about the “stack em up”. Sorry again. But yes indeed I tried a signal generator too and cannot seem to get something out of a 22khz signal. You can see the one that the sample code signal output here: http://t.co/eXrKNRRL. Apologies for the blur but I also cannot reproduce this from a signal generator. I can investigate further. The voltage that comes out of it is 480mV.

                • Pedro said

                  mmm… are you already gave the dev/ttyUSB0 permission? i posted u my gmail in your twitter account.

                • Ow, for the usb port, I think the error is ok because I don’t have the module plugged in too. The one I am after is the .ihex file output. It will be the one that we will use to upload using the program created by Seeedstudio.

  3. Rene Cardenas said

    Does anyone have this Hijack kit and may not be using it?
    I would not mind paying you a little premium in top of your expenses. I have couple of ideas that I would like to test.

    Wendel,
    Thanks for the post!, any updates with the DSK or iPhone software tools?

    • Hello Rene,
      I was busy a bit these days and I am still not able to get back to them but thank goodness I’m just done during the weekend. Maybe I can try FSK this weekend and I’ll post one here.

  4. Tatko said

    Hi Wendel,
    This is a great job.
    We hope to show us things and FSK.

    Redards
    Tatko

  5. Pedro said

    Hello!! you have a very nice post here. I want to develop a similar project but using Android. Do you have some new post using it? Thank you!

    • Hello Pedro,

      Thanks! Unfortunately, I don’t have an Android phone to experiment on. Though there are some hardware kits made for Android such as the IOIO and the ADK kit by Seeedstudio. You can check them out here:

      http://www.seeedstudio.com/depot/microcontrollers-android-c-132_206.html

      Hope it helps,
      Wendell;

      • Pedro said

        mmm… the problem here is that i dont want to use arduino or anithing similar. I want to use a pic in order to develop the project. But i thing that i can use your device and use it on android. Your kit only needs some data to receive and transmite aren’t you?.

        • My apologies as I’m afraid that I won’t be able to provide much help in using the HiJack module with Android but the module is using Manchester encoding (I’m not an expert on this) and relies on the way you transmit the bits using frequencies on the output jack. Its like converting a byte into a series of high-low frequencies per bit for the module to understand and should follow transitions on how to represent bits. Maybe when something is about to be transmitted, lets say number 38 or binary 100110, the frequencies we will transmit are: [high-low]-[low-high]-[low-high]-[high-low]-[high-low]-[low-high] because a “1” is a high-low and a “0” is a low-high transition. The high frequency of the module is “1378.125” as from the iOS code and the low is 1378.125/2. You can hear this frequency when played on any sound generator.

          Someone please do can correct me if I’m wrong.

      • Pedro said

        I want to adquire the kit but there is no more in stock on seeedstudio.com do you have some other kit? or when would be possible to buy one of them in seeedstudio.com

        Im from mexico

        Thank you

  6. Paul said

    Starting a new thread – so I can read it!

    I’ve tried my board on an iphone 4 today. The example Hijack app sees 0.9 volts. On my WP7, with a maximum sampling rate of 48khz I can achieve 0.6 volts.

    I am wondering if this is purely a volume thing. Both devices are up full volume :-|

    I’m going to reflash my device and see if that makes a difference.
    But the gist is the power harvesting isn’t working – or am I measuring from the wrong place (VCC/GND pins) to find the expected 3.3v?

    • Paul said

      By going stereo on my output and increasing the amplitude I can get to 0.36v at maximum volume.

      • Jack Schmandt said

        You may want to try using different frequencies with your WP7 – the 22kHz listed in the HiJack paper is the result of several factors including the impedance of the iPhone 3.5mm port. As far as I know, the hardware of the iPhone 4 and the 3GS is the same, but it varies between Android phones and WP7 phones. Unfortunately, the ideal frequency for energy harvesting using HiJack for many phones is outside of spec. This is one of the problems with using this board for developing on other platforms.

  7. Tiffany said

    I bought the HiJack from Seeedstudio. (http://www.seeedstudio.com/depot/hijack-development-pack-p-865.html?pages=2&cPath=174&r_q=q) and I followed the tutorial to reinstall firmware. http://www.seeedstudio.com/wiki/index.php?title=Hijack#Download_the_firmware
    However, I keep getting timeout during Mass erase(-e). I already made sure that

    (1) the mainboard and program board are connected to my laptop. (LED is on)
    (2) I changed port to COM1 when I use windows
    (3) I also try using Linux after I downloaded TinyOS. (/dev/ttyUSB0) Still the same error
    (4) I don’t get error from reset(-r) though. I saw there is an orange light coming from the board blinking. So I guess reset is working.

    One thing I noticed is that the picture of the mainboard in Seeedstudio website is a little different from the one in tutorial. I hope it’s just some reallocate of component. The firmware package on the website should still work.

    Could you please tell me how to debug so that I will be able to reinstall the firmware you provided and I can modified it to have I2C function later.
    Thank you very much.

    • Hello Tiffany, my apologies for the late reply. I have encountered that problem before and it was due to the FT232 driver of the HiJack programmer. I was using Windows 7 then.

      Hope it helps!

      • Tiffany said

        Thanks for the reply. In my case, it is actually because of the one of the pins on the programmer board is shorter than others. After fixing it, it works. :)

  8. Reblogged this on C World and commented:
    What I will be using to get EEG data into the iPhone – unless I can find something better!

  9. Victor said

    Hi, I cannot seem to find the HiJack app on the apple appstore.

    Has it been removed?

  10. Will said

    Hi, I’ve had great luck following all of your HiJack tutorials and using the information to integrate the HiJack into one of my projects! Thank you.

    Now for my project I need the VCC to output set values synchronized with the clock. I know I can’t do this with libHiJack so I’ve installed tinyOS on my machine. Should I go about this by making changes to their source code then upgrading the firmware to include the changed files? I’m not experienced with tinyOS, but I have written an nesC routine which tells the MSP430 to output a triangular wave. Now I’m hoping that there’s a straightforward way to drop my code into their project and get it onto the hardware. I know this could be a tough question, so any help is greatly appreciated!

  11. Will said

    Thank you for replying! Have you tried to do this? I’m having trouble compiling the .ihex file. I followed the instructions posted on the HiJack main tree, but I can’t get tinyOS to recognize hijack as a target platform. I tried putting the platform file in tos>platforms with the others to no avail.

  12. Angry Birds Space is one of the most original games out there. I think it surpassed previous versions of the game. One should think of planes very different from Newton. Another success of the Finns!

  13. Popiol said

    Hi, what transistors were used in the bridge in power harvesting circuit?

  14. Jeremy Lin said

    Hi, I can’t seem to find the HiJack app on the apple US appstore.

    Has it been removed?

    and I don’t have a development account so i can’t compile the app by myself.
    Can you send it to me?

  15. Rodrick said

    I love to share information that I have accrued through the year
    to assist improve group functionality.

  16. I every time emailed this webpage post page to all my contacts, since if like to read it afterward my links will too.

  17. My spouse and I absolutely love your blog and find most of your post’s to be precisely what I’m looking for.
    can you offer guest writers to write content for
    you personally? I wouldn’t mind composing a post or elaborating on a number of
    the subjects you write about here. Again, awesome website!

  18. I amm sսre this paragraph haѕ touched all the internet users,
    іts гeally гeally nice post on building սp neew blog.

  19. Eden said

    Goodd weeb site you have got here.. It’s difficult tto find quality
    writing like yours nowadays. I serfiously appreciate individuals like you!
    Take care!!

  20. You really make it appear really easy along with your presentation but I in finding this matter to be really one thing that I feel I’d by no means
    understand. It kind of feels too complicated and
    very large for me. I’m looking forward for your next put up, I will try to get the cling of it!

  21. Wonderful blog! I found it while searching on Yahoo News.
    Do you have any suggestions on how to get listed in Yahoo News?
    I’ve been trying for a while but I never seem to get there!
    Thank you

  22. wholesale cheap Raiders jerseys china Made In usa Outlet Coupon

  23. cheap Packers jerseys VIP Size

  24. Wow, this piece of writing is pleasant, my younger sister is
    analyzing such things, thus I am going to inform
    her.

  25. Florene said

    I see a lot of interesting articles on your website. You have to spend a lot of time writing, i know
    how to save you a lot of work, there is a tool that creates unique, google friendly posts in couple of seconds,
    just type in google – k2 unlimited content

  26. I am no longer certain the place you’re getting your info, but great topic.
    I must spend a while learning more or working out
    more. Thanks for excellent info I was on the lookout for this
    information for my mission.

  27. Hey there I am so excited I found your weblog, I really found
    you by mistake, while I was researching on Bing for something
    else, Anyhow I am here now and would just like to say thank you for a incredible post and a all round
    exciting blog (I also love the theme/design), I
    don’t have time to read through it all at the moment but I have saved it and also added in your
    RSS feeds, so when I have time I will be back to read a lot more, Please do keep up the great b.

  28. Ross said

    Your business would need the maximum return for the investment and your business will gradually increase with the increased rankings on the search engines and people visit the site.
    People used to get enough back links to their sites and relied heavily on targeted keywords and key
    phrases to get search engine spiders attracted to their sites
    and achieve search engine optimization in the process.
    The SEO factors are very important and should be considered during
    the building phase of the website and many of these web designers just prefer to
    ignore it.

  29. Alisa said

    Asking questions are genuinely good thing if you are not understanding something totally, except this post presents fastidious understanding yet.

  30. After checking out a handful of the articles on your blog, I truly
    appreciate your way of blogging. I added it to my bookmark webpage
    list and will be checking back in the near future.
    Please check out my website as well and let
    me know your opinion.

  31. Alfonso said

    I read a lot of interesting articles here. Probably you spend a lot of
    time writing, i know how to save you a lot of time, there is
    an online tool that creates readable, google friendly
    articles in seconds, just search in google – laranitas free
    content source

  32. football said

    Stick by your team through thick and thin, despite the wins and losses.

    ‘The teams, the broadcast contract and our showcase games
    this year are going to generate tremendous excitement about this League and the great seasons to come.
    So besides the fact that both sports are being played with 11 players on the field, the similarity
    ends here.

  33. Most people associate The Bridge On the River Kwai with director David Lean. Subscribe above to stay apprised
    of future articles sent straight to your email.
    If I known I would have brought them to England before we left.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: