ping not working #18

Closed
kelly opened this Issue Jul 19, 2012 · 28 comments

Comments

Projects
None yet
@kelly

kelly commented Jul 19, 2012

I see that ping requires a special build of Firmata. Are there more details on where to find the special build?

@rwaldron

This comment has been minimized.

Show comment
Hide comment
@rwaldron

rwaldron Jul 19, 2012

Owner

I haven't had a chance to document it and it's definitely a work in progress, but if you're feeling adventurous :)

(note, I only know how to walk you through on a Mac)

If Arduino IDE is open, quit!

# Get yourself into this directory...
cd /Applications/Arduino.app/Contents/Resources/Java/libraries/

# make a backup of the existing Firmata
cp -r Firmata Firmata_stable

# rm Firmata
rm -r Firmata

# clone the experimental repo branch
git clone git://github.com/jgautier/arduino-1.git Firmata

# enter!
cd Firmata

# get the branch with pulseIn
git checkout -b pulseIn origin/pulseIn

Now open the Arduino IDE.

File > Examples > Firmata > Standard Firmata

Once that's loaded into the IDE, confirm it is the correct program by searching for "PULSE_IN"

Compile and upload!

If you receive an error about PULSE_IN not being in scope, then copy this:

#define PULSE_IN                0x74 // send a pulse in command

...and add it below this line:

#define REGISTER_NOT_SPECIFIED -1

Compile and upload to the Arduino. Close the IDE.

EDIT: (adding @korevec's additional instructions)

EDIT: March 2014, the steps below are no longer necessary, as the pulseIn branch ships in master

# Get into johnny-fives node module deps dir
cd johnny-five/node_modules

# copy the old firmata
cp -r firmata/ firmata-npm

# clone julian's upstream in place of the old firmata
git clone git://github.com/jgautier/firmata.git 

# enter the repo, create a pulseIn branch and pull julian's pulseIn branch
cd firmata && git checkout -b pulseIn && git pull origin pulseIn

Now you should be able to use Ping. Hopefully I haven't missed anything - let me know if I have :)

Also, I'm on IRC/freenode in #robotjs (nick: rwaldron)

Owner

rwaldron commented Jul 19, 2012

I haven't had a chance to document it and it's definitely a work in progress, but if you're feeling adventurous :)

(note, I only know how to walk you through on a Mac)

If Arduino IDE is open, quit!

# Get yourself into this directory...
cd /Applications/Arduino.app/Contents/Resources/Java/libraries/

# make a backup of the existing Firmata
cp -r Firmata Firmata_stable

# rm Firmata
rm -r Firmata

# clone the experimental repo branch
git clone git://github.com/jgautier/arduino-1.git Firmata

# enter!
cd Firmata

# get the branch with pulseIn
git checkout -b pulseIn origin/pulseIn

Now open the Arduino IDE.

File > Examples > Firmata > Standard Firmata

Once that's loaded into the IDE, confirm it is the correct program by searching for "PULSE_IN"

Compile and upload!

If you receive an error about PULSE_IN not being in scope, then copy this:

#define PULSE_IN                0x74 // send a pulse in command

...and add it below this line:

#define REGISTER_NOT_SPECIFIED -1

Compile and upload to the Arduino. Close the IDE.

EDIT: (adding @korevec's additional instructions)

EDIT: March 2014, the steps below are no longer necessary, as the pulseIn branch ships in master

# Get into johnny-fives node module deps dir
cd johnny-five/node_modules

# copy the old firmata
cp -r firmata/ firmata-npm

# clone julian's upstream in place of the old firmata
git clone git://github.com/jgautier/firmata.git 

# enter the repo, create a pulseIn branch and pull julian's pulseIn branch
cd firmata && git checkout -b pulseIn && git pull origin pulseIn

Now you should be able to use Ping. Hopefully I haven't missed anything - let me know if I have :)

Also, I'm on IRC/freenode in #robotjs (nick: rwaldron)

@kelly

This comment has been minimized.

Show comment
Hide comment
@kelly

kelly Jul 20, 2012

Thanks for the quick response! It worked :) I added one more step. I had to checkout the pulseIn branch on https://github.com/jgautier/firmata/

kelly commented Jul 20, 2012

Thanks for the quick response! It worked :) I added one more step. I had to checkout the pulseIn branch on https://github.com/jgautier/firmata/

