Monday, September 26, 2022

Makerspace Monday Magic - Talking to Judith

 This robot was a pain in the butt. Fortunately, one of the  manuals is annotated. The project was to talk to Judith, a Pro Arm RS2200 through arduino. Looking at the protocol it SEEMED easy, but the real challenge was how much was going on the behind the scenes in the proprietary software that runs on an apple IIe? Fortunately for me, not much. Keep in mind this did not take one evening. 

I build a shield that connects to the parallel port in the back of the robot via its apple cable. It was straight through. I connected strobe pin 1 to Arduino DIO 2. then the D0 on the robot to DIO 3 on the arduino etc. I kept 1 and 0 open on the arduino because I need the usb connection. with Error on 11, Ack on 12 and Busy on 13, I can set the pins, and then toggle the signal pin, then set the next set of bits. I had a huge issue with the movement command, just keep in mind there is a space between M and the numbers, and those are all commas between the numbers so M 0,0,0,0,0,0 is a valid command. if you screw it up the error light will let you know.

The other issue is the problem of endedness. so to send the open gripper command, you send O, but you send it like 01001111. But then it just waits on you. you need a linefeed and cr 00001010 and 00001101 keep in mind each of these are clocked into the robot. so you set the DIO3-10 to 01001111,  toggle pin two then set the bits to 00001010, toggle pin two, set the bits to 00001101 toggle pin two. For a brief moment you wonder why you didn't hear anything and then realize the gripper was already open.

such is life.

for my next trick I'll have to repair her because she broke her claw cables. I have some cable for that, I just don't know where. 


Saturday, September 24, 2022

Coffee Saturdays. Bus Pirate, MCP4725, and Scuttlebutts

  I miss working on projects in the coffee shop, so I wandered to Scuttlebutts in the Clayworks with a bus pirate, a DAC and a laptop to play around with the DAC and maybe learn something. I'm resurecting the blog because I have too many projects and I don't feel like I get anything done, but I don't have anywhere that is tracking overall progress. So if I write about what I'm doing right now, then perhaps I won't feel so bad.

or perhaps I'll feel worse. Let's see what happens.

I hadn't touched the bus pirate in awhile so some if this is just getting reacquainted with it and maybe learning some new things. I have specific end goals in mind but let's not distract ourselves more than we already are. The bus pirate is a neat tool. Whenever I excitedly babble about it people are just like "an Arduino does that" they are kind of right. An arduino can do all the things a bus pirate does with some code and a circuit. But the bus pirate is a dedicated interpreter of protocols that is already programmed. If you learn the bus pirate you can tie into a problem bus and learn what's going on very quickly. It also has various pwm and dac functions that... yes the arduino has... but are already programmed in. Think of it as a simplistic C3P0 you can use to diag your hyperdrive.

so here is a screenshot of my pirate, it's an older model but it does what I need. Today I mostly just fired it up and connected to it to clear out some cobwebs in my brain. 

On Windows 10 I plug it in and grep device manager and look at what com port it's on. Then I putty into it at 115200 Serial. Screen is always empty when I connect but if you hit enter it will say HiZ>. The bus pirate is nice enough to always start in HiZ mode to avoid breaking whatever it's connected to. so when your done using it you don't have to disconnect anything you can just toss it all in a box for later. Mine lives in a sparkfun box, probably because it came in a sparkfun box. 

So the DAC is an MCP4725 which is a 12 bit DAC that claims it's I2C. Actually, its a module from sparkfun. So there is header pins and whatnot. So we hit m and 4 and it asks us to set the speed. In the datasheet "fast" is 400kbps and there is a ~400KHz so let's see if we can give that an old spinaroo. The mode light on the bus pirate is lit. 

So Ground is tied to ground. Going from Dac to pirate - VCC is tied to 5v (max voltage is 5.5 on the DAC) SDA is tied to CS, SCL is tied to Clk GND is tied to MISO, and out is tied to ADC. 

