This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2008-08-18 07:43:23

tristan_roddis
Scratcher
Registered: 2008-08-18
Posts: 3

'spoofing' resistance with an Arduino?

I'd like to be able to use some more complex sensors with Scratch (the wii nunchuck springs to mind), and I was wondering if the following would be possible?:

1) Use an Arduino to decipher signals from another sensor, e.g. the wiimote
2) Connect one of the crocodile clips to one of the Arduino's 'analog in' line
3) Connect the other crocodile clip to one of the Arduino's 'analog out' line
4) Program the Arduino so that if it detects a change in the sensor (e.g. x-axis motion from the wiimote), it writes whatever value it gets from the in pin to the out pin

With my limited understanding of electronic circuits, I would hope that the overall effect for the sensor board would be to see infinitely high resistance (sensor reading 100) if there was no event triggered by the Arduino, and then full conductivity (sensor reading 0) if the Arduino decided to route the in pin to the out pin.

Does anybody have any idea whether this would work?

For what it's worth, the Arduino runs off a 5V supply provided from a USB lead, and it fakes analog voltage by using Pulse Width Modulation to flick the output quickly between 0 and 5V.

My main concern is not to destroy the Picoboard by experimenting if this clearly won't work, or could damage the board!

Alternatively, I saw some mention on this forum post that Ed Baafi has done some work to allow the next version of Scratch (1.3?) to talk to Arduinos directly. Does anyone know if it is possible to get hold of a beta version of this to try instead?

Offline

 

#2 2008-08-18 10:41:57

chalkmarrow
Scratcher
Registered: 2007-05-18
Posts: 100+

Re: 'spoofing' resistance with an Arduino?

tristan: that sounds really interesting. so one of the resistance inputs of the scratch board would see a 500 Hz PWM signal from the Arduino? I'm not sure how the scratch board would interpret that, or if it would damage one of the boards. I'm curious myself. I suspect you'll need some sort of simple circuit between them that modulates resistance as a function of the PWM signal.

As you mentioned at the end of your message, at the conference they demo'd a feature that allows the Scratch program to communicate with other programs and/or hardware. I have no idea whether or to what extent the actual release will conform to what was shown at the conference, but what I understand is that you can establish a TCP socket to Scratch from an external program such that every broadcast and change to a global variable in Scratch is sent out through the socket. Similarly, you can send broadcasts to Scratch from external programs and control the value of a sensor value within one of the sensor pull down menus.

What this means is that you may be able to create a little middleware program (in any language that handles sockets, such as actionscript, processing, ruby, java, python, etc.) to help shuttle commands back and forth between Scratch and something else. I'm working on a program in Processing right now that will be general purpose and will (hopefully) allow Scratch to talk to the Arduino via Processing (using the standard Firmata firmware on the Arduino).  I'll follow up if I get something working...

Last edited by chalkmarrow (2008-08-18 11:09:08)

Offline

 

#3 2008-09-03 10:14:24

chalkmarrow
Scratcher
Registered: 2007-05-18
Posts: 100+

Re: 'spoofing' resistance with an Arduino?

Tristan: as a follow-up, now that 1.3 is out, see:

http://scratch.mit.edu/forums/viewtopic.php?id=9458

Offline

 

#4 2008-10-20 10:35:05

stretchyboy
Scratcher
Registered: 2008-10-16
Posts: 11

Re: 'spoofing' resistance with an Arduino?

Hi,

I have been working on the problem of using a WiiMote to control Scratch programs, using the the new remote sensor stuff.

If you have a pc a wiimote and a bluetooth dongle this is now possible, although not easy just yet (The code I have written does not yet have a simple install process but I'm sure that will change soon).

If you check out my post on Scratch Forums  you can find the code.

Offline

 

Board footer