@rwaldron

This comment has been minimized.

Show comment
Hide comment
@rwaldron

rwaldron Jul 20, 2012

Owner

The last git step didn't work for that? I should move these instructions to the read me

Owner

rwaldron commented Jul 20, 2012

The last git step didn't work for that? I should move these instructions to the read me

@kelly

This comment has been minimized.

Show comment
Hide comment
@kelly

kelly Jul 20, 2012

The last git step is for the arduino firmata pulseIn branch. It also needs the node firmata pulseIn branch. Or, am I confused? ;)

kelly commented Jul 20, 2012

The last git step is for the arduino firmata pulseIn branch. It also needs the node firmata pulseIn branch. Or, am I confused? ;)

@rwaldron

This comment has been minimized.

Show comment
Hide comment
@rwaldron

rwaldron Jul 20, 2012

Owner

Haha -- yes, I totally missed that.

Can you help me update this with the missing steps? We'll add it to the repo for others to follow :)

Owner

rwaldron commented Jul 20, 2012

Haha -- yes, I totally missed that.

Can you help me update this with the missing steps? We'll add it to the repo for others to follow :)

@jgautier

This comment has been minimized.

Show comment
Hide comment
@jgautier

jgautier Aug 1, 2012

Contributor

might as well merge the pulseIn branch into master node firmata. shouldnt hurt anything with it being there.

Contributor

jgautier commented Aug 1, 2012

might as well merge the pulseIn branch into master node firmata. shouldnt hurt anything with it being there.

@Rolilink

This comment has been minimized.

Show comment
Hide comment
@Rolilink

Rolilink Oct 8, 2012

i got problems here:

cd firmata && git cob pulseIn && git pull origin pulseIn

Cant find command cob

Rolilink commented Oct 8, 2012

i got problems here:

cd firmata && git cob pulseIn && git pull origin pulseIn

Cant find command cob

@rwaldron

This comment has been minimized.

Show comment
Hide comment
@rwaldron

rwaldron Oct 8, 2012

Owner

Oh, ouch. my bad. Those are shortcuts that I have on my system. I had copy/pasted this. I'm sorry about that.

Owner

rwaldron commented Oct 8, 2012

Oh, ouch. my bad. Those are shortcuts that I have on my system. I had copy/pasted this. I'm sorry about that.

@rwaldron

This comment has been minimized.

Show comment
Hide comment
@rwaldron

rwaldron Oct 8, 2012

Owner

Should be:

cd firmata && git checkout -b pulseIn && git pull origin pulseIn
Owner

rwaldron commented Oct 8, 2012

Should be:

cd firmata && git checkout -b pulseIn && git pull origin pulseIn
@Rolilink

This comment has been minimized.

Show comment
Hide comment
@Rolilink

Rolilink Oct 11, 2012

ok thanks :)!

ok thanks :)!

@remy

This comment has been minimized.

Show comment
Hide comment
@remy

remy Oct 23, 2012

I just got this working on a 4 ping sensor ( HC-SR04 ) with directions from @nexxy. Basically, "bridge" the Trigger and the Echo pins. Simply put a jumper wire between these two pins as per @rwldrn's pic (the bridge between 18 & 19) - then the values come through on both the Trigger & Echo, so you can pop either one in the digital out.

remy commented Oct 23, 2012

I just got this working on a 4 ping sensor ( HC-SR04 ) with directions from @nexxy. Basically, "bridge" the Trigger and the Echo pins. Simply put a jumper wire between these two pins as per @rwldrn's pic (the bridge between 18 & 19) - then the values come through on both the Trigger & Echo, so you can pop either one in the digital out.

@rwaldron

This comment has been minimized.

Show comment
Hide comment
@rwaldron

rwaldron Oct 23, 2012

Owner

It was weird when I opened this and saw the picture... since the breadboard and HC-SR04 are still sitting on my desk exactly as shown here...

Owner

rwaldron commented Oct 23, 2012