in 8.1 we find out that SDA and SCL are open drain. So it either does or doesn't sink current. We handle this with pullup resistors ( P ). BUT there is no voltage on Vpullup pin. so we need to W and turn on the power supply unit. Now I have four red lights on the pirate. nothing seems warm, and v Shows me that the 3.3V looks good, the 5v looks good, the ADC is sitting at 2.48 which is halfway between 5v and 0V Aux is low (We aren't connected to it) SCL and SDA are both HI and we don't care about the rest. So not only is the device powered on, but the device is happily sourcing 2.5V and the pirate is reading it and they are all happy.

7.1 says that the device code is 1100. the address bits according to Sparkfun's hookup guide are 0x60 so BUT we want to know for sure, so we check to see what macros we have (0) there is (1)  7 bit address search, and (2) I2C sniffer. (1) found read and write at address 0x62 So that is prob the address for my device. It's 10:00 and I should probably get home. BUT we are talking to and reading the output of the DAC with the bus pirate. So that doesn't suck.

Sunday, December 31, 2017

Power Supply Build

Finished a project that I'd been working on for too long. A power supply. I built the kit at one point and liked it so I wanted to put it in a professional looking case. It needed a cooling fan though as well. I think I got the kit from Bangood as well as the kit, and I think the case. By itself the kit isn't bad. two rotary encoders set the voltage and current clamps, the LCD screen gives you pretty good feedback. but the problem is that the power transistor doesn't have a thermal sink with the kit. There is a second kit available that does this. So I picked that up. works great except.. if I put the fan on top of the thermal sink, it was too tall for the case I picked out. Additionally, the kit didn't come with a transformer. That was an easy fix though. Essentially, I wired the encoders to the control board. so the control board is behind the LCD screen. then the outputs are just right next to it. I've some knobs on the way, aluminum. But I think they will take awhile. So I decided to just post this now before I forget. I'm pretty proud of how it turned out. Simple, functional, and fun.

Monday, December 25, 2017

Updates and backups and logs oh my!

I run Linux on my laptop. So when my daughter said she needed a laptop, I pieced one together, dropped Linux on it and handed it over. She took it home... and let me make this clear... she took it home. How to do upgrades? She isn't a technophobe, just lazy. So I thought, what if I wrote a script, that configures her laptop to handle updates, backups, then emails me when it's done.

That sounds ambitious. So lets find the best way to do all of this together.

so for backups I use

tar cvpzf backup.tgz --exclude=/proc --exclude=/lost+found --exclude=/backup.tgz --exclude=/mnt --exclude=/sys /


this puts a backup tar in the / folder (we have to start there too)

so we can say

#!/bin/bash
# let's talk to the lUser and let them know it's gonna take awhile
echo HI, I just need to do some configuration stuff, Please wait until I'm done
echo This will take a bit probably


:wq out of that and then change the permissions
chmod u+x updatescript

that allows it to be runnable.

I'm adding an option to shutdown when I'm done. something like

shutdown=true

if you use shutdown = true, it will try to run the command shutdown. That's not what we want, we want a bool shutdown that is initialized to true. Conversely, (and we may use this later) delete a variable with unset so unset shutdown, deletes the variable shutdown. We don't want that so we are just going to shut down by default, but ask if she wants us to leave it on.

echo would you like to shutdown on completion?

Windows NEEDS a reboot usually, Linux not so much. Thats just so that she has the option to come back to what she was doing the night before, or see that it's shut down and know it's done. so now we need to read in her answer. so I'm going to let her type in her answer and read it in and check it. so

read shutdown #important to note that c based programmers will pull their hair out with lack of ;

now you can
echo $shutdown

at this point you can read in anything to shutdown. If you type Floppychoppydingdang that's what that will save in the variable

So the NEXT thing that needs to be done, is to parse the input and decide if she wants it shutdown or not... or if one of her kids is banging on the keyboard again.
That sounds like another day.