codefox421 Posted February 13, 2015 Author Posted February 13, 2015 Link to Shapeways didn't work. Whats the issue with your original case? There's a ton of 3d printed stuff that looks like Lego. What makes the connector specifically verboten to copy? How about this link? http://shpws.me/EQtr The connector is patented along with other features of the Power Functions system, or so I've been told. Patent searching is rather difficult, and although I never found the Power Functions patents I don't doubt they exist. I'd like to stay as far away from trouble with patent law as I can, hence the redesign. The old version's connectors were verbatim copies of LEGO's connectors. Quote
legoman666 Posted February 13, 2015 Posted February 13, 2015 I see. My only thought on it is to take a page out of SBricks book. They're making a commercial product and can't afford a patent scuffle with Lego. If they copied the connector, you can too for sure. Quote
joblog Posted February 14, 2015 Posted February 14, 2015 The trouble is the SoftwareSerial library, which is necessary when using the ATtiny84 since that microcontroller doesn't support hardware serial. If you happen to be writing to SoftwareSerial while data is coming in, the incoming data gets corrupted. Obviously, if the incoming data is corrupt, the receiver won't be responding to the commands you were sending it. It will be responding to garbage commands, some of which will look like real commands, and thus will result in the receiver responding to commands that the user did not send. I call this the "phantom commands" issue, and it took me a really long time to track down what was going wrong because it's so intermittent. The "solution" was to place a lock on the Bluetooth connection after sending a command and wait for the receiver's response before releasing the lock, thus allowing subsequent commands to be sent (links go to the lines of source code where these things happen). This works because the receiver goes quiet (not writing data to serial) after it has sent its one-byte response, and therefore the next command the app sends won't be clobbered by the receiver's response stage. However, this "solution" means that if the app somehow misses the receiver's response, it becomes locked up and must be restarted (cleared from the recent apps and reopened). I haven't read all your code but I think I ran in to something vaguely similar. I was using SoftwareSerial for the Bluetooth connection and getting a lot of corruption of the commands being sent. It is a very clunky solution but what about an absolute delay before sending the next command? Is it possible to estimate how long it will take the receiver to send its one-byte response and go quiet? Using a straight forward delay you obviously don't get locked up by missing the receivers response. Or you could combine both - wait for the receivers response and if it doesn't arrive after a given time then free up Serial for another command. This is as obvious as it is ugly and you've probably tried it already but, assuming we had similar problems, it's what worked for me. Quote
nbhamilt Posted February 21, 2015 Posted February 21, 2015 No worries OzShan! I've got great news: Doc and I had some productive discussion and he provided an excellent mockup of a case! I went on to make some modifications, and the 3d file is now hosted in the repository: https://github.com/B...kster8884bt.stl (The interactive preview shows some invisible faces on the inside of the bottom half, but they do exist. I think the normals are backward.) I had the prototype 3D printed from Shapeways, and put together this little video update: In summary: Dimensions: 3 x 4 x 1 2/3 Input: 1 on bottom Output: 2 on top Technic holes: added externally (can make holes face sides, or use axle holes, etc) I really appreciate any feedback I can get about the current case design. Please let me know what you like and what you don't like. Do you think BricksTer needs a case at all? As a last note, I had to really hack the PCB to get it to interface with the enclosure. Even now it can still be a little uncooperative at times. This is understandable; the current PCB wasn't designed to be put in a box! I plan to make another revision of the PCB and design it with this in mind. I wonder whether a smaller form factor would be better, one that rather than having to be as deep as this, had a short lead to which a battery box could be connected, either with a PF connector if that's what people wanted, or more likely for people doing small projects, with a simple 9v battery connector. that way one could simply use a 9v battery or a home made (smaller) battery box. The top would remain the same (4x3) but it could be only 2/3 of a brick deep instead of almost 2 full blocks. Out of interest how did you create the electrical contacts and then wire them onto the board that went into the to connectors inside the top of the box? I am looking to try and build one of these, have there been any revisions? are all teh components still easy to find, i couldn't' quite work out 'J1' - is this something that slots into the drills and enables the chip to be programmed by connecting it to the PC? Quote
vmckee Posted February 24, 2015 Posted February 24, 2015 I am looking to try and build one of these, have there been any revisions? are all teh components still easy to find, i couldn't' quite work out 'J1' - is this something that slots into the drills and enables the chip to be programmed by connecting it to the PC? I think for J1 he recommends the AVRISP mk2: http://www.atmel.com/tools/avrispmkii.aspx . I bought the components to build this last week from Digikey and the bluetooth module from dealextreme.com. Earlier in this thread it seemed like it wasn't advised to use the Arduino to program the attiny84. Is this going to brick my attiny or should I just buy the avrisp mk2? Thanks codefox and others for all you've done on this! Quote
legoman666 Posted March 9, 2015 Posted March 9, 2015 I think for J1 he recommends the AVRISP mk2: http://www.atmel.com...avrispmkii.aspx . I bought the components to build this last week from Digikey and the bluetooth module from dealextreme.com. Earlier in this thread it seemed like it wasn't advised to use the Arduino to program the attiny84. Is this going to brick my attiny or should I just buy the avrisp mk2? Thanks codefox and others for all you've done on this! I used this: https://www.sparkfun.com/products/11801 cheap and works fine. I did need to download an addon for the arduino program so that it could use it though. Quote
nbhamilt Posted March 13, 2015 Posted March 13, 2015 Well i have bought all the components (and my boards just arrived from OSH), of sorts, i wanted to check a couple of things. I did my order through Mouser, which did not have every capacitor on the list (WELL NOT THE SAME MANUFACTURERS), i made the following substitutions, but before i go ahead, i just wanted to be sure that there is no difference between manufacturers given same tolerances, voltages, etc. especially as in the diagram given C5 is polarised unlike all the other capacitors. I am also planning on using 2(o r3) molex headers (http://uk.farnell.com/molex/87437-0473/header-4pos-1row-1-5mm/dp/2334003) to enable attachment to the lego connectors to save soldering on wires or using the large plastic casing that doubles the price of the unit. I may later try and devise a new housing if this experiment works. On a separate note i came across http://highlowtech.org/?p=1695 , which seems to suggest you can use an arduino to program the attiny84, it seems pretty straigfht forward in fact and again saves buying the [programmer, is there any obvious reason thius wont work? i believe the attiny84 is safe at up to 5.5v, so the 5v output (which could be voltage divided to 3.3v if necessary anyway) so it shouldnt damage the chip (can it). sorry if these are noob questions, but this is all a new thing to me. thanks C1 CapCer0.1uF 0805 (CC0805ZRY5V9BB104) VJ0805V104ZXACW1BC Manufacturer: Vishay Desc.: Multilayer Ceramic Capacitors MLCC - SMD/SMT 0805 0.1uF 50volts Y5V +80-20% C2/C5 CapCer10uF 1206 (CL31F106ZOHNNNE) swapped to CC1206ZKY5V7BB106 Manufacturer: Yageo Desc.: Multilayer Ceramic Capacitors MLCC - SMD/SMT 10uF Y5V -20/+80% 16V C3 CapCer10000pF 0805 (CC0805KRX7R9BB103) toVJ0805Y103KXAAR Manufacturer: Vishay Desc.: Multilayer Ceramic Capacitors MLCC - SMD/SMT 0805 0.01uF 50volts X7R 10% C4 CapCer2.2uF 0805 (CL21F225ZOFNNNE) Mfr. #: GRM21BF51C225ZA01K Manufacturer: Murata Desc.: Multilayer Ceramic Capacitors MLCC - SMD/SMT 0805 2.2uF 16volts Y5V +80-20% Quote
legoman666 Posted March 13, 2015 Posted March 13, 2015 The programmer I linked to is an Arduino, so yes it's possible. Quote
joblog Posted March 23, 2015 Posted March 23, 2015 I don't want to steal anyone's thunder but the update to Attiny that codefox was waiting on has been available for a few weeks now and I wish him luck. This would allow the ATtiny84 in his original set up to be replaced by the ATtiny841 which has a hardware serial and the signal corruption problems that made the ATtiny84 unusable can be avoided. It also allows the ATtiny pins to be mapped to Arduino pins. The reason I'm posting is that I have been looking at something that makes my request for a programmable processor in the brick more or less redundant. A4S allows an Arduino to be controlled using Scratch. If you want to test it there's a very easy 3 button implementation called, appropriately enough, SuperEasy-A4S, available here. http://thomaspreece.com/resources/ You don't even need the Arduino IDE. Once the correct drivers are installed on the PC and SuperEasy-A4S has uploaded the appropriate firmata to an Arduino (or in the present case Arduino-like) board all the programming of the board - pinMode, digitalRead, analogWrite etc. - can be done using a sketch in Scratch. Serial communication with the board through a Bluetooth module is taken care of under the hood - pair the Bluetooth module with your computer and if the sketch says to digitalWrite pin 10 HIGH when the spacebar is pressed then that's what happens. But, being Scratch, you can also turn on the Lego motors when a cartoon figure walks in to a tree on the PC or, sometime in the future, have the PC play a tune when a sensor attached to the brick sees something. Getting this working with a sealed 4x3x2 brick would look pretty close to magic. I have it working on a Dueminalove 328 over a HC-05 at 9600 Baud. Here's some of a program for running two motors written by a six year old. Quote
Zmei_gorini4 Posted April 9, 2015 Posted April 9, 2015 codefox421 it's a really cool project. after week or two I plan to assemble that bluetooth device. thank you. Quote
nbhamilt Posted June 3, 2015 Posted June 3, 2015 I downloaded the android master and not knowing any better installed Android Studeo to compile it up to my phone and it came up with one command not recognised in the build.gradle - it was the runProguard False. Apparently in newer versions this is now minifyEnabled False so i altered it and it seemed to compile up to my Sony (run on Jellybean) phone. the board is still in production and i hope to upload drivers to it this week. the android phone has a working image, albeit the graphics are slightly misaligned with the touch sensitive areas, but as yet do not know if it will run the receiver. was there a simpler way to upload the software to my android phone that I missed that would have saved changing anything? Quote
vmckee Posted June 9, 2015 Posted June 9, 2015 (edited) was there a simpler way to upload the software to my android phone that I missed that would have saved changing anything? I don't think there is a current android binary posted, just the one on page 3. I mentioned a few months ago about buying the bluetooth transceiver from dealextreme. These are HC-06, at least the one I got. It seems to work, but had to comment out pinMode(btResetPin, OUTPUT) from the firmware otherwise the module would not turn on. Also had to remove the semaphore from the bluetoothSerialService class or the app will hang. I ordered HC-05 modules from Banggood.com last week. Edited June 17, 2015 by vmckee Quote
joblog Posted June 13, 2015 Posted June 13, 2015 (edited) DIY Mindstorms for 20 € / 20 $ Here is an Arduino Nano 328(clone), a TB6612FNG Dual Motor Driver and a HC05 bluetooth module all crushed in to a Lego Technic 9x5x3 enclosure. The whole lot, including motors and batteries, cost less than twenty euros/ dollars. It runs the Scratch sketch from the last post among other things and does it over Bluetooth. codefox is going to put all of this in to a pretty 4x3x2 lego brick and I, for one, can't wait. Edited June 14, 2015 by joblog Quote
Randavian Posted June 25, 2015 Posted June 25, 2015 Greetings, I was wondering if anyone here would be willing to assemble one of these boards for me.?. My success rate for soldering through-hole PCBs is 50/50 and I do not think I would have better odds with a surface mount board. I would be willing to compensate you a little for your time and effort. Thanks Quote
legoman666 Posted July 11, 2015 Posted July 11, 2015 (edited) Greetings, I was wondering if anyone here would be willing to assemble one of these boards for me.?. My success rate for soldering through-hole PCBs is 50/50 and I do not think I would have better odds with a surface mount board. I would be willing to compensate you a little for your time and effort. Thanks I can solder a couple up for you if you want. Cost for components is about $20/ea + extra for PF connectors. Normally I cut a PF extension cable in half. PF extensions are $3. + a couple dollars for shipping and materials. Call it $28 for 1, or $50 for 2. Shoot me an email @ legoman666@gmail.com if you're interested. Edited July 11, 2015 by legoman666 Quote
codefox421 Posted July 20, 2015 Author Posted July 20, 2015 (edited) Whoa, there's been a bit of activity in this thread, and I haven't been getting notifications about it. Weird. Anyway... i just wanted to be sure that there is no difference between manufacturers given same tolerances, voltages, etc. Yep, assuming all the specs are the same, there should be no difference between manufacturers. I am also planning on using 2 (or 3) molex headers (http://uk.farnell.co...-5mm/dp/2334003) to enable attachment to the lego connectors to save soldering on wires or using the large plastic casing that doubles the price of the unit. I may later try and devise a new housing if this experiment works. Heh, I've been experimenting with some JST-ZH connectors among other things (click for high-res): Similar idea to your molex connectors. JST-ZH is the connector type LifeLites uses in their products. i believe the attiny84 is safe at up to 5.5v, so the 5v output (which could be voltage divided to 3.3v if necessary anyway) so it shouldnt damage the chip (can it) The ATtiny84 is rated for 5.5v, but the HC-06 is only rated for about 3.3v (it's actually something like 3.8v, but I don't have the datasheet at hand). Both the ATtiny84 and the HC-06 are connected to the same 3v3 line, so you could potentially damage the Bluetooth module if your programmer feeds 5v to the board. It runs the Scratch sketch from the last post among other things and does it over Bluetooth. That's awesome! Will you be posting a topic about your project? I'd love to hear more! Also, I've been playing around with one of the new ATtiny841s. I programmed it for the first time last night. I gave up on using the Arduino IDE for this chip though, so I'm fumbling around in Atmel Studio to figure out how to do all the things Arduino makes so simple. It will take some time, but that hardware serial will be well worth it! had to comment out pinMode(btResetPin, OUTPUT) from the firmware otherwise the module would not turn on. Also had to remove the semaphore from the bluetoothSerialService class or the app will hang. I ordered HC-05 modules from Banggood.com last week. Better than commenting out that line would be to uncomment the line 3 down: digitalWrite(btResetPin, HIGH); // end Bluetooth reset This will drive the BTRST line high, thus enabling the HC-06. If btResetPin is allowed to float (not set as an output), static charges may cause the HC-06 to reset sporadically. The semaphore in bluetoothSerialService is used to circumvent an issue with SoftwareSerial where the transmitted value clobbers the received value. Your mileage may vary, but that semaphore was introduced to fix this issue, which outwardly looked like the 8884bt responding to commands that differed from the commands being sent to it. I haven't played with the HC-05. How do you like it? Edited July 20, 2015 by codefox421 Quote
joblog Posted August 4, 2015 Posted August 4, 2015 Also, I've been playing around with one of the new ATtiny841s. I programmed it for the first time last night. I gave up on using the Arduino IDE for this chip though, so I'm fumbling around in Atmel Studio to figure out how to do all the things Arduino makes so simple. It will take some time, but that hardware serial will be well worth it! Hi codefox, good to hear from you. I just got the ATtiny841 with the intention of programming it with Arduino. I'm looking at this https://github.com/SpenceKonde/arduino-tiny-841 this http://elecrab.com/archives/826 and this http://forum.arduino.cc/index.php?topic=304606 I'm very interested in why you gave up on using the Arduino IDE. Are there pitfalls I should be looking out for? Quote
codefox421 Posted August 6, 2015 Author Posted August 6, 2015 Hi codefox, good to hear from you. I just got the ATtiny841 with the intention of programming it with Arduino. I'm looking at this https://github.com/SpenceKonde/arduino-tiny-841 this http://elecrab.com/archives/826 and this http://forum.arduino.cc/index.php?topic=304606 I'm very interested in why you gave up on using the Arduino IDE. Are there pitfalls I should be looking out for? I gave Arduino IDE another shot. As it turns out, getting the arduino-tiny-841 core up and running is much easier with Arduino IDE 1.6.3+, so I can continue utilizing Arduino going forward. I was using an older version before, which was causing the trouble. Quote
codefox421 Posted August 14, 2015 Author Posted August 14, 2015 I soldered up one of the new boards this weekend. Haven't had a chance to program it yet, but I'll get to that soon. It uses the ATtiny841, which means I'll finally be able to use hardware serial. Woot! :D Bluetooth Receiver (Top) by Nick Iaconis, on Flickr Bluetooth Receiver (Bottom) by Nick Iaconis, on Flickr Quote
legoman666 Posted August 15, 2015 Posted August 15, 2015 Looking good. Do I need to make a few? Quote
codefox421 Posted August 16, 2015 Author Posted August 16, 2015 Looking good. Do I need to make a few? Up to you. I should have some more updates about it to post in the near future, but for now here's this: And a link to the new repo, though it's still kind of under construction (needs a README and a BOM): https://github.com/B...etooth-receiver Quote
nbhamilt Posted August 22, 2015 Posted August 22, 2015 Hi i've just been looking again at the previous version of the board and the way the battery box power functions cable supplies power. Given the lego power supply, whilst having four wires, only appears to use two of them, the two outside wires, 9v and GND/0v, why is bridge rectifier B2 required? is it simply in case someone mis-ires the plug in for protecting the circuit/ ensuring it works? i'm sure there is a good reason, but i'm also a bit flummoxed over it tbh.. Quote
codefox421 Posted August 23, 2015 Author Posted August 23, 2015 Given the lego power supply, whilst having four wires, only appears to use two of them, the two outside wires, 9v and GND/0v, why is bridge rectifier B2 required? B2 is for support of old 9v battery boxes. Power Functions cables can connect to these battery boxes, but they do so on C1/C2 instead of 9v/GND. The bridge rectifier ensures the polarity of the input voltage from old battery boxes, which would otherwise be at risk of being connected backward. If you don't plan to use these battery boxes, you can leave B2 unpopulated. If I haven't mentioned it before, you can probably leave B3 and B4 unpopulated in general. These were intended to be electrical "safety valves" to deal with back EMF from motors, but I've since realized that this function is built into the DRV8833 motor driver IC. Quote
legoman666 Posted August 25, 2015 Posted August 25, 2015 I sometimes have problems with the controller resetting when rapidly switching directions. Could probably be fixed with varistors across motor outputs, but I haven't bothered. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.