It was weird when I opened this and saw the picture... since the breadboard and HC-SR04 are still sitting on my desk exactly as shown here...

@remy

This comment has been minimized.

Show comment
Hide comment
@remy

remy Oct 23, 2012

@rwldrn and I had to screenshot your picture, because twitter screws with image urls, if you open them, it'll give you the full web page.

remy commented Oct 23, 2012

@rwldrn and I had to screenshot your picture, because twitter screws with image urls, if you open them, it'll give you the full web page.

@LeventErkok LeventErkok referenced this issue in LeventErkok/hArduino Mar 1, 2013

Closed

pulseIn/pulseOut accuracy #6

@LeventErkok

This comment has been minimized.

Show comment
Hide comment
@LeventErkok

LeventErkok Mar 3, 2013

Hi there.. I'm working on a Firmata based Arduino project and needed a PulseIn function like you implemented here. Great work. It'd be really nice if this was included in the Standard Firmata release. Any chance you might send them a pull request?

Also, it might be more flexible if trigger and echo lines can be separated; i.e., send echo on one line and read the trigger on a different one. (The user can of course use the same pin if so desired.)

Hi there.. I'm working on a Firmata based Arduino project and needed a PulseIn function like you implemented here. Great work. It'd be really nice if this was included in the Standard Firmata release. Any chance you might send them a pull request?

Also, it might be more flexible if trigger and echo lines can be separated; i.e., send echo on one line and read the trigger on a different one. (The user can of course use the same pin if so desired.)

@dwayn

This comment has been minimized.

Show comment
Hide comment
@dwayn

dwayn Jul 15, 2013

Contributor

I merged the pulsein changes from https://github.com/jgautier/arduino-1/tree/pulseIn into AdvancedFirmata, so that hopefully we can get all custom functionality into a single place (steppers, pulsein, etc)
You can find it currently at: https://github.com/dwayn/AdvancedFirmata/tree/pulsein and I also have an outstanding pull request back to soundanalogous to get it merged into root repo.
Tested with eg/ping.js and all seems to be working correctly

Contributor

dwayn commented Jul 15, 2013

I merged the pulsein changes from https://github.com/jgautier/arduino-1/tree/pulseIn into AdvancedFirmata, so that hopefully we can get all custom functionality into a single place (steppers, pulsein, etc)
You can find it currently at: https://github.com/dwayn/AdvancedFirmata/tree/pulsein and I also have an outstanding pull request back to soundanalogous to get it merged into root repo.
Tested with eg/ping.js and all seems to be working correctly

@gillesruppert

This comment has been minimized.

Show comment
Hide comment
@gillesruppert

gillesruppert Jul 23, 2013

For people coming to this issue now (23/07/2013): the master branch of https://github.com/jgautier/firmata works fine, whereas the pulseIn branch does not work at this point in time, so you can ignore the last step of @rwldrn 's instructions (i.e. checking out the pulseIn branch on @jgautier 's firmata repo).

For people coming to this issue now (23/07/2013): the master branch of https://github.com/jgautier/firmata works fine, whereas the pulseIn branch does not work at this point in time, so you can ignore the last step of @rwldrn 's instructions (i.e. checking out the pulseIn branch on @jgautier 's firmata repo).

@rwaldron

This comment has been minimized.

Show comment
Hide comment
Owner

rwaldron commented Jul 23, 2013

Thanks!!

Avoid this altogether with http://www.maxbotix.com/Ultrasonic_Sensors.htm#LV-EZ

@gillesruppert

This comment has been minimized.

Show comment
Hide comment
@gillesruppert

gillesruppert Jul 23, 2013

@rwldrn I will, but the HC-SR04 is really popular (and very cheap), so you see them used a lot. I thought I better let people know here to avoid the pain I've been through and for the trouble shooting guide. 😉

@rwldrn I will, but the HC-SR04 is really popular (and very cheap), so you see them used a lot. I thought I better let people know here to avoid the pain I've been through and for the trouble shooting guide. 😉

@rwaldron

This comment has been minimized.

Show comment
Hide comment
@rwaldron

rwaldron Jul 23, 2013

Owner

I know :) and I appreciate the update!

Owner

rwaldron commented Jul 23, 2013

I know :) and I appreciate the update!

@awaterma

This comment has been minimized.

Show comment
Hide comment
@awaterma

awaterma Jul 25, 2013

Thanks for this fix! Nexxy helped me get this running this afternoon via IRC and pointing to this issue. So cool to run the Arduino from Node. ;)

Thanks for this fix! Nexxy helped me get this running this afternoon via IRC and pointing to this issue. So cool to run the Arduino from Node. ;)

@xhava

This comment has been minimized.

Show comment
Hide comment
@xhava

xhava Jul 31, 2013

hi, i really like johnny-five i think that it is amazing but, there is something like documentacion or some books in order to learn about this amazing library named johnny-five.

xhava commented Jul 31, 2013

hi, i really like johnny-five i think that it is amazing but, there is something like documentacion or some books in order to learn about this amazing library named johnny-five.

@felixsanz

This comment has been minimized.

Show comment
Hide comment
@felixsanz

felixsanz Aug 4, 2014

is this still working? cause here i don't get anything in console

is this still working? cause here i don't get anything in console

@rwaldron

This comment has been minimized.

Show comment
Hide comment
@rwaldron

rwaldron Aug 4, 2014

Owner

@felixsanz have you loaded the the modified version of StandardFirmata onto the board? https://github.com/rwaldron/johnny-five/wiki/Ping#setup

Owner

rwaldron commented Aug 4, 2014

@felixsanz have you loaded the the modified version of StandardFirmata onto the board? https://github.com/rwaldron/johnny-five/wiki/Ping#setup

@felixsanz

This comment has been minimized.

Show comment
Hide comment
@felixsanz

felixsanz Aug 4, 2014

Meh, sorry. I was using "gort" to upload firmata and i thought that i could checkout that pulse-in firmata to gort, so gort uploads that new one. Fail. I needed to push the firmata using arduino IDE as your link suggest. Thx

Meh, sorry. I was using "gort" to upload firmata and i thought that i could checkout that pulse-in firmata to gort, so gort uploads that new one. Fail. I needed to push the firmata using arduino IDE as your link suggest. Thx

@rwaldron

This comment has been minimized.

Show comment
Hide comment
@rwaldron

rwaldron Aug 5, 2014

Owner

@felixsanz Glad you were able to make progress. Let me know if you have any other questions

Owner

rwaldron commented Aug 5, 2014

@felixsanz Glad you were able to make progress. Let me know if you have any other questions

@rwaldron

This comment has been minimized.

Show comment
Hide comment
@rwaldron

rwaldron Aug 5, 2014

Owner

@felixsanz Looks like gort ships pre-compiled .hex files to be uploaded. I'm sorry if that tool was misleading, I know how awful the feeling of temporary failure can be. Here's my pledge: to avoid this in the future, I'm going to try to find a better way to manage the pulseIn branch of StandardFirmata. Ideally we can do it as a module that can be installed via npm.

Owner

rwaldron commented Aug 5, 2014

@felixsanz Looks like gort ships pre-compiled .hex files to be uploaded. I'm sorry if that tool was misleading, I know how awful the feeling of temporary failure can be. Here's my pledge: to avoid this in the future, I'm going to try to find a better way to manage the pulseIn branch of StandardFirmata. Ideally we can do it as a module that can be installed via npm.

@rwaldron

This comment has been minimized.

Show comment
Hide comment
@rwaldron

rwaldron Aug 5, 2014

Owner

@felixsanz check this out: https://github.com/AdamMagaluk/leo there are a whole bunch of "ino" modules for this. I'm going to look into making a pulseIn-enabled StandardFirmata ino for this :)

Owner

rwaldron commented Aug 5, 2014

@felixsanz check this out: https://github.com/AdamMagaluk/leo there are a whole bunch of "ino" modules for this. I'm going to look into making a pulseIn-enabled StandardFirmata ino for this :)

@felixsanz

This comment has been minimized.

Show comment
Hide comment
@felixsanz

felixsanz Aug 5, 2014

Thats a great tool, thanks!

Thats a great tool, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment